10 #include "uniconfpair.h"
11 #include "wvcallbacklist.h"
30 typedef wv::function<void(
const UniConfKey&, WvStringParm)>
48 const UniConfGenCallback &callback) = 0;
60 virtual bool isok() = 0;
123 virtual int str2int(WvStringParm s,
int defvalue)
const = 0;
132 virtual void set(
const UniConfKey &key, WvStringParm value) = 0;
139 virtual void setv(
const UniConfPairList &pairs) = 0;
192 {0xb0, 0x56, 0x8b, 0x9d, 0xde, 0x9a, 0xbe, 0x9f}});
208 UniConfPairList deltas;
225 const UniConfGenCallback &callback);
285 virtual int str2int(WvStringParm s,
int defvalue)
const;
288 virtual void set(
const UniConfKey &key, WvStringParm value) = 0;
289 virtual void setv(
const UniConfPairList &pairs) = 0;
302 void setv_naive(
const UniConfPairList &pairs);
333 virtual void rewind() = 0;
340 virtual bool next() = 0;
363 virtual bool next() {
return false; }
369 #endif // __UNICONFGEN_H
virtual bool isok()
Determines if the generator is usable and working properly.
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 void set(const UniConfKey &key, WvStringParm value)=0
Stores a string value for a key into the registry.
virtual bool next()
Seeks to the next element in the sequence.
virtual bool exists(const UniConfKey &key)=0
Without fetching its value, returns true if a key exists.
virtual WvString value() const =0
Returns the value of the current key.
virtual void prefetch(const UniConfKey &key, bool recursive)=0
Indicate that we will eventually be interested in doing get(), haschildren(), or other "get-like" ope...
virtual void flush_buffers()=0
Flushes any commitment/notification buffers .
void dispatch_delta(const UniConfKey &key, WvStringParm value)
Immediately sends notification that a key has possibly changed.
virtual ~UniConfGen()
Destroys the UniConfGen and may discard uncommitted data.
virtual WvString get(const UniConfKey &key)=0
Fetches a string value for a key from the registry.
virtual void flush_buffers()=0
Flushes any commitment/notification buffers .
An iterator that iterates through a constant list of keys.
virtual int str2int(WvStringParm s, int defvalue) const
Converts a string to an integer.
virtual Iter * recursiveiterator(const UniConfKey &key)
Like iterator(), but the returned iterator is recursive, that is, it will return children of the imme...
::UniListIter ListIter
An iterator over a constant list of keys (see below)
virtual UniConfKey key() const =0
Returns the current key.
virtual WvString get(const UniConfKey &key)=0
Fetches a string value for a key from the registry.
virtual bool haschildren(const UniConfKey &key)=0
Returns true if a key has children.
void unhold_delta()
Resumes notifications when each hold_delta() has been matched.
WvString is an implementation of a simple and efficient printable-string class.
virtual void commit()
Commits any changes.
An abstract data container that backs a UniConf tree.
virtual void rewind()
Rewinds the iterator.
Represents a UniConf key which is a path in a hierarchy structured much like the traditional Unix fil...
virtual WvString value() const
Returns the value of the current key.
virtual void set(const UniConfKey &key, WvStringParm value)=0
Stores a string value for a key into the registry.
virtual bool haschildren(const UniConfKey &key)
Returns true if a key has children.
void delta(const UniConfKey &key, WvStringParm value)
Call this when a key's value or children have possibly changed.
virtual int str2int(WvStringParm s, int defvalue) const =0
Converts a string to an integer.
virtual void commit()=0
Commits any changes.
void clear_delta()
Clears the list of pending notifications without sending them.
A default implementation of IUniConfGen, providing various handy features that save trouble when impl...
virtual void rewind()=0
Rewinds the iterator.
virtual void del_callback(void *cookie)=0
Removes a callback for change notification.
virtual void setv(const UniConfPairList &pairs)=0
Stores multiple key-value pairs into the registry.
virtual bool isok()=0
Determines if the generator is usable and working properly.
virtual Iter * iterator(const UniConfKey &key)=0
Returns an iterator over the children of the specified key.
virtual bool refresh()=0
Refreshes information about a key recursively.
virtual bool next()=0
Seeks to the next element in the sequence.
An iterator that's always empty.
virtual void add_callback(void *cookie, const UniConfGenCallback &callback)=0
Adds a callback for change notification.
void flush_delta()
Flushes the list of pending notifications by sending them.
virtual bool refresh()
Refreshes information about a key recursively.
virtual ~Iter()
Destroys the iterator.
virtual Iter * iterator(const UniConfKey &key)=0
Returns an iterator over the children of the specified key.
virtual void add_callback(void *cookie, const UniConfGenCallback &callback)
Adds a callback for change notification.
virtual void setv(const UniConfPairList &pairs)=0
Stores multiple key-value pairs into the registry.
virtual Iter * recursiveiterator(const UniConfKey &key)=0
Like iterator(), but the returned iterator is recursive, that is, it will return children of the imme...
UniConfGen()
Creates a UniConfGen object.
virtual void del_callback(void *cookie)
Removes a callback for change notification.
void hold_delta()
Pauses notifications until matched with a call to unhold_delta().
virtual UniConfKey key() const
Returns the current key.
virtual bool exists(const UniConfKey &key)
Without fetching its value, returns true if a key exists.
#define DEFINE_IID(iface, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11)
Used to define the IID of an interface.
An abstract iterator over keys and values in a generator.