本文整理汇总了C++中UserList类的典型用法代码示例。如果您正苦于以下问题:C++ UserList类的具体用法?C++ UserList怎么用?C++ UserList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveUserFile
void IoHandler::saveUserFile(string userFile, UserList &userList)
{
ofstream outputFile;
outputFile.open(userFile);
if (outputFile.fail())
{
cout << "파일을 찾을수 없습니다.";
return;
}
for (int i = 0; i < userList.getSize(); ++i)
{
outputFile << "[" << userList.getUserByIndex(i).getName() << "]" << " ";
outputFile << "[" << userList.getUserByIndex(i).getWinCount() << "]" << " ";
outputFile << "[" << userList.getUserByIndex(i).getLoseCount() << "]";
if (i != userList.getSize() - 1)
{
outputFile << endl;
}
}
outputFile.close();
}
示例2: kdebugf
bool KaduExtInfo::getSelectedUser(QString &user)
{
kdebugf();
#if defined(KADU_0_4_x)
UserBox *activeUserBox = kadu->userbox()->getActiveUserBox();
#elif defined(KADU_0_5_0)
UserBox *activeUserBox = kadu->userbox()->activeUserBox();
#endif
if (activeUserBox == NULL)//to siê zdarza...
{
kdebugf2();
return false;
}
#if defined(KADU_0_4_x)
UserList users = activeUserBox->getSelectedUsers();
#elif defined(KADU_0_5_0)
UserListElements users = activeUserBox->selectedUsers();
#endif
if (users.count() == 1)
{
user = (*users.begin()).altNick();
kdebugf2();
return true;
}
return false;
kdebugf2();
}
示例3: SystemName
int GeUser::modify_user(char* system, char* user, char* password,
unsigned int priv, char* fullname, char* description, char* email,
char* phone, char* sms)
{
int sts;
UserList* ul;
SystemName* sn = new SystemName(system);
sts = sn->parse();
if (EVEN(sts)) {
delete sn;
return sts;
}
SystemList* sl = find_system(sn);
delete sn;
if (!sl)
return USER__NOSUCHSYSTEM;
ul = (UserList*)sl->find_user(user);
if (!ul)
return USER__NOSUCHUSER;
ul->modify(password, priv, fullname, description, email, phone, sms);
return USER__SUCCESS;
}
示例4: users
void Element::setUsers( UserList ul )
{
if (!isRecord())
return;
UserList toAdd;
UserList toRemove;
UserList currentUsers = users();
foreach( User emp, ul )
if( !currentUsers.contains( emp ) )
toAdd += emp;
foreach( User eu, currentUsers )
if( !ul.contains( eu ) )
toRemove += eu;
ElementUserList tul = ElementUser::recordsByElement( *this );
foreach( ElementUser eu, tul )
if( toRemove.contains( eu.user() ) )
eu.remove();
foreach( User emp, toAdd )
{
ElementUser tu;
tu.setElement( *this );
tu.setUser( emp );
tu.setActive( 1 );
tu.commit();
}
示例5: getCurrentdUser
LRESULT WaitingUsersFrame::onRemove(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (getSelectedUser())
{
const UserPtr User = getCurrentdUser();
if (User)
{
UploadManager::LockInstanceQueue lockedInstance; // [+] IRainman opt.
lockedInstance->clearUserFilesL(User);
}
}
else
{
if (m_ctrlList.getSelectedCount())
{
int j = -1;
UserList RemoveUsers;
while ((j = m_ctrlList.GetNextItem(j, LVNI_SELECTED)) != -1)
{
// Ok let's cheat here, if you try to remove more users here is not working :(
RemoveUsers.push_back((m_ctrlList.getItemData(j))->getUser());
}
UploadManager::LockInstanceQueue lockedInstance; // [+] IRainman opt.
for (auto i = RemoveUsers.cbegin(); i != RemoveUsers.cend(); ++i)
{
lockedInstance->clearUserFilesL(*i);
}
}
}
m_needsUpdateStatus = true; // [!] IRainman opt.
return 0;
}
示例6: GetV6Chat3App
int LuaV6Chat3App::ChatWithText(lua_State *luaState)
{
V6Chat3App *App = GetV6Chat3App(luaState);
if (App)
{
lua_Integer uid = lua_tointeger(luaState, 2);
size_t text_len=lua_objlen(luaState, 3);
const char *text = lua_tolstring(luaState, 3, &text_len);
wstring wtext = V6Util::Utf8ToUnicode(text);
string st;
UserList *list = UserList::Instance();
list->RecordChatText(uid, wtext, st);
Handle<MsgSender> sender;
list->GetUserSender(uid, sender);
sender->ChatWithTextMsg(wtext, st);
lua_pushstring(luaState, st.c_str());
return 1;
}
lua_pushnil(luaState);
return 1;
}
示例7: Update
STATE StateNetwork::Update()
{
if(m_pNetworkControler && (m_pNetworkControler->GetNetworkState() == CLIENT))
{
m_pNetworkControler->ReceivePacket();
SmartPointer<PacketAddr> pAddr;
if((pAddr = m_pNetworkControler->GetPacket()) != NULL)
{
if( pAddr->m_Packet.Protocolid() == CONNECT_REQ)
{
UserInfomationPacketMaker pkMaker;
pkMaker.SetPacket(&pAddr->m_Packet);
UserList lst = pkMaker.OutPutUserInformation();
UserList::iterator iter;
for(iter = lst.begin(); iter != lst.end(); iter++)
{
//여기에다가 이미 존재하는 유져가 있을경우 AddUser를 호출하지 않게 만들어야 함...
m_pNetworkControler->AddUser((*iter));
delete (*iter);
}
lst.clear();
m_pNetworkControler->SetMyUserID(pAddr->m_Packet.ID());
return STATE_WAITINGROOM;
}
}
}
if(m_bSelectState)
return STATE_WAITINGROOM;
else
return STATE_NONE;
}
示例8: getUserList
//向客户端发送所有的用户信息
void getUserList(sockaddr_in sender)
{
int len = (int)clientList.size();
sendto(primarySock,(const char *)&len,sizeof(len),0,(SOCKADDR *)&sender,sizeof(sender));
for(UserList::iterator UserIterator = clientList.begin(); UserIterator != clientList.end(); ++UserIterator)
{
sendto(primarySock,(const char *)(*UserIterator),sizeof(stUserListNode),0,(SOCKADDR *)&sender,sizeof(sender));
}
}
示例9: getFromWebService
User *
Query::getUserByName(const string &name)
{
Metadata *metadata = getFromWebService("user", "", NULL, &UserFilter().name(name));
UserList list = metadata->getUserList(true);
delete metadata;
if (list.size() > 0)
return list[0];
else
throw ResponseError("response didn't contain user data");
}
示例10: GetUser
stUserListNode GetUser(char *username)
{
for(UserList::iterator UserIterator=ClientList.begin();
UserIterator!=ClientList.end();
++UserIterator)
{
if( strcmp( ((*UserIterator)->userName), username) == 0 )
return *(*UserIterator);
}
throw Exception("not find this user");
}
示例11: GetUser
stUserListNode GetUser(char *userName)
{
for (auto ClientList_iter = ClientList.begin(); ClientList_iter != ClientList.end(); ++ClientList_iter)
{
if (strcmp((*ClientList_iter)->userName, userName) == 0)
return *(*ClientList_iter);
}
std::cout << "can not find user: " << userName << std::endl;
exit(0);
}
示例12: removeSelected
void UploadQueueFrame::removeSelected() {
int i = -1;
UserList RemoveUsers;
while((i = ctrlList.GetNextItem(i, LVNI_SELECTED)) != -1) {
// Ok let's cheat here, if you try to remove more users here is not working :(
RemoveUsers.push_back(((UploadQueueItem*)ctrlList.getItemData(i))->getUser());
}
for(auto i = RemoveUsers.begin(); i != RemoveUsers.end(); ++i) {
UploadManager::getInstance()->clearUserFiles(*i, true);
}
updateStatus();
}
示例13: processRemoveFromListEvent
void TabUserLists::processRemoveFromListEvent(const Event_RemoveFromList &event)
{
QString list = QString::fromStdString(event.list_name());
QString user = QString::fromStdString(event.user_name());
UserList *userList = 0;
if (list == "buddy")
userList = buddyList;
else if (list == "ignore")
userList = ignoreList;
if (!userList)
return;
userList->deleteUser(user);
}
示例14: removeUser
void removeUser(char *name)
{
stUserListNode *removeNode;
removeNode = getUser(name);
clientList.remove(removeNode);
for(UserList::iterator UserIterator = clientList.begin(); UserIterator != clientList.end(); ++UserIterator)
{
stUserListNode *tmpNode = (stUserListNode *)(*UserIterator);
u_long ip = htonl(tmpNode->ip);
cout << "username :" << tmpNode->stUserName <<" ip:"<<inet_ntoa(*(in_addr *)&ip) <<" port:"<<tmpNode->port <<endl;
}
}
示例15: calloc
void rt_pvd_udb::load_systemgroup( SystemList *systemgroup)
{
procom_obj item;
pwr_sClass_SystemGroupReg *body;
char sname[120];
char *s;
body = (pwr_sClass_SystemGroupReg *) calloc( 1, sizeof(pwr_sClass_SystemGroupReg));
item.body = body;
gu->get_system_name( systemgroup, sname);
if (( s = strrchr( sname, '.')))
strcpy( item.name, s+1);
else
strcpy( item.name, sname);
gu->get_system_data( sname, &body->Attributes, &item.oix, body->Description);
item.oix++;
if ( next_oix <= item.oix)
next_oix = item.oix + 1;
item.cid = pwr_cClass_SystemGroupReg;
item.fthoix = menu_stack[menu_cnt - 1];
item.bwsoix = m_list[item.fthoix].lchoix;
if ( item.bwsoix)
m_list[item.bwsoix].fwsoix = item.oix;
if ( m_list[item.fthoix].fchoix == 0)
m_list[item.fthoix].fchoix = item.oix;
m_list[item.fthoix].lchoix = item.oix;
item.body_size = sizeof(pwr_sClass_SystemGroupReg);
menu_stack[menu_cnt] = item.oix;
menu_cnt++;
if ( m_list.size() <= item.oix + 1)
m_list.resize( item.oix + 1);
m_list[item.oix] = item;
UserList *user = systemgroup->first_user();
while ( user) {
load_user( user, systemgroup);
user = user->next_user();
}
SystemList *sg = systemgroup->first_system();
while ( sg) {
load_systemgroup( sg);
sg = sg->next_system();
}
menu_cnt--;
}