[vlc-commits] commit: skins2: transform getNextSibling into getNextSiblingOrUncle ( Erwan Tulou )

git at videolan.org git at videolan.org
Tue Aug 10 18:57:07 CEST 2010


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Tue Aug 10 16:01:45 2010 +0200| [cf79a31cfbcca646a9d9a440d2ceba68c3945fe2] | committer: Erwan Tulou 

skins2: transform getNextSibling into getNextSiblingOrUncle

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cf79a31cfbcca646a9d9a440d2ceba68c3945fe2
---

 modules/gui/skins2/utils/var_tree.cpp |   26 +++++++++++++++++---------
 modules/gui/skins2/utils/var_tree.hpp |    2 +-
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/modules/gui/skins2/utils/var_tree.cpp b/modules/gui/skins2/utils/var_tree.cpp
index 66d1460..f861298 100644
--- a/modules/gui/skins2/utils/var_tree.cpp
+++ b/modules/gui/skins2/utils/var_tree.cpp
@@ -111,21 +111,29 @@ VarTree::ConstIterator VarTree::operator[]( int n ) const
     return it;
 }
 
-VarTree::Iterator VarTree::getNextSibling( VarTree::Iterator current )
+VarTree::Iterator VarTree::getNextSiblingOrUncle()
 {
-    VarTree *p_parent = current->parent();
-    if( p_parent  && current != p_parent->end() )
+    VarTree *p_parent = parent();
+    if( p_parent )
     {
-        Iterator it = current->parent()->begin();
-        while( it != p_parent->end() && it != current ) it++;
+        Iterator it = p_parent->begin();
+        while( it != p_parent->end() && &(*it) != this ) ++it;
         if( it != p_parent->end() )
         {
-            it++;
-            return it;
+            Iterator current = 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
diff --git a/modules/gui/skins2/utils/var_tree.hpp b/modules/gui/skins2/utils/var_tree.hpp
index 26709e3..eda94c0 100644
--- a/modules/gui/skins2/utils/var_tree.hpp
+++ b/modules/gui/skins2/utils/var_tree.hpp
@@ -105,7 +105,7 @@ public:
     VarTree *parent() { return m_pParent; }
 
     /// Get next sibling
-    Iterator getNextSibling( Iterator );
+    Iterator getNextSiblingOrUncle();
 
     Iterator next_uncle();
     Iterator prev_uncle();



More information about the vlc-commits mailing list