#include <OW_EnvVars.hpp>
Collaboration diagram for OW_NAMESPACE::EnvVars:
Public Types | |
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. | |
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. | |
void | setVar (const String &keyValue) |
Set the value for a given environemt variable. | |
void | 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. | |
Private Types | |
typedef Map< String, String > | EnvMap |
Private Member Functions | |
void | deleteEnvp () const |
Static Private Member Functions | |
static void | fillEnvMap (const char *const envp[], EnvMap &envMap) |
Private Attributes | |
EnvMap | m_envMap |
char ** | m_envp |
Definition at line 48 of file OW_EnvVars.hpp.
|
Definition at line 147 of file OW_EnvVars.hpp. |
|
Definition at line 51 of file OW_EnvVars.hpp. |
|
Create an EnvVars object that is either empty or contains all of the environment variable from the current environment.
Definition at line 88 of file OW_EnvVars.cpp. References E_CURRENT_ENVIRONMENT, environ, fillEnvMap(), and m_envMap. |
|
Create an EnvVars object that contains the evironment variables specifed in a string array.
Definition at line 99 of file OW_EnvVars.cpp. References fillEnvMap(), and m_envMap. |
|
Copy constructor.
|
|
Destructor.
Definition at line 107 of file OW_EnvVars.cpp. References deleteEnvp(). |
|
Adds the variable name if its not already part of the set.
Definition at line 209 of file OW_EnvVars.cpp. References deleteEnvp(), OW_NAMESPACE::Map< Key, T, Compare >::end(), OW_NAMESPACE::Map< Key, T, Compare >::find(), m_envMap, and name. |
|
Definition at line 131 of file OW_EnvVars.cpp. Referenced by addVar(), removeVar(), setVar(), updateVar(), and ~EnvVars(). |
|
Definition at line 115 of file OW_EnvVars.cpp. References OW_NAMESPACE::Map< Key, T, Compare >::clear(), OW_NAMESPACE::getKeyValue(), i, and OW_NAMESPACE::String::length(). Referenced by EnvVars(). |
|
Definition at line 162 of file OW_EnvVars.cpp. References OW_NAMESPACE::Map< Key, T, Compare >::begin(), OW_NAMESPACE::Map< Key, T, Compare >::end(), i, m_envMap, m_envp, and OW_NAMESPACE::Map< Key, T, Compare >::size(). Referenced by OW_NAMESPACE::Exec::safePopen(), and OW_NAMESPACE::Exec::safeSystem(). |
|
Get the value associated with a given key.
Definition at line 153 of file OW_EnvVars.cpp. References OW_NAMESPACE::Map< Key, T, Compare >::end(), OW_NAMESPACE::Map< Key, T, Compare >::find(), and m_envMap. |
|
Assignment operator.
|
|
Remove an environment variable from this EnvVars object.
Definition at line 193 of file OW_EnvVars.cpp. References deleteEnvp(), OW_NAMESPACE::Map< Key, T, Compare >::end(), OW_NAMESPACE::Map< Key, T, Compare >::erase(), OW_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 223 of file OW_EnvVars.cpp. References deleteEnvp(), 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 231 of file OW_EnvVars.cpp. References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::getKeyValue(), and OW_NAMESPACE::String::length(). |
|
Definition at line 96 of file OW_EnvVars.hpp. Referenced by OW_NAMESPACE::Exec::safePopen(), and OW_NAMESPACE::Exec::safeSystem(). |
|
Updates an existing variable.
Definition at line 243 of file OW_EnvVars.cpp. References deleteEnvp(), OW_NAMESPACE::Map< Key, T, Compare >::end(), OW_NAMESPACE::Map< Key, T, Compare >::find(), m_envMap, and name. |
|
Definition at line 152 of file OW_EnvVars.hpp. Referenced by addVar(), EnvVars(), getenvp(), getValue(), removeVar(), setVar(), and updateVar(). |
|
Definition at line 153 of file OW_EnvVars.hpp. Referenced by deleteEnvp(), and getenvp(). |