Commit cf79a31c authored by Erwan Tulou's avatar Erwan Tulou

skins2: transform getNextSibling into getNextSiblingOrUncle

parent 98c1ff6e
...@@ -111,21 +111,29 @@ VarTree::ConstIterator VarTree::operator[]( int n ) const ...@@ -111,21 +111,29 @@ VarTree::ConstIterator VarTree::operator[]( int n ) const
return it; return it;
} }
VarTree::Iterator VarTree::getNextSibling( VarTree::Iterator current ) VarTree::Iterator VarTree::getNextSiblingOrUncle()
{ {
VarTree *p_parent = current->parent(); VarTree *p_parent = parent();
if( p_parent && current != p_parent->end() ) if( p_parent )
{ {
Iterator it = current->parent()->begin(); Iterator it = p_parent->begin();
while( it != p_parent->end() && it != current ) it++; while( it != p_parent->end() && &(*it) != this ) ++it;
if( it != p_parent->end() ) if( it != p_parent->end() )
{ {
it++; Iterator current = it;
return it; ++it;
if( it != p_parent->end() )
return it;
else
return current->next_uncle();
}
else
{
msg_Err( getIntf(), "should never occur" );
return end();
} }
return root()->end();
} }
return root()->end(); return end();
} }
/* find iterator to next ancestor /* find iterator to next ancestor
......
...@@ -105,7 +105,7 @@ public: ...@@ -105,7 +105,7 @@ public:
VarTree *parent() { return m_pParent; } VarTree *parent() { return m_pParent; }
/// Get next sibling /// Get next sibling
Iterator getNextSibling( Iterator ); Iterator getNextSiblingOrUncle();
Iterator next_uncle(); Iterator next_uncle();
Iterator prev_uncle(); Iterator prev_uncle();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment