本文整理汇总了C++中boost::shared_ptr::GetAccounts方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::GetAccounts方法的具体用法?C++ shared_ptr::GetAccounts怎么用?C++ shared_ptr::GetAccounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::GetAccounts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
NameChanger::RenameDomain(const String& oldDomainName, boost::shared_ptr<Domain> pDomain, String &errorMessage)
{
const String& newDomainName = pDomain->GetName();
if (!_RenameDomainDataDirectory(oldDomainName, pDomain->GetName(), errorMessage))
return false;
// Update accounts...
std::vector<boost::shared_ptr<Account> > vecAccounts = pDomain->GetAccounts()->GetVector();
std::vector<boost::shared_ptr<Account> >::iterator iterAccount = vecAccounts.begin();
std::vector<boost::shared_ptr<Account> >::iterator iterAccountEnd = vecAccounts.end();
for (; iterAccount != iterAccountEnd; iterAccount++)
{
boost::shared_ptr<Account> pAccount = (*iterAccount);
String sAddress = pAccount->GetAddress();
_UpdateDomainName(sAddress, oldDomainName, newDomainName);
pAccount->SetAddress(sAddress);
String currentVal = pAccount->GetForwardAddress();
if (_UpdateDomainName(currentVal, oldDomainName, newDomainName))
pAccount->SetForwardAddress(currentVal);
PersistentAccount::SaveObject(pAccount);
}
// Update aliases...
std::vector<boost::shared_ptr<Alias> > vecAliases = pDomain->GetAliases()->GetVector();
std::vector<boost::shared_ptr<Alias> >::iterator iterAlias = vecAliases.begin();
std::vector<boost::shared_ptr<Alias> >::iterator iterAliasEnd = vecAliases.end();
for (; iterAlias != iterAliasEnd; iterAlias++)
{
boost::shared_ptr<Alias> pAlias = (*iterAlias);
String sAddress = pAlias->GetName();
_UpdateDomainName(sAddress, oldDomainName, newDomainName);
pAlias->SetName(sAddress);
String aliasValue = pAlias->GetValue();
if (_UpdateDomainName(aliasValue, oldDomainName, newDomainName))
pAlias->SetValue(aliasValue);
PersistentAlias::SaveObject(pAlias);
}
// Update lists...
std::vector<boost::shared_ptr<DistributionList> > vecLists = pDomain->GetDistributionLists()->GetVector();
std::vector<boost::shared_ptr<DistributionList> >::iterator iterList = vecLists.begin();
std::vector<boost::shared_ptr<DistributionList> >::iterator iterListEnd = vecLists.end();
for (; iterList != iterListEnd; iterList++)
{
boost::shared_ptr<DistributionList> pList = (*iterList);
String sAddress = pList->GetAddress();
_UpdateDomainName(sAddress, oldDomainName,newDomainName);
pList->SetAddress(sAddress);
vector<boost::shared_ptr<HM::DistributionListRecipient>> recipients = pList->GetMembers()->GetVector();
boost_foreach(boost::shared_ptr<DistributionListRecipient> recipient, recipients)
{
String address = recipient->GetAddress();
if (_UpdateDomainName(address,oldDomainName, newDomainName))
{
recipient->SetAddress(address);
PersistentDistributionListRecipient::SaveObject(recipient);
}
}
PersistentDistributionList::SaveObject(pList);
}