[vlc-commits] skins2(playlist): cosmetics + avoid objects passed as value if not needed

Erwan Tulou git at videolan.org
Wed Jan 19 15:28:43 CET 2011


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Jan 19 14:44:09 2011 +0100| [36f8268351dfe0ea51d8b0ac9182d423bf48df51] | committer: Erwan Tulou

skins2(playlist): cosmetics + avoid objects passed as value if not needed

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

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

diff --git a/modules/gui/skins2/utils/var_tree.cpp b/modules/gui/skins2/utils/var_tree.cpp
index dc51af2..2d867af 100644
--- a/modules/gui/skins2/utils/var_tree.cpp
+++ b/modules/gui/skins2/utils/var_tree.cpp
@@ -39,8 +39,7 @@ VarTree::VarTree( intf_thread_t *pIntf )
 
 VarTree::VarTree( intf_thread_t *pIntf, VarTree *pParent, int id,
                   const UStringPtr &rcString, bool selected, bool playing,
-                  bool expanded, bool readonly,
-                  void *pData )
+                  bool expanded, bool readonly, void *pData )
     : Variable( pIntf ), m_id( id ), m_cString( rcString ),
     m_selected( selected ), m_playing( playing ), m_expanded( expanded ),
     m_deleted( false ), m_pData( pData ), m_pParent( pParent ),
@@ -57,8 +56,7 @@ VarTree::~VarTree()
 }
 
 void VarTree::add( int id, const UStringPtr &rcString, bool selected,
-                   bool playing, bool expanded, bool readonly,
-                   void *pData )
+                   bool playing, bool expanded, bool readonly, void *pData )
 {
     m_children.push_back( VarTree( getIntf(), this, id, rcString, selected,
                                    playing, expanded, readonly,
@@ -268,7 +266,7 @@ VarTree::Iterator VarTree::getNextVisibleItem( Iterator it )
     }
     else
     {
-        VarTree::Iterator it_old = it;
+        Iterator it_old = it;
         ++it;
         // Was 'it' the last brother? If so, look for uncles
         if( it_old->parent() && it_old->parent()->end() == it )
@@ -281,7 +279,7 @@ VarTree::Iterator VarTree::getNextVisibleItem( Iterator it )
 
 VarTree::Iterator VarTree::getPrevVisibleItem( Iterator it )
 {
-    VarTree::Iterator it_old = it;
+    Iterator it_old = it;
     if( it == root()->begin() || it == ++(root()->begin()) ) return it;
 
     /* Was it the first child of its parent ? */
@@ -310,7 +308,7 @@ VarTree::Iterator VarTree::getNextItem( Iterator it )
     }
     else
     {
-        VarTree::Iterator it_old = it;
+        Iterator it_old = it;
         ++it;
         // Was 'it' the last brother? If so, look for uncles
         if( it_old->parent() && it_old->parent()->end() == it )
@@ -323,7 +321,7 @@ VarTree::Iterator VarTree::getNextItem( Iterator it )
 
 VarTree::Iterator VarTree::getPrevItem( Iterator it )
 {
-    VarTree::Iterator it_old = it;
+    Iterator it_old = it;
     if( it == root()->begin() || it == ++(root()->begin()) ) return it;
 
     /* Was it the first child of its parent ? */
@@ -380,7 +378,7 @@ VarTree::Iterator VarTree::findById( int id )
 }
 
 
-void VarTree::ensureExpanded( VarTree::Iterator it )
+void VarTree::ensureExpanded( const Iterator& it )
 {
     /// Don't expand ourselves, only our parents
     VarTree *current = &(*it);
@@ -422,7 +420,7 @@ void VarTree::cascadeDelete()
     }
 }
 
-int VarTree::getRank( Iterator item, bool flat )
+int VarTree::getRank( const Iterator& item, bool flat )
 {
     int index = 1;
     Iterator it;
diff --git a/modules/gui/skins2/utils/var_tree.hpp b/modules/gui/skins2/utils/var_tree.hpp
index 88283af..0fadc1c 100644
--- a/modules/gui/skins2/utils/var_tree.hpp
+++ b/modules/gui/skins2/utils/var_tree.hpp
@@ -57,7 +57,7 @@ public:
 
     VarTree( intf_thread_t *pIntf, VarTree *pParent, int id,
              const UStringPtr &rcString, bool selected, bool playing,
-             bool expanded,bool readonly, void *pData );
+             bool expanded, bool readonly, void *pData );
 
     virtual ~VarTree();
 
@@ -66,8 +66,7 @@ public:
 
     /// Add a pointer on string in the children's list
     virtual void add( int id, const UStringPtr &rcString, bool selected,
-                      bool playing, bool expanded, bool readonly,
-                      void *pData );
+                      bool playing, bool expanded, bool readonly, void *pData );
 
     /// Remove the selected item from the children's list
     virtual void delSelected();
@@ -128,10 +127,8 @@ public:
     /// Get first leaf
     Iterator firstLeaf();
 
-    void removeChild( VarTree::Iterator item )
-    {
-        m_children.erase( item );
-    }
+    /// Remove a child
+    void removeChild( Iterator it ) { m_children.erase( it ); }
 
     /// Execute the action associated to this item
     virtual void action( VarTree *pItem ) { }
@@ -175,13 +172,13 @@ public:
     Iterator getPrevLeaf( Iterator it );
 
     /// return rank of visible item starting from 1
-    int getRank( Iterator it, bool flat );
+    int getRank( const Iterator& it, bool flat );
 
     /// Find a children node with the given id
     Iterator findById( int id );
 
     /// Ensure an item is expanded
-    void ensureExpanded( VarTree::Iterator );
+    void ensureExpanded( const Iterator& it );
 
     /// flag a whole subtree for deletion
     void cascadeDelete();



More information about the vlc-commits mailing list