当前位置: 首页>>代码示例>>C++>>正文


C++ AutoPtr::AddAdded方法代码示例

本文整理汇总了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;
}
开发者ID:imace,项目名称:ElastosRDK5_0,代码行数:57,代码来源:CLinkProperties.cpp

示例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;
}
开发者ID:imace,项目名称:ElastosRDK5_0,代码行数:47,代码来源:CLinkProperties.cpp


注:本文中的AutoPtr::AddAdded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。