00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _QORE_SYSTEMENVIRONMENT_H
00024
00025 #define _QORE_SYSTEMENVIRONMENT_H
00026
00028
00037 class SystemEnvironment {
00038 friend class AtomicEnvironmentSetter;
00039
00040 private:
00042 DLLLOCAL SystemEnvironment(const SystemEnvironment&);
00043
00045 DLLLOCAL SystemEnvironment& operator=(const SystemEnvironment&);
00046
00047 protected:
00049
00054 DLLLOCAL static int set_intern(const char *name, const char *value, bool overwrite = 1);
00055
00057
00061 DLLLOCAL static class QoreString *get_intern(const char *name);
00062
00064
00068 DLLLOCAL static class QoreStringNode *get_as_string_node_intern(const char *name);
00069
00071
00076 DLLLOCAL static int get_intern(const char *name, class QoreString &str);
00077
00079
00083 DLLLOCAL static int unset_intern(const char *name);
00084
00085 public:
00086 DLLLOCAL SystemEnvironment();
00087 DLLLOCAL ~SystemEnvironment();
00088
00090
00095 DLLEXPORT static int set(const char *name, const char *value, bool overwrite = 1);
00096
00098
00102 DLLEXPORT static class QoreString *get(const char *name);
00103
00105
00109 DLLEXPORT static class QoreStringNode *getAsStringNode(const char *name);
00110
00112
00117 DLLEXPORT static int get(const char *name, class QoreString &str);
00118
00120
00124 DLLEXPORT static int unset(const char *name);
00125
00127
00131 DLLEXPORT static bool valueExists(const char* name);
00132 };
00133
00134 DLLEXPORT extern SystemEnvironment SysEnv;
00135
00137
00141 class AtomicEnvironmentSetter
00142 {
00143 private:
00145 DLLLOCAL AtomicEnvironmentSetter(const AtomicEnvironmentSetter&);
00146
00148 DLLLOCAL AtomicEnvironmentSetter& operator=(const AtomicEnvironmentSetter&);
00149
00151 DLLLOCAL void* operator new(size_t);
00152
00153 public:
00154 DLLEXPORT AtomicEnvironmentSetter();
00155 DLLEXPORT ~AtomicEnvironmentSetter();
00156
00158
00163 DLLEXPORT int set(const char *name, const char *value, bool overwrite = 1);
00164
00166
00170 DLLEXPORT class QoreString *get(const char *name);
00171
00173
00177 DLLEXPORT class QoreStringNode *getAsStringNode(const char *name);
00178
00180
00185 DLLEXPORT int get(const char *name, class QoreString &str);
00186
00188
00192 DLLEXPORT int unset(const char *name);
00193
00195
00199 DLLEXPORT bool valueExists(const char* name);
00200 };
00201
00202 #endif