00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 2002 Net Integration Technologies, Inc. 00004 * 00005 * A UniConf generator that stores keys in memory. 00006 */ 00007 #ifndef __UNITEMPGEN_H 00008 #define __UNITEMPGEN_H 00009 00010 #include "uniconfgen.h" 00011 #include "uniconftree.h" 00012 00013 /** 00014 * A UniConf generator that stores keys in memory. 00015 * 00016 * Maintains a dirtyness indicator that is set whenever the contents 00017 * are changed. Also dispatches notifications on such changes. 00018 */ 00019 class UniTempGen : public UniConfGen 00020 { 00021 protected: 00022 class NodeIter; 00023 friend class NodeIter; 00024 00025 public: 00026 UniConfValueTree *root; /*!< the root of the tree */ 00027 bool dirty; /*!< set whenever the tree actually changes */ 00028 00029 UniTempGen(); 00030 virtual ~UniTempGen(); 00031 00032 /***** Overridden members *****/ 00033 00034 virtual WvString get(const UniConfKey &key); 00035 virtual void set(const UniConfKey &key, WvStringParm value); 00036 virtual bool exists(const UniConfKey &key); 00037 virtual bool haschildren(const UniConfKey &key); 00038 virtual Iter *iterator(const UniConfKey &key); 00039 }; 00040 00041 00042 /** An iterator over keys stored in a UniTempGen. */ 00043 class UniTempGen::NodeIter : public UniTempGen::Iter 00044 { 00045 protected: 00046 UniTempGen *xgen; 00047 UniConfValueTree::Iter xit; 00048 00049 public: 00050 NodeIter(UniTempGen *gen, const UniConfValueTree::Iter &it); 00051 virtual ~NodeIter(); 00052 00053 /***** Overridden methods *****/ 00054 00055 virtual void rewind(); 00056 virtual bool next(); 00057 virtual UniConfKey key() const; 00058 }; 00059 00060 00061 #endif // __UNITEMPGEN_H