[haiku-commits] r33898 - haiku/trunk/headers/private/kernel/util

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 5 Nov 2009 18:18:13 +0100 (CET)

Author: bonefish
Date: 2009-11-05 18:18:12 +0100 (Thu, 05 Nov 2009)
New Revision: 33898
Changeset: http://dev.haiku-os.org/changeset/33898/haiku

Modified:
   haiku/trunk/headers/private/kernel/util/AVLTreeMap.h
Log:
* Added Iterator::NextValuePointer().
* Made reference returned by _GetKey() const. That's sufficient.


Modified: haiku/trunk/headers/private/kernel/util/AVLTreeMap.h
===================================================================
--- haiku/trunk/headers/private/kernel/util/AVLTreeMap.h        2009-11-05 
17:16:17 UTC (rev 33897)
+++ haiku/trunk/headers/private/kernel/util/AVLTreeMap.h        2009-11-05 
17:18:12 UTC (rev 33898)
@@ -74,7 +74,7 @@
                                NO_MEMORY               = -1,
                                OK                              = 0,
                                HEIGHT_CHANGED  = 1,
-       
+
                                LEFT                    = -1,
                                BALANCED                = 0,
                                RIGHT                   = 1,
@@ -288,7 +288,7 @@
        // strategy shortcuts
        inline  Node*                           _Allocate(const Key& key, const 
Value& value);
        inline  void                            _Free(Node* node);
-       inline  Key&                            _GetKey(Node* node) const;
+       inline  const Key&                      _GetKey(Node* node) const;
        inline  Value&                          _GetValue(Node* node) const;
        inline  AVLTreeNode*            _GetAVLTreeNode(const Node* node) const;
        inline  Node*                           _GetNode(const AVLTreeNode* 
node) const;
@@ -311,12 +311,12 @@
                        : ConstIterator()
                {
                }
-       
+
                inline Iterator(const Iterator& other)
                        : ConstIterator(other)
                {
                }
-       
+
                inline void Remove()
                {
                        if (AVLTreeNode* node = 
ConstIterator::fTreeIterator.Remove()) {
@@ -326,14 +326,14 @@
                                parent->_Free(parent->_GetNode(node));
                        }
                }
-       
+
        private:
                inline Iterator(_AVL_TREE_MAP_CLASS_NAME* parent,
                        const AVLTreeIterator& treeIterator)
                        : ConstIterator(parent, treeIterator)
                {
                }
-       
+
                friend class _AVL_TREE_MAP_CLASS_NAME;
        };
 };
@@ -393,6 +393,13 @@
                return Value();
        }
 
+       inline Value* NextValuePointer()
+       {
+               if (AVLTreeNode* node = fTreeIterator.Next())
+                       return &fParent->_GetValue(fParent->_GetNode(node));
+               return NULL;
+       }
+
        inline Value Previous()
        {
                if (AVLTreeNode* node = fTreeIterator.Previous())
@@ -597,7 +604,7 @@
 
 // _GetKey
 _AVL_TREE_MAP_TEMPLATE_LIST
-inline Key&
+inline const Key&
 _AVL_TREE_MAP_CLASS_NAME::_GetKey(Node* node) const
 {
        return fStrategy.GetKey(node);


Other related posts:

  • » [haiku-commits] r33898 - haiku/trunk/headers/private/kernel/util - ingo_weinhold