WvStreams
|
Wraps an existing UniConf tree with a transaction generator. More...
#include <unitransaction.h>
Public Member Functions | |
UniTransaction (const UniConf &base) | |
UniTransaction (const UniTransaction &base) | |
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 invoking a callback. | |
void | add_callback (void *cookie, const UniConfCallback &callback, bool recurse=true) const |
Requests notification when any of the keys covered by the recursive depth specification change by invoking a callback. | |
void | del_callback (void *cookie, const UniConfKey &key, bool recurse=true) |
Cancels notification requested using add_callback(). | |
void | del_callback (void *cookie, bool recurse=true) const |
Cancels notification requested using add_callback(). | |
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 setting a flag. | |
void | add_setbool (bool *flag, bool recurse=true) const |
Requests notification when any of the keys covered by the recursive depth specification change by setting a flag. | |
void | del_setbool (const UniConfKey &key, bool *flag, bool recurse=true) |
Cancels notification requested using add_setbool(). | |
void | del_setbool (bool *flag, bool recurse=true) const |
Cancels notification requested using add_setbool(). | |
UniConf | root () const |
Returns a handle to the root of the tree. | |
UniConf | parent () const |
Returns a handle to the parent of this node. | |
UniConfRoot * | rootobj () const |
Returns a pointer to the UniConfRoot that manages this node. | |
bool | isnull () const |
Returns true if the handle is invalid (NULL). | |
UniConfKey | fullkey () const |
Returns the full path of this node, starting at the root. | |
UniConfKey | fullkey (const UniConfKey &k) const |
Returns the full path of this node, starting at the given key. | |
UniConfKey | fullkey (const UniConf &cfg) const |
Returns the full path of this node, starting at the given handle. | |
UniConfKey | key () const |
Returns the path of this node relative to its parent. | |
const UniConf | operator[] (const UniConfKey &key) const |
Returns a handle for a subtree below this key. | |
const UniConf | u (const UniConfKey &key) const |
Return a subtree handle (see operator[]). | |
void | prefetch (bool recursive) const |
See UniConfGen::prefetch(). | |
WvString | getme (WvStringParm defvalue=WvString::null) const |
Fetches the string value for this key from the registry. | |
WvString | operator* () const |
A different way to say cfg.getme(): use *cfg instead. | |
WvStringStar | operator-> () const |
A different way to say cfg.getme().num(): use cfg->num() instead. | |
WvString | xget (WvStringParm key, WvStringParm defvalue=WvString::null) const |
A different way to say cfg[x].getme(y). | |
int | getmeint (int defvalue=0) const |
Fetches the integer value for this key from the registry. | |
int | xgetint (WvStringParm key, int defvalue=0) const |
A different way to say cfg[x].getmeint(y). | |
bool | exists () const |
Without fetching its value, returns true if this key exists. | |
void | setme (WvStringParm value) const |
Stores a string value for this key into the registry. | |
void | setme (WVSTRING_FORMAT_DECL) const |
Stores a string value for this key into the registry. | |
void | xset (WvStringParm key, WvStringParm value) const |
A different way to say cfg[x].setme(y). | |
void | setmeint (int value) const |
Stores an integer value for this key into the registry. | |
void | xsetint (WvStringParm key, int value) const |
A different way to say cfg[x].setme(y). | |
void | move (const UniConf &dst) const |
Equivalent to "mv" in a standard unix filesystem. | |
void | remove () const |
Removes this key and all of its children from the registry. | |
void | copy (const UniConf &dst, bool force) const |
Equivalent to "cp -r" in a standard unix filesystem. | |
bool | refresh () const |
Refreshes information about this key recursively. | |
void | commit () const |
Commits information about this key recursively. | |
IUniConfGen * | mount (WvStringParm moniker, bool refresh=true) const |
Mounts a generator at this key using a moniker. | |
IUniConfGen * | mountgen (IUniConfGen *gen, bool refresh=true) const |
Mounts a generator at this key. | |
void | unmount (IUniConfGen *gen, bool commit) const |
Unmounts the generator providing this key and destroys it. | |
bool | ismountpoint () const |
Determines if any generators are mounted at this key. | |
bool | isok () const |
Returns true if the generator at this key isok(). | |
IUniConfGen * | whichmount (UniConfKey *mountpoint=NULL) const |
Finds the generator that owns this key. | |
void | hold_delta () |
Pauses notifications until matched with a call to unhold_delta(). | |
void | unhold_delta () |
Resumes notifications when each hold_delta() has been matched. | |
void | clear_delta () |
Clears the list of pending notifications without sending them. | |
void | flush_delta () |
Flushes the list of pending notifications by sending them. | |
void | dump (WvStream &stream, bool everything=false) const |
Prints the entire contents of this subtree to a stream. | |
bool | haschildren () const |
Returns true if this key has children. | |
DeclareWvList (Iter) | |
Static Public Member Functions | |
static void | setbool_callback (bool *flag, const UniConf &, const UniConfKey &) |
Internal callback for setbool style notifications. | |
Protected Attributes | |
UniMountGen | mounts |
UniConfRoot * | xroot |
UniConfKey | xfullkey |
Friends | |
class | UniConf |
class | UniConf::Iter |
class | UniConf::RecursiveIter |
class | UniUnwrapGen |
Wraps an existing UniConf tree with a transaction generator.
Definition at line 20 of file unitransaction.h.
void UniConf::add_callback | ( | void * | cookie, |
const UniConfCallback & | callback, | ||
bool | recurse = true |
||
) | const [inherited] |
Requests notification when any of the keys covered by the recursive depth specification change by invoking a callback.
As a programmer, you probably DO NOT want to use this. Use UniWatchList.add() instead. Otherwise, make sure you call del_callback at the appropriate time.
Definition at line 168 of file uniconf.cc.
static void UniConfRoot::setbool_callback | ( | bool * | flag, |
const UniConf & | , | ||
const UniConfKey & | |||
) | [inline, static, inherited] |
Internal callback for setbool style notifications.
Definition at line 157 of file uniconfroot.h.
Referenced by UniConfRoot::add_setbool().
UniConf UniConf::root | ( | ) | const [inline, inherited] |
Returns a handle to the root of the tree.
Definition at line 80 of file uniconf.h.
References UniConfKey::EMPTY, and UniConf::UniConf().
UniConf UniConf::parent | ( | ) | const [inline, inherited] |
Returns a handle to the parent of this node.
Definition at line 84 of file uniconf.h.
References UniConfKey::removelast(), and UniConf::UniConf().
UniConfRoot* UniConf::rootobj | ( | ) | const [inline, inherited] |
Returns a pointer to the UniConfRoot that manages this node.
This may be NULL, to signal an invalid handle.
Definition at line 91 of file uniconf.h.
Referenced by UniConf::Iter::Iter(), UniConf::RecursiveIter::RecursiveIter(), and UniUnwrapGen::setv().
bool UniConf::isnull | ( | ) | const [inline, inherited] |
UniConfKey UniConf::fullkey | ( | ) | const [inline, inherited] |
Returns the full path of this node, starting at the root.
Definition at line 99 of file uniconf.h.
Referenced by UniConf::SortedIterBase::defcomparator(), UniConf::fullkey(), UniConf::Iter::Iter(), and UniConf::RecursiveIter::RecursiveIter().
UniConfKey UniConf::fullkey | ( | const UniConfKey & | k | ) | const [inherited] |
Returns the full path of this node, starting at the given key.
Assumes that k is an ancestor of fullkey().
Definition at line 44 of file uniconf.cc.
References UniConfKey::subkey().
UniConfKey UniConf::fullkey | ( | const UniConf & | cfg | ) | const [inline, inherited] |
Returns the full path of this node, starting at the given handle.
Definition at line 107 of file uniconf.h.
References UniConf::fullkey().
Referenced by UniConf::fullkey().
UniConfKey UniConf::key | ( | ) | const [inline, inherited] |
Returns the path of this node relative to its parent.
Definition at line 111 of file uniconf.h.
References UniConfKey::last().
Referenced by UniConf::u(), UniConf::xget(), UniConf::xgetint(), UniConf::xset(), and UniConf::xsetint().
const UniConf UniConf::operator[] | ( | const UniConfKey & | key | ) | const [inline, inherited] |
Returns a handle for a subtree below this key.
'key' is the path of the subtree to be appended to the full path of this handle to obtain the full path of the new handle.
Definition at line 119 of file uniconf.h.
References UniConf::UniConf().
const UniConf UniConf::u | ( | const UniConfKey & | key | ) | const [inline, inherited] |
Return a subtree handle (see operator[]).
Mainly to support bindings for languages that can't handle methods named [].
Definition at line 126 of file uniconf.h.
References UniConf::key().
void UniConf::prefetch | ( | bool | recursive | ) | const [inherited] |
Definition at line 62 of file uniconf.cc.
Referenced by UniUnwrapGen::prefetch().
WvString UniConf::getme | ( | WvStringParm | defvalue = WvString::null | ) | const [inherited] |
Fetches the string value for this key from the registry.
If the key is not found, returns 'defvalue' instead.
Definition at line 68 of file uniconf.cc.
References WvFastString::isnull().
Referenced by UniConf::copy(), UniUnwrapGen::get(), UniConf::getmeint(), UniConf::operator*(), and UniConf::operator->().
WvString UniConf::operator* | ( | ) | const [inline, inherited] |
A different way to say cfg.getme(): use *cfg instead.
Definition at line 150 of file uniconf.h.
References UniConf::getme().
WvStringStar UniConf::operator-> | ( | ) | const [inline, inherited] |
A different way to say cfg.getme().num(): use cfg->num() instead.
Definition at line 154 of file uniconf.h.
References UniConf::getme().
WvString UniConf::xget | ( | WvStringParm | key, |
WvStringParm | defvalue = WvString::null |
||
) | const [inline, inherited] |
A different way to say cfg[x].getme(y).
Definition at line 158 of file uniconf.h.
References UniConf::key().
int UniConf::getmeint | ( | int | defvalue = 0 | ) | const [inherited] |
Fetches the integer value for this key from the registry.
If the key is not found, returns 'defvalue' instead. (This is also used to fetch booleans - 'true', 'yes', 'on' and 'enabled' are recognized as 1, 'false', 'no', 'off' and 'disabled' as 0. Note that a nonexistant key is false by default.)
Definition at line 77 of file uniconf.cc.
References UniConf::getme().
int UniConf::xgetint | ( | WvStringParm | key, |
int | defvalue = 0 |
||
) | const [inline, inherited] |
A different way to say cfg[x].getmeint(y).
Definition at line 172 of file uniconf.h.
References UniConf::key().
bool UniConf::exists | ( | ) | const [inherited] |
Without fetching its value, returns true if this key exists.
This is provided because it is often more efficient to test existance than to actually retrieve the value.
Definition at line 50 of file uniconf.cc.
Referenced by UniUnwrapGen::exists().
void UniConf::setme | ( | WvStringParm | value | ) | const [inherited] |
Stores a string value for this key into the registry.
If the value is WvString::null, deletes the key and all of its children.
Definition at line 83 of file uniconf.cc.
Referenced by UniConf::copy(), UniConf::remove(), UniUnwrapGen::set(), and UniConf::setmeint().
void UniConf::xset | ( | WvStringParm | key, |
WvStringParm | value | ||
) | const [inline, inherited] |
A different way to say cfg[x].setme(y).
Definition at line 199 of file uniconf.h.
References UniConf::key().
void UniConf::xsetint | ( | WvStringParm | key, |
int | value | ||
) | const [inline, inherited] |
A different way to say cfg[x].setme(y).
Definition at line 208 of file uniconf.h.
References UniConf::key().
void UniConf::move | ( | const UniConf & | dst | ) | const [inherited] |
Equivalent to "mv" in a standard unix filesystem.
This recursively moves a given key and any subkeys to a new point. If the new point exists then the key will be left as a subkey at the new point. Otherwise, the key will also be renamed to the new point (as when using mv).
Don't try to do dumb stuff like making dst a subkey of this one, or vice versa, because we won't try to save you.
Unlike unix mv(), this is *not* currently atomic. It's more like cp-then-rm.
Definition at line 95 of file uniconf.cc.
References UniConf::copy(), and UniConf::remove().
void UniConf::copy | ( | const UniConf & | dst, |
bool | force | ||
) | const [inherited] |
Equivalent to "cp -r" in a standard unix filesystem.
This recursively copies a given key to a new location. Any keys that already exist at that location will not be overridden unless force is true.
Don't try to do dumb stuff like making dst a subkey of this one, or vice versa, because we won't try to save you.
Definition at line 103 of file uniconf.cc.
References UniConf::getme(), WvFastString::isnull(), and UniConf::setme().
Referenced by UniConf::move().
bool UniConf::refresh | ( | ) | const [inherited] |
Refreshes information about this key recursively.
May discard uncommitted data. Returns true on success.
Definition at line 119 of file uniconf.cc.
Referenced by UniUnwrapGen::refresh().
IUniConfGen * UniConf::mount | ( | WvStringParm | moniker, |
bool | refresh = true |
||
) | const [inherited] |
Mounts a generator at this key using a moniker.
If 'refresh' is true, automatically refresh()es the generator after mounting.
Returns the mounted generator, or NULL on failure.
Definition at line 131 of file uniconf.cc.
IUniConfGen * UniConf::mountgen | ( | IUniConfGen * | gen, |
bool | refresh = true |
||
) | const [inherited] |
Mounts a generator at this key.
Takes ownership of the supplied generator instance.
If 'refresh' is true, automatically refresh()es the generator after mounting.
Returns the mounted generator, or NULL on failure.
Definition at line 137 of file uniconf.cc.
void UniConf::unmount | ( | IUniConfGen * | gen, |
bool | commit | ||
) | const [inherited] |
Unmounts the generator providing this key and destroys it.
Definition at line 143 of file uniconf.cc.
bool UniConf::ismountpoint | ( | ) | const [inherited] |
Determines if any generators are mounted at this key.
Definition at line 149 of file uniconf.cc.
bool UniConf::isok | ( | ) | const [inherited] |
Returns true if the generator at this key isok().
Definition at line 161 of file uniconf.cc.
References IUniConfGen::isok(), and UniConf::whichmount().
IUniConfGen * UniConf::whichmount | ( | UniConfKey * | mountpoint = NULL | ) | const [inherited] |
Finds the generator that owns this key.
If the key exists, returns the generator that provides its contents. Otherwise returns the generator that would be updated if a value were set.
If non-NULL, 'mountpoint' is set to the actual key where the generator is mounted.
Definition at line 155 of file uniconf.cc.
Referenced by UniUnwrapGen::isok(), and UniConf::isok().
void UniConf::hold_delta | ( | ) | [inherited] |
Pauses notifications until matched with a call to unhold_delta().
While paused, notification events are placed into a pending list. Redundant notifications may be discarded.
Use this to safeguard non-reentrant code.
Definition at line 193 of file uniconf.cc.
void UniConf::unhold_delta | ( | ) | [inherited] |
Resumes notifications when each hold_delta() has been matched.
On resumption, dispatches all pending notifications except those that were destined to watches that were removed.
Use this to safeguard non-reentrant code.
Definition at line 199 of file uniconf.cc.
void UniConf::clear_delta | ( | ) | [inherited] |
Clears the list of pending notifications without sending them.
Does not affect the hold nesting count.
Definition at line 205 of file uniconf.cc.
void UniConf::flush_delta | ( | ) | [inherited] |
Flushes the list of pending notifications by sending them.
Does not affect the hold nesting count.
Definition at line 211 of file uniconf.cc.
void UniConf::dump | ( | WvStream & | stream, |
bool | everything = false |
||
) | const [inherited] |
Prints the entire contents of this subtree to a stream.
If 'everything' is true, also prints empty values.
Definition at line 217 of file uniconf.cc.
bool UniConf::haschildren | ( | ) | const [inherited] |
Returns true if this key has children.
This is provided because it is often more efficient to test existance than to actually retrieve the keys.
Definition at line 56 of file uniconf.cc.
Referenced by UniUnwrapGen::haschildren().