00001 #ifndef settings_h
00002 #define settings_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "iopar.h"
00017
00018
00034 mClass Settings : public IOPar
00035 {
00036 public:
00037
00038 inline static Settings& common() { return fetch(); }
00039
00040 static Settings& fetch(const char* settings_name=0);
00041
00042 bool write(bool read_before=true) const;
00046 bool reRead() { return doRead(false); }
00050
00051 static Settings* fetchExternal(const char* settings_name,
00052 const char* dtect_user,
00053 const char* usr_settings_dir);
00055
00056 protected:
00057
00058 Settings( const char* fnm )
00059 : fname(fnm) {}
00060 ~Settings() {}
00061
00062 FileNameString fname;
00063
00064 static Settings* doFetch(const char*,const char*,const char*,
00065 bool);
00066 bool doRead(bool);
00067 };
00068
00069
00071 #define mSettUse(fn,basekey,key,value) \
00072 Settings::common().fn( IOPar::compKey(basekey,key), value )
00073
00074 #define mSettGet(basekey,key) \
00075 Settings::common()[ IOPar::compKey(basekey,key) ]
00076
00077 #define mSettWrite() \
00078 Settings::common().write();
00079
00080 #endif