35#include "blocxx/BLOCXX_config.h"
49 const char *
const strArg,
56 const char* p = ::strchr(strArg,
'=');
59 key = String(strArg,
size_t(p-strArg));
64inline bool isValidKey(
const String &key)
116 for(
size_t i = 0; envp[
i];
i++)
118 getKeyValue(envp[
i], key, value);
151 const String& notFoundRetVal)
const
154 return (it !=
m_envMap.
end()) ? it->second : notFoundRetVal;
171 size_t klen = it->first.length();
172 size_t vlen = it->second.length();
174 m_envp[
i] =
new char[klen + vlen + 2];
175 ::strcpy(
m_envp[
i], it->first.c_str());
177 ::strcpy(
m_envp[
i]+klen+1, it->second.c_str());
239 getKeyValue(keyValue.
c_str(), key, value);
240 return setVar(key, value);
BLOCXX_IMPORT char ** environ
const char *const * m_envp
static void fillEnvMap(EnvMap &envMap)
EnvVars(EEnvVarFlag flag=E_EMPTY_ENVIRONMENT)
Create an EnvVars object that is either empty or contains all of the environment variable from the cu...
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 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.
String getValue(const String &key, const String ¬FoundRetVal=String()) const
Get the value associated with a given key.
const char *const * getenvp() const
M::const_iterator const_iterator
void erase(iterator position)
iterator find(const key_type &x)
This String class is an abstract data type that represents as NULL terminated string of characters.
const char * c_str() const