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. | |
Public Member Functions | |
Dictionary (const std::string &envvar, const std::string &delim=";") | |
Constructor. | |
KeyFoundType | Get (const std::string &key="") const |
Get the value corresponding to a key from this dictionary. | |
KeyValueStore | GetStore () const |
Get the underlying store, for iterating. | |
Private Attributes | |
KeyValueStore | m_dict |
The key, value store. | |
bool | m_exists |
Whether the environment variable exists in the environment. | |
std::string | m_variable |
The raw environment variable. | |
Key, value dictionary for a single environment variable.
Definition at line 114 of file environment-variable.h.
using ns3::EnvironmentVariable::Dictionary::KeyValueStore = std::unordered_map<std::string, std::string> |
Key, value store type.
Definition at line 142 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 213 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 186 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 259 of file environment-variable.cc.
|
private |
|
private |
Whether the environment variable exists in the environment.
Definition at line 151 of file environment-variable.h.
Referenced by Get().
|
private |
The raw environment variable.
Definition at line 153 of file environment-variable.h.
Referenced by Get().