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


C++ UtlDList::removeReference方法代码示例

本文整理汇总了C++中UtlDList::removeReference方法的典型用法代码示例。如果您正苦于以下问题:C++ UtlDList::removeReference方法的具体用法?C++ UtlDList::removeReference怎么用?C++ UtlDList::removeReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UtlDList的用法示例。


在下文中一共展示了UtlDList::removeReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: utlTestRemove

    void utlTestRemove(RemoveType type)
    {

        int testCount = 5 ; 
        const char* prefix = "";
        if (type == TEST_REMOVE)
        {
            prefix = "test the remove(UtlContainable* c) method where c" ;

        }
        else if (type == TEST_REMOVE_REF)
        {
            prefix = "test the removeReference(UtlContainable* c) where c" ;
        }
        const char* Msgs[] = { \
               "is the first entry's reference ", \
               "is the last entry' reference ", \
               "is the mid entry's value(not reference) ", \
               "is the first of multiple matches and is the value match ", \
               "has no match at all " \
        } ;
        const char* suffix1 = " :- Verify returned value" ; 
        const char* suffix2 = " :- Verify total entries" ; 

        commonList.insertAt(2, commonContainables_Clone[4]) ; 

        UtlString notExistCollectable("This cannot and willnot exist");
    
        UtlContainable* itemToRemove[] = { \
                           commonContainables[0], commonContainables[commonEntriesCount -1 ], \
                           commonContainables_Clone[2], commonContainables[4], \
                           &notExistCollectable \
        } ; 
        
        int totalEnt = commonEntriesCount + 1; 

        UtlContainable* expectedValue[] = { \
                           commonContainables[0], commonContainables[commonEntriesCount -1 ], \
                           commonContainables[2], commonContainables_Clone[4], \
                           NULL \
        }; 
        
 
        int entriesValue[] = { --totalEnt, --totalEnt, --totalEnt, --totalEnt, totalEnt } ; 

        totalEnt = commonEntriesCount + 1;

        UtlContainable* expectedRef[] = { \
                           commonContainables[0], commonContainables[commonEntriesCount -1 ], \
                           NULL, commonContainables[4], \
                           NULL \
        };
        int entriesRef[] = { --totalEnt, --totalEnt, totalEnt, --totalEnt, totalEnt } ;
        
        for (int i = 0 ; i < testCount ; i++)
        {
            
            string msg ; 
            if (type == TEST_REMOVE)
            {
                TestUtilities::createMessage(3, &msg, prefix, Msgs[i], suffix1) ;
                
                UtlContainable* retValue = commonList.remove(itemToRemove[i]) ;
                CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(),  expectedValue[i], retValue) ; 
                TestUtilities::createMessage(3, &msg, prefix, Msgs[i], suffix2) ; 
                CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), entriesValue[i], (int)commonList.entries()) ; 
            }
            else if (type == TEST_REMOVE_REF)
            {
 
                UtlContainable* uRemoved = commonList.removeReference(itemToRemove[i]) ; 
                TestUtilities::createMessage(3, &msg, prefix, Msgs[i],  suffix2) ; 
                CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), expectedRef[i], uRemoved) ; 
                TestUtilities::createMessage(3, &msg, prefix, Msgs[i], suffix2) ;
                CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), entriesRef[i], (int)commonList.entries()) ;
            }
        }
    } //utlRemove
开发者ID:Jaroslav23,项目名称:sipxtapi,代码行数:78,代码来源:UtlDList.cpp


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