* Added Iterator::NextValuePointer().

* Made reference returned by _GetKey() const. That's sufficient.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33898 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-11-05 17:18:12 +00:00
parent 239222b236
commit 8d24cfc6c2
1 changed files with 14 additions and 7 deletions

View File

@ -74,7 +74,7 @@ private:
NO_MEMORY = -1,
OK = 0,
HEIGHT_CHANGED = 1,
LEFT = -1,
BALANCED = 0,
RIGHT = 1,
@ -288,7 +288,7 @@ protected:
// 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 @@ public:
: ConstIterator()
{
}
inline Iterator(const Iterator& other)
: ConstIterator(other)
{
}
inline void Remove()
{
if (AVLTreeNode* node = ConstIterator::fTreeIterator.Remove()) {
@ -326,14 +326,14 @@ public:
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 @@ public:
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 @@ _AVL_TREE_MAP_CLASS_NAME::_Free(Node* node)
// _GetKey
_AVL_TREE_MAP_TEMPLATE_LIST
inline Key&
inline const Key&
_AVL_TREE_MAP_CLASS_NAME::_GetKey(Node* node) const
{
return fStrategy.GetKey(node);