* 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:
@@ -74,7 +74,7 @@ private:
|
|||||||
NO_MEMORY = -1,
|
NO_MEMORY = -1,
|
||||||
OK = 0,
|
OK = 0,
|
||||||
HEIGHT_CHANGED = 1,
|
HEIGHT_CHANGED = 1,
|
||||||
|
|
||||||
LEFT = -1,
|
LEFT = -1,
|
||||||
BALANCED = 0,
|
BALANCED = 0,
|
||||||
RIGHT = 1,
|
RIGHT = 1,
|
||||||
@@ -288,7 +288,7 @@ protected:
|
|||||||
// strategy shortcuts
|
// strategy shortcuts
|
||||||
inline Node* _Allocate(const Key& key, const Value& value);
|
inline Node* _Allocate(const Key& key, const Value& value);
|
||||||
inline void _Free(Node* node);
|
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 Value& _GetValue(Node* node) const;
|
||||||
inline AVLTreeNode* _GetAVLTreeNode(const Node* node) const;
|
inline AVLTreeNode* _GetAVLTreeNode(const Node* node) const;
|
||||||
inline Node* _GetNode(const AVLTreeNode* node) const;
|
inline Node* _GetNode(const AVLTreeNode* node) const;
|
||||||
@@ -311,12 +311,12 @@ public:
|
|||||||
: ConstIterator()
|
: ConstIterator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Iterator(const Iterator& other)
|
inline Iterator(const Iterator& other)
|
||||||
: ConstIterator(other)
|
: ConstIterator(other)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Remove()
|
inline void Remove()
|
||||||
{
|
{
|
||||||
if (AVLTreeNode* node = ConstIterator::fTreeIterator.Remove()) {
|
if (AVLTreeNode* node = ConstIterator::fTreeIterator.Remove()) {
|
||||||
@@ -326,14 +326,14 @@ public:
|
|||||||
parent->_Free(parent->_GetNode(node));
|
parent->_Free(parent->_GetNode(node));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline Iterator(_AVL_TREE_MAP_CLASS_NAME* parent,
|
inline Iterator(_AVL_TREE_MAP_CLASS_NAME* parent,
|
||||||
const AVLTreeIterator& treeIterator)
|
const AVLTreeIterator& treeIterator)
|
||||||
: ConstIterator(parent, treeIterator)
|
: ConstIterator(parent, treeIterator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
friend class _AVL_TREE_MAP_CLASS_NAME;
|
friend class _AVL_TREE_MAP_CLASS_NAME;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -393,6 +393,13 @@ public:
|
|||||||
return Value();
|
return Value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Value* NextValuePointer()
|
||||||
|
{
|
||||||
|
if (AVLTreeNode* node = fTreeIterator.Next())
|
||||||
|
return &fParent->_GetValue(fParent->_GetNode(node));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
inline Value Previous()
|
inline Value Previous()
|
||||||
{
|
{
|
||||||
if (AVLTreeNode* node = fTreeIterator.Previous())
|
if (AVLTreeNode* node = fTreeIterator.Previous())
|
||||||
@@ -597,7 +604,7 @@ _AVL_TREE_MAP_CLASS_NAME::_Free(Node* node)
|
|||||||
|
|
||||||
// _GetKey
|
// _GetKey
|
||||||
_AVL_TREE_MAP_TEMPLATE_LIST
|
_AVL_TREE_MAP_TEMPLATE_LIST
|
||||||
inline Key&
|
inline const Key&
|
||||||
_AVL_TREE_MAP_CLASS_NAME::_GetKey(Node* node) const
|
_AVL_TREE_MAP_CLASS_NAME::_GetKey(Node* node) const
|
||||||
{
|
{
|
||||||
return fStrategy.GetKey(node);
|
return fStrategy.GetKey(node);
|
||||||
|
|||||||
Reference in New Issue
Block a user