#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<class T>
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<mystring>&) const;
mystring read_dir(const mystring& name, const mystring& def,
config_cache<mystring>&) const;
unsigned read_uns(const mystring& name, unsigned def,
config_cache<unsigned>&) const;
strlist read_list(const mystring& name, const strlist& def,
config_cache<strlist>&) const;
};
extern const configuration* config;
#endif