WvStreams
|
A plain UniConfTree that holds keys and values. More...
#include <uniconftree.h>
Public Types | |
typedef wv::function< void(const UniConfValueTree *, void *) | Visitor ) |
typedef wv::function< bool(const UniConfValueTree *, const UniConfValueTree *) | Comparator ) |
Public Member Functions | |
UniConfValueTree (UniConfValueTree *parent, const UniConfKey &key, WvStringParm value) | |
const WvString & | value () const |
Returns the value field. | |
void | setvalue (WvStringParm value) |
Sets the value field. | |
UniConfValueTree * | parent () const |
Returns a pointer to the parent node, or NULL if there is none. | |
void | setparent (UniConfValueTree *parent) |
Reparents this node. | |
UniConfValueTree * | root () const |
Returns a pointer to the root node of the tree. | |
UniConfKey | fullkey (const UniConfValueTree *ancestor=NULL) const |
Returns full path of this node relative to an ancestor. | |
UniConfValueTree * | find (const UniConfKey &key) const |
Finds the sub-node with the specified key. | |
UniConfValueTree * | findchild (const UniConfKey &key) const |
Finds the direct child node with the specified key. | |
void | remove (const UniConfKey &key) |
Removes the node for the specified key from the tree and deletes it along with any of its children. | |
void | zap () |
Removes and deletes all children of this node. | |
void | visit (const Visitor &visitor, void *userdata, bool preorder=true, bool postorder=false) const |
Performs a traversal on this tree using the specified visitor function and traversal type(s). | |
bool | compare (const UniConfValueTree *other, const Comparator &comparator) |
Compares this tree with another using the specified comparator function. | |
const UniConfKey & | key () const |
Returns the key field. | |
bool | haschildren () const |
Returns true if the node has children. | |
Protected Types | |
typedef WvScatterHash < UniHashTreeBase, UniConfKey, Accessor > | Container |
typedef UniHashTreeBaseVisitor | BaseVisitor |
typedef UniHashTreeBaseComparator | BaseComparator |
Protected Member Functions | |
UniConfKey | _fullkey (const UniHashTreeBase *ancestor=NULL) const |
UniHashTreeBase * | _find (const UniConfKey &key) const |
UniHashTreeBase * | _findchild (const UniConfKey &key) const |
Static Protected Member Functions | |
static bool | _recursivecompare (const UniHashTreeBase *a, const UniHashTreeBase *b, const UniHashTreeBaseComparator &comparator) |
static void | _recursive_unsorted_visit (const UniHashTreeBase *a, const UniHashTreeBaseVisitor &visitor, void *userdata, bool preorder, bool postorder) |
Protected Attributes | |
UniHashTreeBase * | xparent |
Container * | xchildren |
Friends | |
class | Iter |
A plain UniConfTree that holds keys and values.
Definition at line 152 of file uniconftree.h.
const WvString& UniConfValueTree::value | ( | ) | const [inline] |
Returns the value field.
Definition at line 163 of file uniconftree.h.
Referenced by UniTransactionGen::apply_values(), UniTransactionGen::cancel_values(), UniTempGen::get(), UniFastRegetGen::get(), UniTransactionGen::get(), UniFastRegetGen::haschildren(), UniTempGen::set(), and setvalue().
void UniConfValueTree::setvalue | ( | WvStringParm | value | ) | [inline] |
Sets the value field.
Definition at line 167 of file uniconftree.h.
References value().
Referenced by UniFastRegetGen::gencallback(), and UniTempGen::set().
UniConfValueTree * UniConfTree< UniConfValueTree >::parent | ( | ) | const [inline, inherited] |
Returns a pointer to the parent node, or NULL if there is none.
Definition at line 40 of file uniconftree.h.
void UniConfTree< UniConfValueTree >::setparent | ( | UniConfValueTree * | parent | ) | [inline, inherited] |
Reparents this node.
Definition at line 44 of file uniconftree.h.
UniConfValueTree * UniConfTree< UniConfValueTree >::root | ( | ) | const [inline, inherited] |
Returns a pointer to the root node of the tree.
Definition at line 48 of file uniconftree.h.
UniConfKey UniConfTree< UniConfValueTree >::fullkey | ( | const UniConfValueTree * | ancestor = NULL | ) | const [inline, inherited] |
Returns full path of this node relative to an ancestor.
If ancestor is NULL, returns the root.
Definition at line 55 of file uniconftree.h.
UniConfValueTree * UniConfTree< UniConfValueTree >::find | ( | const UniConfKey & | key | ) | const [inline, inherited] |
Finds the sub-node with the specified key.
If key.isempty(), returns this node.
Definition at line 62 of file uniconftree.h.
UniConfValueTree * UniConfTree< UniConfValueTree >::findchild | ( | const UniConfKey & | key | ) | const [inline, inherited] |
Finds the direct child node with the specified key.
If key.numsegments() == 1, then performs the same task as find(key), but a little faster. Otherwise returns NULL.
Definition at line 71 of file uniconftree.h.
void UniConfTree< UniConfValueTree >::remove | ( | const UniConfKey & | key | ) | [inline, inherited] |
Removes the node for the specified key from the tree and deletes it along with any of its children.
If the key is UniConfKey::EMPTY, deletes this object.
Definition at line 80 of file uniconftree.h.
void UniConfTree< UniConfValueTree >::zap | ( | ) | [inline, inherited] |
Removes and deletes all children of this node.
Definition at line 84 of file uniconftree.h.
void UniConfTree< UniConfValueTree >::visit | ( | const Visitor & | visitor, |
void * | userdata, | ||
bool | preorder = true , |
||
bool | postorder = false |
||
) | const [inline, inherited] |
Performs a traversal on this tree using the specified visitor function and traversal type(s).
"visitor" is the tree visitor function "userdata" is userdata for the tree visitor function
Definition at line 108 of file uniconftree.h.
bool UniConfTree< UniConfValueTree >::compare | ( | const UniConfValueTree * | other, |
const Comparator & | comparator | ||
) | [inline, inherited] |
Compares this tree with another using the specified comparator function.
Comparison of a subtree ends when the comparator returns false. "comparator" is the value compare function "userdata" is userdata for the compare function Returns: true if the comparison function returned true each time
Definition at line 124 of file uniconftree.h.
const UniConfKey& UniHashTreeBase::key | ( | ) | const [inline, inherited] |
Returns the key field.
Definition at line 40 of file unihashtree.h.
Referenced by UniConfTree< UniConfChangeTree >::remove(), and UniTransactionGen::setv().
bool UniHashTreeBase::haschildren | ( | ) | const [inherited] |
Returns true if the node has children.
Definition at line 114 of file unihashtree.cc.
References UniHashTreeBase::xchildren.
Referenced by UniTempGen::haschildren(), and UniWatchInfoTree::isessential().
UniHashTreeBase* UniHashTreeBase::xparent [protected, inherited] |
the parent of this subtree
Definition at line 62 of file unihashtree.h.
Referenced by UniConfTree< UniConfChangeTree >::parent().
Container* UniHashTreeBase::xchildren [protected, inherited] |
the hash table of children
Definition at line 63 of file unihashtree.h.
Referenced by UniHashTreeBase::haschildren(), and UniConfTree< UniConfChangeTree >::zap().