本文整理汇总了C++中CNode::getObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CNode::getObject方法的具体用法?C++ CNode::getObject怎么用?C++ CNode::getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNode
的用法示例。
在下文中一共展示了CNode::getObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addNode
bool CDoubleLinkedList::addNode( CNodeObject * pObject )
{
int nsearchResult = 0;
CNode * pNode = m_pHead;
if ( m_nSort == SORT_NONE ) {
// No sorting just add as last element
addNodeTail( pObject );
return true;
}
if ( ( m_nSort == SORT_STRING ) && ( NULL == pObject->m_pstrSortKey ) ) {
return false;
}
if ( ( m_nSort == SORT_NUMERIC ) && ( NULL == pObject->m_pKey ) ) {
return false;
}
if ( NULL != pNode ) {
while (pNode != NULL ) {
if ( ( m_nSort == SORT_STRING ) && ( NULL != pObject->m_pstrSortKey ) ) {
nsearchResult = strcmp( pNode->getObject()->m_pstrSortKey,
pObject->m_pstrSortKey );
}
else if ( ( m_nSort == SORT_NUMERIC ) ) {
if ( *pObject->m_pKey == *pNode->getObject()->m_pKey ) {
nsearchResult = 0;
}
else if ( *pObject->m_pKey > *pNode->getObject()->m_pKey ) {
nsearchResult = 2;
}
else {
nsearchResult = -1;
}
}
if ( 0 == nsearchResult ) {
// Entry already in table - Not allowed
return false;
}
else if ( nsearchResult > 0 ) {
// Add before current item
addNodeBefore( pNode, pObject );
return true;
}
pNode = pNode->getNextNode();
}
}
else {
// Add to tail - last id
addNodeTail( pObject );
}
return true;
}
示例2: while
CNode * CDoubleLinkedList::findNode( char * strID )
{
CNode * pRV = NULL;
CNode * pNode = m_pHead;
while (pNode != NULL ) {
if ( 0 == strcmp( strID, pNode->getObject()->m_pstrSortKey ) ) {
pRV = pNode;
break;
}
pNode = pNode->getNextNode();
}
return pRV;
}