OpendTect  6.6
settings.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: A.H. Bril
8  Date: 4-11-1995
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "basicmod.h"
15 #include "iopar.h"
16 
17 class SettingsManager;
18 
33 mExpClass(Basic) Settings : public IOPar
34 {
35 public:
36 
37  inline static Settings& common() { return fetch(); }
38 
39  static Settings& fetch(const char* settings_name=0);
40 
41  bool write(bool read_before=true) const;
45  bool reRead() { return doRead(false); }
49 
50  static Settings* fetchExternal(const char* settings_name,
51  const char* dtect_user,
52  const char* usr_settings_dir);
54 
55 protected:
56 
57  Settings( const char* fnm )
58  : fname_(fnm) {}
59  ~Settings() {}
60 
62 
63  static Settings* doFetch(const char*,const char*,const char*,
64  bool);
65  bool doRead(bool);
66 public:
68  void remove() { delete this; }
70 
71 private:
72 
73  static void manageSettings(Settings*);
74 
75  friend class SettingsManager;
76 };
77 
78 
79 mExternC( Basic ) const char* GetSettingsDataDir(void);
80 
81 
83 #define mSettUse(fn,basekey,key,value) \
84  Settings::common().fn( IOPar::compKey(basekey,key), value )
85 #define mSettGet(basekey,key) \
87  Settings::common()[ IOPar::compKey(basekey,key) ]
88 #define mSettWrite() \
90  Settings::common().write();
Settings
Settings class holds the user settings. It is an IOPar.
Definition: settings.h:34
Settings::manageSettings
static void manageSettings(Settings *)
mExternC
#define mExternC(module)
Definition: commondefs.h:184
GetSettingsDataDir
Export_Basic const char * GetSettingsDataDir(void)
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
Settings::doRead
bool doRead(bool)
Settings::remove
void remove()
Only specialist use i.e. on program closing.
Definition: settings.h:68
Settings::~Settings
~Settings()
Definition: settings.h:59
Settings::fetchExternal
static Settings * fetchExternal(const char *settings_name, const char *dtect_user, const char *usr_settings_dir)
for sysadm purposes
OD::Settings
@ Settings
Definition: oduicommon.h:96
Settings::reRead
bool reRead()
Definition: settings.h:45
Settings::common
static Settings & common()
Definition: settings.h:37
BufferString
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size.
Definition: bufstring.h:40
Settings::Settings
Settings(const char *fnm)
Definition: settings.h:57
Settings::write
bool write(bool read_before=true) const
iopar.h
Settings::fetch
static Settings & fetch(const char *settings_name=0)
mDeprecatedDef
#define mDeprecatedDef
Definition: plfdefs.h:216
Settings::doFetch
static Settings * doFetch(const char *, const char *, const char *, bool)
Settings::fname_
BufferString fname_
Definition: settings.h:61
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021