Key, value dictionary for a single environment variable. More...
#include "environment-variable.h"
Public Types | |
using | KeyValueStore = std::unordered_map< std::string, std::string > |
Key, value store type. More... | |
Public Member Functions | |
Dictionary (const std::string &envvar, const std::string &delim=";") | |
Constructor. More... | |
KeyFoundType | Get (const std::string &key="") const |
Get the value corresponding to a key from this dictionary. More... | |
KeyValueStore | GetStore () const |
Get the underlying store, for iterating. More... | |
Private Attributes | |
KeyValueStore | m_dict |
The key, value store. More... | |
bool | m_exists |
Whether the environment variable exists in the environment. More... | |
std::string | m_variable |
The raw environment variable. More... | |
Key, value dictionary for a single environment variable.
Definition at line 125 of file environment-variable.h.
using ns3::EnvironmentVariable::Dictionary::KeyValueStore = std::unordered_map<std::string, std::string> |
Key, value store type.
Definition at line 153 of file environment-variable.h.
ns3::EnvironmentVariable::Dictionary::Dictionary | ( | const std::string & | envvar, |
const std::string & | delim = ";" |
||
) |
Constructor.
Parse an environment variable containing keys and optional values.
Keys in the environment variable are separated by the delim
character. Keys may be assigned values by following the key with the =
character; any remaining text up to the next delimiter will be taken as the value. If no =
is given the enpty string will be stored as the value.
[in] | envvar | The environment variable. |
[in] | delim | The delimiter between key,value pairs. |
Definition at line 224 of file environment-variable.cc.
References NS_LOCAL_ASSERT, NS_LOCAL_LOG, and ns3::SplitString().
EnvironmentVariable::KeyFoundType ns3::EnvironmentVariable::Dictionary::Get | ( | const std::string & | key = "" | ) | const |
Get the value corresponding to a key from this dictionary.
If the key
is empty return the full environment variable value.
[in] | key | The key to extract from the environment variable. |
true
if the key was found, and the associated value. Definition at line 197 of file environment-variable.cc.
References m_dict, m_exists, m_variable, and NS_LOCAL_LOG.
EnvironmentVariable::Dictionary::KeyValueStore ns3::EnvironmentVariable::Dictionary::GetStore | ( | ) | const |
Get the underlying store, for iterating.
Definition at line 270 of file environment-variable.cc.
|
private |
|
private |
Whether the environment variable exists in the environment.
Definition at line 162 of file environment-variable.h.
Referenced by Get().
|
private |
The raw environment variable.
Definition at line 164 of file environment-variable.h.
Referenced by Get().