• Main Page
  • Namespaces
  • Classes
  • Files
  • File List

settings.h

00001 #ifndef settings_h
00002 #define settings_h
00003 
00004 /*+
00005 ________________________________________________________________________
00006 
00007  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
00008  Author:        A.H. Bril
00009  Date:          4-11-1995
00010  RCS:           $Id: settings.h,v 1.12 2009-10-05 06:00:22 cvsnanne Exp $
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

Generated on Tue Nov 30 2010 for Basic by  doxygen 1.7.1