diff -r 000000000000 -r 6f7a81934006 lib/config/configrc.h.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/config/configrc.h.in Wed Jan 16 22:39:43 2008 +0100 @@ -0,0 +1,49 @@ +#ifndef VMAILMGR__CONFIG_RC__H__ +#define VMAILMGR__CONFIG_RC__H__ + +#ifndef GLOBAL_CONFIG_DIR +#define GLOBAL_CONFIG_DIR "/etc/vmailmgr" +#endif + +#ifndef LOCAL_CONFIG_DIR +#define LOCAL_CONFIG_DIR ".vmailmgr" +#endif + +#include "mystring/mystring.h" +#include "misc/strlist.h" + +template +struct config_cache +{ + T* value; + config_cache() : value(0) { } + ~config_cache() { delete value; } +}; + +class configuration +{ +public: + configuration(); + configuration(const configuration* prev, const mystring& dir); + ~configuration(); + + configuration const * parent; + + const mystring directory; + +%%LIST%% + +private: + mystring read_str(const mystring& name, const mystring& def, + config_cache&) const; + mystring read_dir(const mystring& name, const mystring& def, + config_cache&) const; + unsigned read_uns(const mystring& name, unsigned def, + config_cache&) const; + strlist read_list(const mystring& name, const strlist& def, + config_cache&) const; +}; + +extern const configuration* config; + +#endif