8 #include "uniconfroot.h"
9 #include "uniunwrapgen.h"
10 #include "wvlinkerhack.h"
15 UniUnwrapGen::UniUnwrapGen(
const UniConf &inner)
17 refreshing = committing =
false;
22 UniUnwrapGen::~UniUnwrapGen()
26 root->mounts.del_callback(
this);
30 void UniUnwrapGen::setinner(
const UniConf &inner)
34 root->mounts.del_callback(
this);
41 root->mounts.add_callback(
this, wv::bind(&UniUnwrapGen::gencallback,
87 return _sub(key).
getme();
93 _sub(key).
setme(value);
101 xinner.
rootobj()->mounts.setv(pairs);
107 return _sub(key).
exists();
120 return gen ? gen->
isok() :
false;
137 virtual bool next() {
return i.next(); }
156 virtual bool next() {
return i.next(); }
164 return new Iter(_sub(key));
174 void UniUnwrapGen::gencallback(
const UniConfKey &key, WvStringParm value)
178 delta(subkey, value);
virtual WvString value() const
Returns the value of the current key.
bool refresh() const
Refreshes information about this key recursively.
void commit() const
Commits information about this key recursively.
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
virtual bool isok()
Determines if the generator is usable and working properly.
virtual WvString value() const
Returns the value of the current key.
virtual UniConfKey key() const
Returns the current key.
virtual ~Iter()
Destroys the iterator.
const UniConf & inner() const
Returns the inner generator.
UniConf instances function as handles to subtrees of a UniConf tree and expose a high-level interface...
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 is an implementation of a simple and efficient printable-string class.
An abstract data container that backs a UniConf tree.
virtual void rewind()
Rewinds the iterator.
UniConfRoot * rootobj() const
Returns a pointer to the UniConfRoot that manages this node.
virtual bool next()
Seeks to the next element in the sequence.
virtual bool next()
Seeks to the next element in the sequence.
virtual void setv(const UniConfPairList &pairs)
Stores multiple key-value pairs into the registry.
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
virtual bool exists(const UniConfKey &key)
Without fetching its value, returns true if a key exists.
virtual Iter * iterator(const UniConfKey &key)
Returns an iterator over the children of the specified key.
bool suborsame(const UniConfKey &key) const
Returns true if 'key' is a the same, or a subkey, of this UniConfKey.
bool isempty() const
Returns true if this path has zero segments (also known as root).
void delta(const UniConfKey &key, WvStringParm value)
Call this when a key's value or children have possibly changed.
virtual UniConfKey key() const
Returns the current key.
virtual void commit()
Commits any changes.
virtual bool refresh()
Refreshes information about a key recursively.
void setme(WvStringParm value) const
Stores a string value for this key into the registry.
Deprecated: a UniConfGen that delegates all requests to an inner UniConf.
virtual void prefetch(const UniConfKey &key, bool recursive)
Indicate that we will eventually be interested in doing get(), haschildren(), or other "get-like" ope...
virtual bool isok()=0
Determines if the generator is usable and working properly.
virtual void rewind()
Rewinds the iterator.
UniConfKey fullkey() const
Returns the full path of this node, starting at the root.
virtual Iter * recursiveiterator(const UniConfKey &key)
Like iterator(), but the returned iterator is recursive, that is, it will return children of the imme...
bool haschildren() const
Returns true if this key has children.
Represents the root of a hierarhical registry consisting of pairs of UniConfKeys and associated strin...
virtual WvString get(const UniConfKey &key)
Fetches a string value for a key from the registry.
This iterator walks through all immediate children of a UniConf node.
bool exists() const
Without fetching its value, returns true if this key exists.
virtual void set(const UniConfKey &key, WvStringParm value)
Stores a string value for a key into the registry.
This iterator performs depth-first traversal of a subtree.
IUniConfGen * whichmount(UniConfKey *mountpoint=NULL) const
Finds the generator that owns this key.
An abstract iterator over keys and values in a generator.