#include <SystemEnvironment.h>
Static Public Member Functions | |
static DLLEXPORT int | set (const char *name, const char *value, bool overwrite=1) |
sets the given environment variable to the value passed, respecting the overwrite flag | |
static DLLEXPORT class QoreString * | get (const char *name) |
returns the value of the environment variable as a new QoreString object, 0 if not present, caller owns the pointer returned | |
static DLLEXPORT class QoreStringNode * | getAsStringNode (const char *name) |
returns the value of the environment variable as a new QoreStringNode object, 0 if not present, caller owns the reference count of the pointer returned | |
static DLLEXPORT int | get (const char *name, class QoreString &str) |
appends the value of the given environment variable to a QoreString, returns 0 for OK, -1 for not found | |
static DLLEXPORT int | unset (const char *name) |
unsets the given environment variable | |
static DLLEXPORT bool | valueExists (const char *name) |
returns true if the environment variable exists and has a value, false if not | |
Static Protected Member Functions | |
static DLLLOCAL int | set_intern (const char *name, const char *value, bool overwrite=1) |
sets the given environment variable to the value passed, respecting the overwrite flag | |
static DLLLOCAL class QoreString * | get_intern (const char *name) |
returns the value of the environment variable as a new QoreString object, 0 if not present, caller owns the pointer returned | |
static DLLLOCAL class QoreStringNode * | get_as_string_node_intern (const char *name) |
returns the value of the environment variable as a new QoreStringNode object, 0 if not present, caller owns the reference count of the pointer returned | |
static DLLLOCAL int | get_intern (const char *name, class QoreString &str) |
appends the value of the given environment variable to a QoreString, returns 0 for OK, -1 for not found | |
static DLLLOCAL int | unset_intern (const char *name) |
unsets the given environment variable | |
Friends | |
class | AtomicEnvironmentSetter |
On some platforms (HP-UX for example), the system environment cannot be accessed safely from multiple threads without a lock. This class guarantees thread-safe access to the environment on all systems (as long as all accesses are made through this class). There is only one of the objects; the constructor and destructor are not exported in the public interface of the library and therefore can only be instantiated internally anyway. To make multiple updates atomically within the environment lock, use AtomicEnvironmentSetter
static DLLLOCAL int SystemEnvironment::set_intern | ( | const char * | name, | |
const char * | value, | |||
bool | overwrite = 1 | |||
) | [static, protected] |
sets the given environment variable to the value passed, respecting the overwrite flag
unlocked
name | the name of the environment variable to set | |
value | the value of the environment variable | |
overwrite | the overwrite flag |
static DLLLOCAL class QoreString* SystemEnvironment::get_intern | ( | const char * | name | ) | [static, protected] |
returns the value of the environment variable as a new QoreString object, 0 if not present, caller owns the pointer returned
unlocked
name | the name of the environment variable |
static DLLLOCAL class QoreStringNode* SystemEnvironment::get_as_string_node_intern | ( | const char * | name | ) | [static, protected] |
returns the value of the environment variable as a new QoreStringNode object, 0 if not present, caller owns the reference count of the pointer returned
unlocked
name | the name of the environment variable |
static DLLLOCAL int SystemEnvironment::get_intern | ( | const char * | name, | |
class QoreString & | str | |||
) | [static, protected] |
appends the value of the given environment variable to a QoreString, returns 0 for OK, -1 for not found
unlocked
name | the name of the environment variable | |
str | a reference to a QoreString object where the value will be concatenated if the environment variable exists |
static DLLLOCAL int SystemEnvironment::unset_intern | ( | const char * | name | ) | [static, protected] |
unsets the given environment variable
unlocked
name | the name of the environment variable to unset |
static DLLEXPORT int SystemEnvironment::set | ( | const char * | name, | |
const char * | value, | |||
bool | overwrite = 1 | |||
) | [static] |
sets the given environment variable to the value passed, respecting the overwrite flag
name | the name of the environment variable to set | |
value | the value of the environment variable | |
overwrite | the overwrite flag |
static DLLEXPORT class QoreString* SystemEnvironment::get | ( | const char * | name | ) | [static] |
returns the value of the environment variable as a new QoreString object, 0 if not present, caller owns the pointer returned
name | the name of the environment variable |
static DLLEXPORT class QoreStringNode* SystemEnvironment::getAsStringNode | ( | const char * | name | ) | [static] |
returns the value of the environment variable as a new QoreStringNode object, 0 if not present, caller owns the reference count of the pointer returned
name | the name of the environment variable |
static DLLEXPORT int SystemEnvironment::get | ( | const char * | name, | |
class QoreString & | str | |||
) | [static] |
appends the value of the given environment variable to a QoreString, returns 0 for OK, -1 for not found
name | the name of the environment variable | |
str | a reference to a QoreString object where the value will be concatenated if the environment variable exists |
static DLLEXPORT int SystemEnvironment::unset | ( | const char * | name | ) | [static] |
unsets the given environment variable
name | the name of the environment variable to unset |
static DLLEXPORT bool SystemEnvironment::valueExists | ( | const char * | name | ) | [static] |
returns true if the environment variable exists and has a value, false if not
name | the name of the environment variable to check |