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
00016
00017 class UniMountGen : public UniConfGen
00018 {
00019 protected:
00020
00021
00022 class UniGenMount
00023 {
00024 public:
00025 UniGenMount(UniConfGen *gen, const UniConfKey &key)
00026 : gen(gen), key(key)
00027 { }
00028
00029 ~UniGenMount()
00030 { delete gen; }
00031
00032 UniConfGen *gen;
00033 UniConfKey key;
00034 };
00035
00036 typedef class WvList<UniGenMount> MountList;
00037 MountList mounts;
00038
00039 public:
00040
00041 UniMountGen()
00042 { }
00043
00044
00045 UniMountGen(const UniMountGen &other);
00046
00047
00048 virtual ~UniMountGen()
00049 { }
00050
00051
00052
00053
00054
00055
00056 virtual UniConfGen *mount(const UniConfKey &key, WvStringParm moniker,
00057 bool refresh);
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 virtual UniConfGen *mountgen(const UniConfKey &key, UniConfGen *gen,
00069 bool refresh);
00070
00071
00072
00073
00074
00075
00076
00077 virtual void unmount(UniConfGen *gen, bool commit);
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 virtual UniConfGen *whichmount(const UniConfKey &key,
00092 UniConfKey *mountpoint);
00093
00094
00095 virtual bool ismountpoint(const UniConfKey &key);
00096
00097
00098
00099 virtual bool exists(const UniConfKey &key);
00100 virtual bool haschildren(const UniConfKey &key);
00101 virtual WvString get(const UniConfKey &key);
00102 virtual void set(const UniConfKey &key, WvStringParm value);
00103 virtual bool refresh();
00104 virtual void commit();
00105 virtual Iter *iterator(const UniConfKey &key);
00106
00107 private:
00108
00109 UniGenMount *findmount(const UniConfKey &key);
00110
00111
00112 UniConfKey trimkey(const UniConfKey &foundkey, const UniConfKey &key)
00113 { return key.removefirst(foundkey.numsegments()); }
00114
00115
00116 void gencallback(const UniConfKey &key, WvStringParm value,
00117 void *userdata);
00118
00119 void makemount(const UniConfKey &key);
00120 };
00121
00122 #endif //__UNIMOUNTGEN_H