00001
00002
00003
00004
00005
00006
00007 #ifndef __UNIMOUNTGEN_H
00008 #define __UNIMOUNTGEN_H
00009
00010 #include "uniconfgen.h"
00011 #include "wvcallback.h"
00012 #include "wvmoniker.h"
00013 #include "wvstringlist.h"
00014
00015
00017 class UniMountGen : public UniConfGen
00018 {
00019 protected:
00020
00021
00022 class UniGenMount
00023 {
00024 public:
00025 UniGenMount(IUniConfGen *gen, const UniConfKey &key)
00026 : gen(gen), key(key)
00027 { }
00028
00029 xplc_ptr<IUniConfGen> gen;
00030 UniConfKey key;
00031 };
00032
00033 typedef class WvList<UniGenMount> MountList;
00034 MountList mounts;
00035
00037 UniMountGen(const UniMountGen &other);
00038
00039 public:
00041 UniMountGen()
00042 { }
00043
00045 virtual ~UniMountGen()
00046 { }
00047
00048 void zap()
00049 { mounts.zap(); }
00050
00056 virtual IUniConfGen *mount(const UniConfKey &key,
00057 WvStringParm moniker,
00058 bool refresh);
00059
00069 virtual IUniConfGen *mountgen(const UniConfKey &key,
00070 IUniConfGen *gen,
00071 bool refresh);
00072
00079 virtual void unmount(IUniConfGen *gen, bool commit);
00080
00093 virtual IUniConfGen *whichmount(const UniConfKey &key,
00094 UniConfKey *mountpoint);
00095
00097 virtual bool ismountpoint(const UniConfKey &key);
00098
00099
00100
00101 virtual bool exists(const UniConfKey &key);
00102 virtual bool haschildren(const UniConfKey &key);
00103 virtual WvString get(const UniConfKey &key);
00104 virtual void set(const UniConfKey &key, WvStringParm value);
00105 virtual void commit();
00106 virtual bool refresh();
00107 virtual void flush_buffers() { }
00108 virtual Iter *iterator(const UniConfKey &key);
00109 virtual Iter *recursiveiterator(const UniConfKey &key);
00110
00111 private:
00113 UniGenMount *findmount(const UniConfKey &key);
00116 UniGenMount *findmountunder(const UniConfKey &key);
00117
00118
00119 UniConfKey trimkey(const UniConfKey &foundkey, const UniConfKey &key)
00120 { return key.removefirst(foundkey.numsegments()); }
00121
00123 void gencallback(const UniConfKey &key, WvStringParm value,
00124 void *userdata);
00125
00126 void makemount(const UniConfKey &key);
00127
00131 bool has_subkey(const UniConfKey &key, UniGenMount *found = NULL);
00132 };
00133
00134 #endif //__UNIMOUNTGEN_H