本文整理汇总了C++中UserList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ UserList::begin方法的具体用法?C++ UserList::begin怎么用?C++ UserList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: getSelectedUser
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: 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));
}
}
示例4: 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");
}
示例5: 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();
}
示例6: 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);
}
示例7: 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;
}
}
示例8: getUser
stUserListNode* getUser(char *name)
{
stUserListNode *node = NULL;
stUserListNode *removeNode = NULL;
for(UserList::iterator UserIterator = clientList.begin(); UserIterator != clientList.end(); ++UserIterator)
{
node = (stUserListNode *)(*UserIterator);
if(strcmp(node->stUserName,name) == 0)
{
removeNode = node;
break;
}
}
return removeNode;
}
示例9: clientLogin
/**
用户登陆时,记录用户信息
并输出所有登陆的用户信息
*/
void clientLogin(stMessage *message, sockaddr_in *sender)
{
cout << "client connected :" << message->message.loginMessage.stUserName <<endl;
stUserListNode *node = new stUserListNode;
strcpy(node->stUserName,message->message.loginMessage.stUserName);
node->ip = ntohl(sender->sin_addr.S_un.S_addr);
node->port = ntohs(sender->sin_port);
clientList.push_back(node);
cout << "total client is " << clientList.size() <<endl;
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;
}
}
示例10: limitList
void EditUsers::limitList()
{
WContainerWidget* list = new WContainerWidget;
bindWidget("user-list",list);
typedef dbo::collection<dbo::ptr<User> > UserList;
dbo::Transaction t(session_);
UserList users = session_.find<User>().where("name like ?").bind("%"+limitEdit_->text()+"%").orderBy("name");
for (UserList::const_iterator i = users.begin(); i != users.end(); ++i) {
WText* t = new WText((*i)->name, list);
t->setStyleClass("link");
new WBreak(list);
t->clicked().connect(boost::bind(&EditUsers::onUserClicked, this, (*i).id()));
}
if (!users.size())
new WText(tr("no-users-found"),list);
}
示例11: processAllocStack
bool DeadObjectElimination::processAllocStack(AllocStackInst *ASI) {
// Trivial types don't have destructors. Let's try to zap this AllocStackInst.
if (!ASI->getElementType().isTrivial(ASI->getModule()))
return false;
UserList UsersToRemove;
if (hasUnremovableUsers(ASI, UsersToRemove)) {
DEBUG(llvm::dbgs() << " Found a use that cannot be zapped...\n");
return false;
}
// Remove the AllocRef and all of its users.
removeInstructions(
ArrayRef<SILInstruction*>(UsersToRemove.begin(), UsersToRemove.end()));
DEBUG(llvm::dbgs() << " Success! Eliminating alloc_stack.\n");
++DeadAllocStackEliminated;
return true;
}
示例12: processAllocRef
bool DeadObjectElimination::processAllocRef(AllocRefInst *ARI) {
// Ok, we have an alloc_ref. Check the cache to see if we have already
// computed the destructor behavior for its SILType.
bool HasSideEffects;
SILType Type = ARI->getType();
auto CacheSearchResult = DestructorAnalysisCache.find(Type);
if (CacheSearchResult != DestructorAnalysisCache.end()) {
// Ok we found a value in the cache.
HasSideEffects = CacheSearchResult->second;
} else {
// We did not find a value in the cache for our destructor. Analyze the
// destructor to make sure it has no side effects. For now this only
// supports alloc_ref of classes so any alloc_ref with a reference type
// that is not a class this will return false for. Once we have analyzed
// it, set Behavior to that value and insert the value into the Cache.
//
// TODO: We should be able to handle destructors that do nothing but release
// members of the object.
HasSideEffects = doesDestructorHaveSideEffects(ARI);
DestructorAnalysisCache[Type] = HasSideEffects;
}
if (HasSideEffects) {
DEBUG(llvm::dbgs() << " Destructor had side effects. \n");
return false;
}
// Our destructor has no side effects, so if we can prove that no loads
// escape, then we can completely remove the use graph of this alloc_ref.
UserList UsersToRemove;
if (hasUnremovableUsers(ARI, UsersToRemove)) {
DEBUG(llvm::dbgs() << " Found a use that cannot be zapped...\n");
return false;
}
// Remove the AllocRef and all of its users.
removeInstructions(
ArrayRef<SILInstruction*>(UsersToRemove.begin(), UsersToRemove.end()));
DEBUG(llvm::dbgs() << " Success! Eliminating alloc_ref.\n");
++DeadAllocRefEliminated;
return true;
}
示例13: onRemove
LRESULT UploadQueueFrame::onRemove(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
if(usingUserMenu) {
UserPtr User = getSelectedUser();
if(User) {
UploadManager::getInstance()->clearUserFiles(User);
}
} else {
int i = -1;
UserList RemoveUsers;
while((i = ctrlList.GetNextItem(i, LVNI_SELECTED)) != -1) {
RemoveUsers.push_back(((UploadQueueItem*)ctrlList.getItemData(i))->getUser());
}
for(UserList::const_iterator i = RemoveUsers.begin(); i != RemoveUsers.end(); ++i) {
UploadManager::getInstance()->clearUserFiles(*i);
}
}
updateStatus();
return 0;
}
示例14: LimitList
/* ****************************************************************************
* Limit List
*/
void EditUsers::LimitList()
{
Wt::WContainerWidget* list = new Wt::WContainerWidget;
bindWidget("user-list",list);
typedef Wt::Dbo::collection<Wt::Dbo::ptr<User> > UserList;
Wt::Dbo::Transaction t(session_);
UserList users = session_.find<User>().where("name like ?").bind("%"+limitEdit_->text()+"%").orderBy("name");
Wt::WSignalMapper<Wt::Dbo::dbo_traits<User>::IdType >* userLinkMap = new Wt::WSignalMapper<Wt::Dbo::dbo_traits<User>::IdType >(this);
userLinkMap->mapped().connect(this,&EditUsers::OnUserClicked);
for (UserList::const_iterator i = users.begin(); i != users.end(); ++i)
{
Wt::WText* t = new Wt::WText((*i)->name, list);
t->setStyleClass("link");
new Wt::WBreak(list);
userLinkMap->mapConnect(t->clicked(), (*i).id());
}
if (!users.size())
{
new Wt::WText(tr("no-users-found"),list);
}
} // end void EditUsers::LimitList
示例15: runDCOP
/**
* Do the actual DCOP call
*/
int runDCOP(KStringList args, UserList users, Session session, const QString sessionName, bool readStdin, bool updateUserTime)
{
bool DCOPrefmode = false;
QCString app;
QCString objid;
QCString function;
KStringList params;
DCOPClient *client = 0L;
int retval = 0;
if(!args.isEmpty() && args[0].find("DCOPRef(") == 0)
{
int delimPos = args[0].findRev(',');
if(delimPos == -1)
{
cerr_ << "Error: '" << args[0] << "' is not a valid DCOP reference." << endl;
exit(-1);
}
app = args[0].mid(8, delimPos - 8);
delimPos++;
objid = args[0].mid(delimPos, args[0].length() - delimPos - 1);
if(args.count() > 1)
function = args[1];
if(args.count() > 2)
{
params = args;
params.remove(params.begin());
params.remove(params.begin());
}
DCOPrefmode = true;
}
else
{
if(!args.isEmpty())
app = args[0];
if(args.count() > 1)
objid = args[1];
if(args.count() > 2)
function = args[2];
if(args.count() > 3)
{
params = args;
params.remove(params.begin());
params.remove(params.begin());
params.remove(params.begin());
}
}
bool firstRun = true;
UserList::Iterator it;
QStringList sessions;
bool presetDCOPServer = false;
// char *dcopStr = 0L;
QString dcopServer;
for(it = users.begin(); it != users.end() || firstRun; ++it)
{
firstRun = false;
// cout_ << "Iterating '" << it.key() << "'" << endl;
if(session == QuerySessions)
{
QStringList sessions = dcopSessionList(it.key(), it.data());
if(sessions.isEmpty())
{
if(users.count() <= 1)
{
cout_ << "No active sessions";
if(!(*it).isEmpty())
cout_ << " for user " << *it;
cout_ << endl;
}
}
else
{
cout_ << "Active sessions ";
if(!(*it).isEmpty())
cout_ << "for user " << *it << " ";
cout_ << ":" << endl;
QStringList::Iterator sIt = sessions.begin();
for(; sIt != sessions.end(); ++sIt)
cout_ << " " << *sIt << endl;
cout_ << endl;
}
continue;
}
if(getenv("DCOPSERVER"))
{
sessions.append(getenv("DCOPSERVER"));
presetDCOPServer = true;
}
if(users.count() > 1 || (users.count() == 1 && (getenv("DCOPSERVER") == 0 /*&& getenv( "DISPLAY" ) == 0*/)))
{
//.........这里部分代码省略.........