本文整理汇总了C++中CClient::SetNetwork方法的典型用法代码示例。如果您正苦于以下问题:C++ CClient::SetNetwork方法的具体用法?C++ CClient::SetNetwork怎么用?C++ CClient::SetNetwork使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CClient
的用法示例。
在下文中一共展示了CClient::SetNetwork方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CloneNetworks
void CUser::CloneNetworks(const CUser& User) {
const vector<CIRCNetwork*>& vNetworks = User.GetNetworks();
for (CIRCNetwork* pUserNetwork : vNetworks) {
CIRCNetwork* pNetwork = FindNetwork(pUserNetwork->GetName());
if (pNetwork) {
pNetwork->Clone(*pUserNetwork);
} else {
new CIRCNetwork(this, *pUserNetwork);
}
}
set<CString> ssDeleteNetworks;
for (CIRCNetwork* pNetwork : m_vIRCNetworks) {
if (!(User.FindNetwork(pNetwork->GetName()))) {
ssDeleteNetworks.insert(pNetwork->GetName());
}
}
for (const CString& sNetwork : ssDeleteNetworks) {
// The following will move all the clients to the user.
// So the clients are not disconnected. The client could
// have requested the rehash. Then when we do
// client->PutStatus("Rehashing succeeded!") we would
// crash if there was no client anymore.
const vector<CClient*>& vClients = FindNetwork(sNetwork)->GetClients();
while (vClients.begin() != vClients.end()) {
CClient* pClient = vClients.front();
// This line will remove pClient from vClients,
// because it's a reference to the internal Network's vector.
pClient->SetNetwork(nullptr);
}
DeleteNetwork(sNetwork);
}
}