Commit 3b3251c4 authored by Erwan Tulou's avatar Erwan Tulou

skins2: prefer ++it over it++ for iterators

parent 8c18c69a
...@@ -76,12 +76,12 @@ void VarTree::delSelected() ...@@ -76,12 +76,12 @@ void VarTree::delSelected()
if( it->m_selected ) if( it->m_selected )
{ {
Iterator oldIt = it; Iterator oldIt = it;
it++; ++it;
m_children.erase( oldIt ); m_children.erase( oldIt );
} }
else else
{ {
it++; ++it;
} }
} }
} }
...@@ -97,7 +97,7 @@ VarTree::Iterator VarTree::operator[]( int n ) ...@@ -97,7 +97,7 @@ VarTree::Iterator VarTree::operator[]( int n )
int i; int i;
for( it = begin(), i = 0; for( it = begin(), i = 0;
i < n && it != end(); i < n && it != end();
it++, i++ ); ++it, i++ );
return it; return it;
} }
...@@ -107,7 +107,7 @@ VarTree::ConstIterator VarTree::operator[]( int n ) const ...@@ -107,7 +107,7 @@ VarTree::ConstIterator VarTree::operator[]( int n ) const
int i; int i;
for( it = begin(), i = 0; for( it = begin(), i = 0;
i < n && it != end(); i < n && it != end();
it++, i++ ); ++it, i++ );
return it; return it;
} }
...@@ -147,10 +147,10 @@ VarTree::Iterator VarTree::next_uncle() ...@@ -147,10 +147,10 @@ VarTree::Iterator VarTree::next_uncle()
while( p_grandparent != NULL ) while( p_grandparent != NULL )
{ {
Iterator it = p_grandparent->begin(); Iterator it = p_grandparent->begin();
while( it != p_grandparent->end() && &(*it) != p_parent ) it++; while( it != p_grandparent->end() && &(*it) != p_parent ) ++it;
if( it != p_grandparent->end() ) if( it != p_grandparent->end() )
{ {
it++; ++it;
if( it != p_grandparent->end() ) if( it != p_grandparent->end() )
{ {
return it; return it;
...@@ -179,10 +179,10 @@ VarTree::Iterator VarTree::prev_uncle() ...@@ -179,10 +179,10 @@ VarTree::Iterator VarTree::prev_uncle()
while( p_grandparent != NULL ) while( p_grandparent != NULL )
{ {
Iterator it = p_grandparent->end(); Iterator it = p_grandparent->end();
while( it != p_grandparent->begin() && &(*it) != p_parent ) it--; while( it != p_grandparent->begin() && &(*it) != p_parent ) --it;
if( it != p_grandparent->begin() ) if( it != p_grandparent->begin() )
{ {
it--; --it;
if( it != p_grandparent->begin() ) if( it != p_grandparent->begin() )
{ {
return it; return it;
...@@ -212,7 +212,7 @@ int VarTree::visibleItems() ...@@ -212,7 +212,7 @@ int VarTree::visibleItems()
{ {
i_count += it->visibleItems(); i_count += it->visibleItems();
} }
it++; ++it;
} }
return i_count; return i_count;
} }
...@@ -232,7 +232,7 @@ VarTree::Iterator VarTree::getVisibleItem( int n ) ...@@ -232,7 +232,7 @@ VarTree::Iterator VarTree::getVisibleItem( int n )
if( i <= 0 ) return it->getVisibleItem( n ); if( i <= 0 ) return it->getVisibleItem( n );
n = i; n = i;
} }
it++; ++it;
} }
return end(); return end();
} }
...@@ -255,7 +255,7 @@ VarTree::Iterator VarTree::getLeaf( int n ) ...@@ -255,7 +255,7 @@ VarTree::Iterator VarTree::getLeaf( int n )
if( n <= 0 ) if( n <= 0 )
return it; return it;
} }
it++; ++it;
} }
return end(); return end();
} }
...@@ -269,7 +269,7 @@ VarTree::Iterator VarTree::getNextVisibleItem( Iterator it ) ...@@ -269,7 +269,7 @@ VarTree::Iterator VarTree::getNextVisibleItem( Iterator it )
else else
{ {
VarTree::Iterator it_old = it; VarTree::Iterator it_old = it;
it++; ++it;
// Was 'it' the last brother? If so, look for uncles // Was 'it' the last brother? If so, look for uncles
if( it_old->parent() && it_old->parent()->end() == it ) if( it_old->parent() && it_old->parent()->end() == it )
{ {
...@@ -291,13 +291,13 @@ VarTree::Iterator VarTree::getPrevVisibleItem( Iterator it ) ...@@ -291,13 +291,13 @@ VarTree::Iterator VarTree::getPrevVisibleItem( Iterator it )
it = it_old->prev_uncle(); it = it_old->prev_uncle();
} }
else else
it--; --it;
/* We have found an expanded uncle, take its last child */ /* We have found an expanded uncle, take its last child */
while( it != root()->begin() && it->size() && it->m_expanded ) while( it != root()->begin() && it->size() && it->m_expanded )
{ {
it = it->end(); it = it->end();
it--; --it;
} }
return it; return it;
} }
...@@ -311,7 +311,7 @@ VarTree::Iterator VarTree::getNextItem( Iterator it ) ...@@ -311,7 +311,7 @@ VarTree::Iterator VarTree::getNextItem( Iterator it )
else else
{ {
VarTree::Iterator it_old = it; VarTree::Iterator it_old = it;
it++; ++it;
// Was 'it' the last brother? If so, look for uncles // Was 'it' the last brother? If so, look for uncles
if( it_old->parent() && it_old->parent()->end() == it ) if( it_old->parent() && it_old->parent()->end() == it )
{ {
...@@ -333,13 +333,13 @@ VarTree::Iterator VarTree::getPrevItem( Iterator it ) ...@@ -333,13 +333,13 @@ VarTree::Iterator VarTree::getPrevItem( Iterator it )
it = it_old->prev_uncle(); it = it_old->prev_uncle();
} }
else else
it--; --it;
/* We have found an expanded uncle, take its last child */ /* We have found an expanded uncle, take its last child */
while( it != root()->begin() && it->size() ) while( it != root()->begin() && it->size() )
{ {
it = it->end(); it = it->end();
it--; --it;
} }
return it; return it;
} }
...@@ -401,7 +401,7 @@ int VarTree::countLeafs() ...@@ -401,7 +401,7 @@ int VarTree::countLeafs()
while( it != end() ) while( it != end() )
{ {
i_count += it->countLeafs(); i_count += it->countLeafs();
it++; ++it;
} }
return i_count; return i_count;
} }
......
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