本文整理汇总了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], \
¬ExistCollectable \
} ;
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