mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 19:41:49 +00:00
Added some new code that isn't being used
This commit is contained in:
parent
ce3168b8a9
commit
ff3811524a
@ -247,6 +247,31 @@ nsDST::Clear()
|
||||
mRoot = 0;
|
||||
}
|
||||
|
||||
// Enumerate all the nodes in the tree
|
||||
void
|
||||
nsDST::Enumerate(nsDSTNodeFunctor& aFunctor) const
|
||||
{
|
||||
EnumTree(mRoot, aFunctor);
|
||||
}
|
||||
|
||||
void
|
||||
nsDST::EnumTree(LeafNode* aNode, nsDSTNodeFunctor& aFunctor) const
|
||||
{
|
||||
keepLooping:
|
||||
if (!aNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Call the function-like object
|
||||
aFunctor(aNode->Key(), aNode->mValue);
|
||||
|
||||
if (!aNode->IsLeaf()) {
|
||||
EnumTree(((TwoNode*)aNode)->mLeft, aFunctor);
|
||||
aNode = ((TwoNode*)aNode)->mRight;
|
||||
goto keepLooping;
|
||||
}
|
||||
}
|
||||
|
||||
// Called by Remove() to destroy a node. Explicitly calls the destructor
|
||||
// and then asks the memory arena to free the memory
|
||||
inline void
|
||||
|
@ -26,6 +26,14 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function-like object used when enumerating the nodes of the DST
|
||||
*/
|
||||
class nsDSTNodeFunctor {
|
||||
public:
|
||||
virtual void operator() (void* aKey, void* aValue) = 0; // call operator
|
||||
};
|
||||
|
||||
/**
|
||||
* Digital search tree for doing a radix-search of pointer-based keys
|
||||
*/
|
||||
@ -42,8 +50,9 @@ public:
|
||||
|
||||
void* Search(void* aKey) const;
|
||||
void* Insert(void* aKey, void* aValue); // returns the previous value (or 0)
|
||||
void* Remove(void* aKey);
|
||||
void* Remove(void* aKey); // returns the current value (or 0)
|
||||
void Clear();
|
||||
void Enumerate(nsDSTNodeFunctor& aFunctor) const;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
void Dump(FILE*) const;
|
||||
@ -83,6 +92,7 @@ private:
|
||||
void DestroyNode(TwoNode* aTwoNode);
|
||||
LeafNode* ConvertToLeafNode(TwoNode** aTwoNode);
|
||||
TwoNode* ConvertToTwoNode(LeafNode** aLeafNode);
|
||||
void EnumTree(LeafNode* aNode, nsDSTNodeFunctor& aFunctor) const;
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
// Diagnostic functions
|
||||
|
Loading…
x
Reference in New Issue
Block a user