本文整理汇总了C++中CNode::SetPrev方法的典型用法代码示例。如果您正苦于以下问题:C++ CNode::SetPrev方法的具体用法?C++ CNode::SetPrev怎么用?C++ CNode::SetPrev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNode
的用法示例。
在下文中一共展示了CNode::SetPrev方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveOrCopyChildren
void CParentNode::RemoveOrCopyChildren( QVector<CNode*> &children, long nFrom, long nTo, int fRemove )
{
if( nTo == -1 ) nTo = (long) m_children.size();
Q_ASSERT( nTo <= (long) m_children.size() );
Q_ASSERT( nTo >= nFrom );
children.resize( nTo - nFrom );
if( children.size() )
{
for( long i = 0; i < (long) children.size(); i++ )
{
children[ i ] = (fRemove ? m_children[ nFrom + i ] : CreateCopy( m_children[ nFrom + i ] ) );
children[ i ]->SetParent( NULL );
}
children[ 0 ]->SetPrev( NULL );
children[ children.size() - 1 ]->SetNext( NULL );
if( fRemove )
{
m_children.remove( nFrom, nTo - nFrom );
CNode *pPrev = (nFrom - 1 > -1 && nFrom - 1 < (long) m_children.size()) ? m_children[ nFrom - 1 ] : NULL;
CNode *pNext = (nFrom > -1 && nFrom < (long) m_children.size()) ? m_children[ nFrom ] : NULL;
if( pPrev ) pPrev->SetNext( pNext );
if( pNext ) pNext->SetPrev( pPrev );
}
}
}
示例2: RemoveChild
CNode* CParentNode::RemoveChild( long no )
{
CNode *pNode = GetChild( no );
if( pNode )
{
if( pNode->GetPrev() )
pNode->GetPrev()->SetNext( pNode->GetNext() );
if( pNode->GetNext() )
pNode->GetNext()->SetPrev( pNode->GetPrev() );
pNode->SetNext( NULL );
pNode->SetPrev( NULL );
pNode->SetParent( NULL );
m_children.remove( no );
}
return pNode;
}
示例3: InsertChildren
void CParentNode::InsertChildren( QVector<CNode*> &children, long nBefore )
{
if( children.size() )
{
if( nBefore == -1 ) nBefore = (long) m_children.size();
if( m_children.size() )
{
CNode *pPrev = (nBefore - 1 > -1 && nBefore - 1 < (long) m_children.size() ? m_children[ nBefore - 1 ] : NULL);
CNode *pNext = (nBefore > -1 && nBefore < (long) m_children.size() ? m_children[ nBefore ]: NULL);
if( pNext ) pNext->SetPrev( children[ children.size() - 1 ] );
if( pPrev ) pPrev->SetNext( children[ 0 ] );
children[ children.size() - 1 ]->SetNext( pNext );
children[ 0 ]->SetPrev( pPrev );
}
for( long i = 0; i < children.size(); i++ )
{
children[ i ]->SetParent( this );
children[ i ]->SetLevel( GetLevel() );
m_children.insert( nBefore + i, children[ i ] );
}
children.clear();
}
}