Qore Programming Language  0.8.11.1
Public Member Functions | List of all members
AtomicEnvironmentSetter Class Reference

class allowing for multiple updates to the system environment within a single lock in a thread-safe way, can be used on the stack More...

#include <SystemEnvironment.h>

Public Member Functions

DLLEXPORT class QoreStringget (const char *name)
 returns the value of the environment variable as a new QoreString object, 0 if not present, caller owns the pointer returned More...
 
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 More...
 
DLLEXPORT class QoreStringNodegetAsStringNode (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 More...
 
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 More...
 
DLLEXPORT int unset (const char *name)
 unsets the given environment variable More...
 
DLLEXPORT bool valueExists (const char *name)
 returns true if the environment variable exists and has a value, false if not More...
 

Detailed Description

class allowing for multiple updates to the system environment within a single lock in a thread-safe way, can be used on the stack

some systems (HP-UX, for examplex) require a lock to access the environment in a multi-threaded environment. This class allows for multiple updates to be done within the scope of the lock

See also
SystemEnvironment

Member Function Documentation

DLLEXPORT class QoreString* AtomicEnvironmentSetter::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

Parameters
namethe name of the environment variable
Returns
a QoreString pointer (or 0 if the variable does not exist), caller owns the pointer returned
DLLEXPORT int AtomicEnvironmentSetter::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

Parameters
namethe name of the environment variable
stra reference to a QoreString object where the value will be concatenated if the environment variable exists
Returns
0 for OK (environment variable found and value concatenated to string), or -1 for not found
DLLEXPORT class QoreStringNode* AtomicEnvironmentSetter::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

Parameters
namethe name of the environment variable
Returns
a QoreStringNode pointer (or 0 if the variable does not exist), caller owns the reference count of the pointer returned
DLLEXPORT int AtomicEnvironmentSetter::set ( const char *  name,
const char *  value,
bool  overwrite = 1 
)

sets the given environment variable to the value passed, respecting the overwrite flag

Parameters
namethe name of the environment variable to set
valuethe value of the environment variable
overwritethe overwrite flag
DLLEXPORT int AtomicEnvironmentSetter::unset ( const char *  name)

unsets the given environment variable

Parameters
namethe name of the environment variable to unset
Returns
0 for OK, non-0 for error
DLLEXPORT bool AtomicEnvironmentSetter::valueExists ( const char *  name)

returns true if the environment variable exists and has a value, false if not

Parameters
namethe name of the environment variable to check
Returns
true if the environment variable exists and has a value, false if not

The documentation for this class was generated from the following file: