本文整理汇总了C++中AutoPtr::AddAdded方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoPtr::AddAdded方法的具体用法?C++ AutoPtr::AddAdded怎么用?C++ AutoPtr::AddAdded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoPtr
的用法示例。
在下文中一共展示了AutoPtr::AddAdded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareAddresses
/**
* Return two lists, a list of addresses that would be removed from
* mLinkAddresses and a list of addresses that would be added to
* mLinkAddress which would then result in target and mLinkAddresses
* being the same list.
*
* @param target is a LinkProperties with the new list of addresses
* @return the removed and added lists.
*/
ECode CLinkProperties::CompareAddresses(
/* [in] */ ILinkProperties* target,
/* [out] */ ICompareResult** result)
{
VALIDATE_NOT_NULL(result);
/*
* Duplicate the LinkAddresses into removed, we will be removing
* address which are common between mLinkAddresses and target
* leaving the addresses that are different. And address which
* are in target but not in mLinkAddresses are placed in the
* addedAddresses.
*/
List< AutoPtr<ILinkAddress> > cprRemoved(mLinkAddresses);
List< AutoPtr<ILinkAddress> >::Iterator iter;
AutoPtr<ICompareResult> cprResult;
CCompareResult::New((ICompareResult**)&cprResult);
if (target != NULL) {
AutoPtr<IObjectContainer> container;
FAIL_RETURN(target->GetLinkAddresses((IObjectContainer **)&container));
AutoPtr<IObjectEnumerator> emu;
FAIL_RETURN(container->GetObjectEnumerator((IObjectEnumerator **)&emu))
Boolean hasNext;
while (emu->MoveNext(&hasNext), hasNext) {
AutoPtr<ILinkAddress> newAddress;
emu->Current((IInterface**)&newAddress);
iter = Find(cprRemoved.Begin(), cprRemoved.End(), newAddress);
if (iter == cprRemoved.End()) {
cprResult->AddAdded(newAddress);
}
else {
cprRemoved.Erase(iter);
}
}
}
for (iter = cprRemoved.Begin(); iter != cprRemoved.End(); ++iter) {
cprResult->AddRemoved(*iter);
}
*result = cprResult;
REFCOUNT_ADD(*result);
return NOERROR;
}
示例2: CompareRoutes
/**
* Return two lists, a list of routes that would be removed from
* mRoutes and a list of routes that would be added to
* mRoutes which would then result in target and mRoutes
* being the same list.
*
* @param target is a LinkProperties with the new list of routes
* @return the removed and added lists.
*/
ECode CLinkProperties::CompareRoutes(
/* [in] */ ILinkProperties* target,
/* [out] */ ICompareResult** result)
{
VALIDATE_NOT_NULL(result);
List< AutoPtr<IRouteInfo> > cprRemoved(mRoutes);
List< AutoPtr<IRouteInfo> >::Iterator iter;
AutoPtr<ICompareResult> cprResult;
CCompareResult::New((ICompareResult**)&cprResult);
if (target != NULL) {
AutoPtr<IObjectContainer> container;
FAIL_RETURN(target->GetRoutes((IObjectContainer **)&container));
AutoPtr<IObjectEnumerator> emu;
FAIL_RETURN(container->GetObjectEnumerator((IObjectEnumerator **)&emu))
Boolean hasNext;
while(emu->MoveNext(&hasNext), hasNext) {
AutoPtr<IRouteInfo> newRoute;
emu->Current((IInterface**)&newRoute);
iter = Find(cprRemoved.Begin(), cprRemoved.End(), newRoute);
if (iter == cprRemoved.End()) {
cprResult->AddAdded(newRoute);
}
else {
cprRemoved.Erase(iter);
}
}
}
for (iter = cprRemoved.Begin(); iter != cprRemoved.End(); ++iter) {
cprResult->AddRemoved(*iter);
}
*result = cprResult;
REFCOUNT_ADD(*result);
return NOERROR;
}