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
00044 virtual ~UniMountGen();
00045
00046 void zap();
00047
00053 virtual IUniConfGen *mount(const UniConfKey &key,
00054 WvStringParm moniker,
00055 bool refresh);
00056
00066 virtual IUniConfGen *mountgen(const UniConfKey &key,
00067 IUniConfGen *gen,
00068 bool refresh);
00069
00076 virtual void unmount(IUniConfGen *gen, bool commit);
00077
00090 virtual IUniConfGen *whichmount(const UniConfKey &key,
00091 UniConfKey *mountpoint);
00092
00094 virtual bool ismountpoint(const UniConfKey &key);
00095
00096
00097
00098 virtual bool exists(const UniConfKey &key);
00099 virtual bool haschildren(const UniConfKey &key);
00100 virtual WvString get(const UniConfKey &key);
00101 virtual void set(const UniConfKey &key, WvStringParm value);
00102 virtual void setv(const UniConfPairList &pairs);
00103 virtual void commit();
00104 virtual bool refresh();
00105 virtual void flush_buffers() { }
00106 virtual Iter *iterator(const UniConfKey &key);
00107 virtual Iter *recursiveiterator(const UniConfKey &key);
00108
00109 private:
00111 UniGenMount *findmount(const UniConfKey &key);
00114 UniGenMount *findmountunder(const UniConfKey &key);
00115
00116
00117 UniConfKey trimkey(const UniConfKey &foundkey, const UniConfKey &key)
00118 { return key.removefirst(foundkey.numsegments()); }
00119
00121 void gencallback(const UniConfKey &base, const UniConfKey &key,
00122 WvStringParm value);
00123
00124 void makemount(const UniConfKey &key);
00125
00129 bool has_subkey(const UniConfKey &key, UniGenMount *found = NULL);
00130
00131 struct UniGenMountPairs;
00132 DeclareWvDict(UniGenMountPairs, WvFastString, key);
00133
00134 };
00135
00136 #endif //__UNIMOUNTGEN_H