#include <EnvVars.hpp>
Public Types | |
typedef Map< String, String > | EnvMap |
typedef EnvMap::const_iterator | const_iterator |
enum | EEnvVarFlag { E_CURRENT_ENVIRONMENT, E_EMPTY_ENVIRONMENT } |
Public Member Functions | |
EnvVars (EEnvVarFlag flag=E_EMPTY_ENVIRONMENT) | |
Create an EnvVars object that is either empty or contains all of the environment variable from the current environment. | |
template<class InputIterator> | |
EnvVars (EEnvVarFlag flag, InputIterator first, InputIterator last) | |
Create an EnvVars object that is either empty or contains all of the environment variable from the current environment and override it with additional environment variables from a map range specified with InputIterators. | |
EnvVars (const char *const envp[]) | |
Create an EnvVars object that contains the evironment variables specifed in a string array. | |
EnvVars (const EnvVars &arg) | |
Copy constructor. | |
~EnvVars () | |
Destructor. | |
EnvVars & | operator= (const EnvVars &arg) |
Assignment operator. | |
const char *const * | getenvp () const |
size_t | size () const |
String | getValue (const String &key, const String ¬FoundRetVal=String()) const |
Get the value associated with a given key. | |
bool | removeVar (const String &key) |
Remove an environment variable from this EnvVars object. | |
bool | setVar (const String &keyValue) |
Set the value for a given environemt variable. | |
bool | setVar (const String &key, const String &value) |
Set the value for a given environemt variable. | |
bool | addVar (const String &name, const String &value) |
Adds the variable name if its not already part of the set. | |
bool | updateVar (const String &name, const String &value) |
Updates an existing variable. | |
const_iterator | begin () const |
const_iterator | end () const |
Private Member Functions | |
void | deleteEnvp () const |
Static Private Member Functions | |
static void | fillEnvMap (EnvMap &envMap) |
static void | fillEnvMap (const char *const envp[], EnvMap &envMap) |
Private Attributes | |
EnvMap | m_envMap |
char ** | m_envp |
Definition at line 48 of file EnvVars.hpp.
|
Definition at line 52 of file EnvVars.hpp. |
|
Definition at line 51 of file EnvVars.hpp. |
|
Definition at line 54 of file EnvVars.hpp. |
|
Create an EnvVars object that is either empty or contains all of the environment variable from the current environment.
Definition at line 77 of file EnvVars.cpp. References E_CURRENT_ENVIRONMENT, environ, fillEnvMap(), and m_envMap. |
|
Create an EnvVars object that is either empty or contains all of the environment variable from the current environment and override it with additional environment variables from a map range specified with InputIterators. The map with the additional variables can contain either blocxx::String or std::string elements (has to provide the c_str() method returning pointer to the string). Variables with empty name or a name containing the '=' character (like for setenv in SUSv3) are discarded.
Definition at line 202 of file EnvVars.hpp. References E_CURRENT_ENVIRONMENT, fillEnvMap(), m_envMap, and setVar(). |
|
Create an EnvVars object that contains the evironment variables specifed in a string array.
Definition at line 88 of file EnvVars.cpp. References fillEnvMap(), and m_envMap. |
|
Copy constructor.
|
|
Destructor.
Definition at line 96 of file EnvVars.cpp. References deleteEnvp(). |
|
Adds the variable name if its not already part of the set.
Definition at line 208 of file EnvVars.cpp. References deleteEnvp(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::end(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::find(), BLOCXX_NAMESPACE::isValidKey(), m_envMap, and name. |
|
Definition at line 178 of file EnvVars.hpp. |
|
Definition at line 128 of file EnvVars.cpp. Referenced by addVar(), getenvp(), removeVar(), setVar(), updateVar(), and ~EnvVars(). |
|
Definition at line 187 of file EnvVars.hpp. |
|
Definition at line 112 of file EnvVars.cpp. References BLOCXX_NAMESPACE::Map< Key, T, Compare >::clear(), BLOCXX_NAMESPACE::getKeyValue(), i, and BLOCXX_NAMESPACE::isValidKey(). |
|
Definition at line 104 of file EnvVars.cpp. References environ. Referenced by EnvVars(). |
|
Definition at line 159 of file EnvVars.cpp. References BLOCXX_NAMESPACE::Map< Key, T, Compare >::begin(), deleteEnvp(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::end(), i, m_envMap, m_envp, and BLOCXX_NAMESPACE::Map< Key, T, Compare >::size(). Referenced by BLOCXX_NAMESPACE::Exec::safePopen(), and BLOCXX_NAMESPACE::Exec::safeSystem(). |
|
Get the value associated with a given key.
Definition at line 150 of file EnvVars.cpp. References BLOCXX_NAMESPACE::Map< Key, T, Compare >::end(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::find(), and m_envMap. |
|
Assignment operator.
|
|
Remove an environment variable from this EnvVars object.
Definition at line 192 of file EnvVars.cpp. References deleteEnvp(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::end(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::erase(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::find(), and m_envMap. |
|
Set the value for a given environemt variable. If the environment variable does not exist in the EnvVars object, it will be added.
Definition at line 222 of file EnvVars.cpp. References deleteEnvp(), BLOCXX_NAMESPACE::isValidKey(), and m_envMap. |
|
Set the value for a given environemt variable. If the environment variable does not exist in the EnvVars object, it will be added.
Definition at line 236 of file EnvVars.cpp. References BLOCXX_NAMESPACE::String::c_str(), and BLOCXX_NAMESPACE::getKeyValue(). Referenced by EnvVars(). |
|
Definition at line 121 of file EnvVars.hpp. |
|
Updates an existing variable.
Definition at line 245 of file EnvVars.cpp. References deleteEnvp(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::end(), BLOCXX_NAMESPACE::Map< Key, T, Compare >::find(), m_envMap, and name. |
|
Definition at line 197 of file EnvVars.hpp. Referenced by addVar(), EnvVars(), getenvp(), getValue(), removeVar(), setVar(), and updateVar(). |
|
Definition at line 198 of file EnvVars.hpp. Referenced by deleteEnvp(), and getenvp(). |