00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _QORE_SYSTEMENVIRONMENT_H
00025
00026 #define _QORE_SYSTEMENVIRONMENT_H
00027
00029
00038 class SystemEnvironment {
00039 friend class AtomicEnvironmentSetter;
00040
00041 private:
00043 DLLLOCAL SystemEnvironment(const SystemEnvironment&);
00044
00046 DLLLOCAL SystemEnvironment& operator=(const SystemEnvironment&);
00047
00048 protected:
00050
00055 DLLLOCAL static int set_intern(const char *name, const char *value, bool overwrite = 1);
00056
00058
00062 DLLLOCAL static class QoreString *get_intern(const char *name);
00063
00065
00069 DLLLOCAL static class QoreStringNode *get_as_string_node_intern(const char *name);
00070
00072
00077 DLLLOCAL static int get_intern(const char *name, class QoreString &str);
00078
00080
00084 DLLLOCAL static int unset_intern(const char *name);
00085
00086 public:
00087 DLLLOCAL SystemEnvironment();
00088 DLLLOCAL ~SystemEnvironment();
00089
00091
00096 DLLEXPORT static int set(const char *name, const char *value, bool overwrite = 1);
00097
00099
00103 DLLEXPORT static class QoreString *get(const char *name);
00104
00106
00110 DLLEXPORT static class QoreStringNode *getAsStringNode(const char *name);
00111
00113
00118 DLLEXPORT static int get(const char *name, class QoreString &str);
00119
00121
00125 DLLEXPORT static int unset(const char *name);
00126
00128
00132 DLLEXPORT static bool valueExists(const char* name);
00133 };
00134
00135 DLLEXPORT extern SystemEnvironment SysEnv;
00136
00138
00142 class AtomicEnvironmentSetter
00143 {
00144 private:
00146 DLLLOCAL AtomicEnvironmentSetter(const AtomicEnvironmentSetter&);
00147
00149 DLLLOCAL AtomicEnvironmentSetter& operator=(const AtomicEnvironmentSetter&);
00150
00152 DLLLOCAL void* operator new(size_t);
00153
00154 public:
00155 DLLEXPORT AtomicEnvironmentSetter();
00156 DLLEXPORT ~AtomicEnvironmentSetter();
00157
00159
00164 DLLEXPORT int set(const char *name, const char *value, bool overwrite = 1);
00165
00167
00171 DLLEXPORT class QoreString *get(const char *name);
00172
00174
00178 DLLEXPORT class QoreStringNode *getAsStringNode(const char *name);
00179
00181
00186 DLLEXPORT int get(const char *name, class QoreString &str);
00187
00189
00193 DLLEXPORT int unset(const char *name);
00194
00196
00200 DLLEXPORT bool valueExists(const char* name);
00201 };
00202
00203 #endif