00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 1997-2002 Net Integration Technologies, Inc. 00004 * 00005 * UniListGen is a UniConf generator to allow multiple generators to be 00006 * stacked in a priority sequence for get/set/etc. 00007 * 00008 */ 00009 00010 #ifndef __UNICONFLISTGEN_H 00011 #define __UNICONFLISTGEN_H 00012 00013 #include "uniconfgen.h" 00014 #include "wvscatterhash.h" 00015 00016 /* 00017 * Accepts a list of UniConf generators, and stacks them, treating them as one 00018 * uniconf source. 00019 * 00020 * The standard way of using the list generator would be with a moniker. The 00021 * moniker takes the form of list:(tcl style string list). 00022 * 00023 * For example: list:readonly:ini:admin.ini ini:user.ini 00024 * 00025 * The list can also contain a list. This still uses tcl style string lists as 00026 * follows: 00027 * 00028 * list:readonly:ini:admin.ini list:{ini:user1.ini ini:user2.ini} ini:def.ini 00029 */ 00030 class UniListGen : public UniConfGen 00031 { 00032 public: 00033 UniListGen(UniConfGenList *_l) : l(_l), i(*_l) { } 00034 virtual UniListGen::~UniListGen() { delete l; } 00035 00036 UniConfGenList *l; 00037 UniConfGenList::Iter i; 00038 00039 /***** Overridden members *****/ 00040 00041 virtual void commit(); 00042 virtual bool refresh(); 00043 virtual WvString get(const UniConfKey &key); 00044 virtual void set(const UniConfKey &key, WvStringParm value); 00045 virtual bool exists(const UniConfKey &key); 00046 virtual bool haschildren(const UniConfKey &key); 00047 virtual bool isok(); 00048 virtual Iter *iterator(const UniConfKey &key); 00049 00050 class IterIter : public UniConfGen::Iter 00051 { 00052 protected: 00053 DeclareWvScatterTable(UniConfKey); 00054 DeclareWvList2(IterList, UniConfGen::Iter); 00055 00056 IterList l; 00057 IterList::Iter *i; 00058 UniConfKeyTable d; 00059 00060 public: 00061 IterIter(UniConfGenList::Iter &geniter, const UniConfKey &key); 00062 virtual ~IterIter() { delete i; } 00063 00064 virtual void rewind(); 00065 virtual bool next(); 00066 virtual UniConfKey key() const; 00067 }; 00068 }; 00069 00070 00071 #endif // __UNICONFLISTGEN_H