8 #include "uniconfroot.h" 9 #include "wvlinkerhack.h" 11 WV_LINK_TO(UniGenHack);
18 mounts.
add_callback(
this, wv::bind(&UniConfRoot::gen_callback,
this,
27 mounts.
mount(
"/", moniker, refresh);
28 mounts.
add_callback(
this, wv::bind(&UniConfRoot::gen_callback,
this,
38 mounts.
add_callback(
this, wv::bind(&UniConfRoot::gen_callback,
this,
49 for (i.rewind(); i.next(); )
57 if (!w->watches.isempty())
61 fprintf(stderr,
"Remaining watch: '%s' (%zd)\n",
81 assert(!watchout(&watchroot));
88 const UniConfCallback &callback,
bool recurse)
95 for (i.rewind(); i.next(); )
102 node->watches.append(w,
true);
112 UniWatchInfoList::Iter i(node->watches);
113 for (i.rewind(); i.next(); )
116 if (i->cookie == cookie && i->recurse == recurse)
145 UniWatchInfoList::Iter i(node->watches);
146 for (i.rewind(); i.next(); )
148 if (!i->recursive() && segleft > 0)
159 for (i.rewind(); i.next(); )
166 deletioncheck(w, subkey);
173 while (node != & watchroot && ! node->
isessential())
189 check(node, key, segs);
192 for (
int s = 0; s < segs; )
198 check(node, key, segs - s);
203 deletioncheck(node, key);
~UniConfRoot()
Destroys the UniConf tree along with all uncommitted data.
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
virtual IUniConfGen * mount(const UniConfKey &key, WvStringParm moniker, bool refresh)
Mounts a generator at a key using a moniker.
UniConfKey segment(int n) const
Returns the specified segment of the path.
UniConfKey last(int n=1) const
Returns the path formed by the n last segments of this path.
bool isnull() const
returns true if this string is null
bool isessential()
Returns true if the node should not be pruned.
const UniConfKey & key() const
Returns the key field.
void del_setbool(const UniConfKey &key, bool *flag, bool recurse=true)
Cancels notification requested using add_setbool().
const char * cstr() const
return a (const char *) for this string.
UniConfRoot()
Creates an empty UniConf tree with no mounted stores.
void add_callback(void *cookie, const UniConfKey &key, const UniConfCallback &callback, bool recurse=true)
Requests notification when any of the keys covered by the recursive depth specification change by inv...
bool refresh() const
Refreshes information about this key recursively.
Sub * findchild(const UniConfKey &key) const
Finds the direct child node with the specified key.
virtual void del_callback(void *cookie)
Removes a callback for change notification.
UniConfKey key() const
Returns the path of this node relative to its parent.
int numsegments() const
Returns the number of segments in this path.
virtual void add_callback(void *cookie, const UniConfGenCallback &callback)
Adds a callback for change notification.
static void setbool_callback(bool *flag, const UniConf &, const UniConfKey &)
Internal callback for setbool style notifications.
void hold_delta()
Pauses notifications until matched with a call to unhold_delta().
UniConf()
Creates a NULL UniConf handle, useful for reporting errors.
UniConf instances function as handles to subtrees of a UniConf tree and expose a high-level interface...
void unhold_delta()
Resumes notifications when each hold_delta() has been matched.
UniConfKey removelast(int n=1) const
Returns the path formed by removing the last n segments of this path.
virtual IUniConfGen * mountgen(const UniConfKey &key, IUniConfGen *gen, bool refresh)
Mounts a generator at a key.
Sub * parent() const
Returns a pointer to the parent node, or NULL if there is none.
void add_setbool(const UniConfKey &key, bool *flag, bool recurse=true)
Requests notification when any of the keys covered by the recursive depth specification change by set...
Sub * find(const UniConfKey &key) const
Finds the sub-node with the specified key.
void del_callback(void *cookie, const UniConfKey &key, bool recurse=true)
Cancels notification requested using add_callback().
WvString printable() const
Returns the canonical string representation of the path.
UniConfKey fullkey(const Sub *ancestor=NULL) const
Returns full path of this node relative to an ancestor.
An iterator over the segments of a key.
A default implementation of IUniConfGen, providing various handy features that save trouble when impl...
bool haschildren() const
Returns true if the node has children.