Functions | |
template<typename ContainerT = std::vector<std::string>> | |
ContainerT | split_path (const typename ContainerT::value_type &s) |
Utility to split a string containing a path separated by the path_separator , which depends on the system, into a vector of strings. | |
template<typename ContainerT = std::vector<std::string>> | |
ContainerT::value_type | join_path (const ContainerT &v) |
Utility to join a vector of strings into a single string separated by the proper path_separator , which depends on the system. | |
std::string | get_string (const std::string &key, bool *found=nullptr) |
Read a string from an environment variable. | |
std::string | get_string (const std::string &key, const std::string &defaultValue) |
Read a string from an environment variable with a default value. | |
std::string | get_string (const std::string &key, const std::string &altKey, const std::string &altDefaultValue, const std::string &altAppend={}) |
Read a string from an environment variable with with a fallback. | |
std::vector< std::string > | get_path (const std::string &key, bool *found=nullptr) |
Read a path from an environment variable. | |
std::vector< std::string > | get_path (const std::string &key, const std::string &defaultValue) |
Read a path from an environment variable with a default value. | |
std::vector< std::string > | get_path (const std::string &key, const std::string &altKey, const std::string &altDefaultValue, const std::string &altAppend={}) |
Read a path from an environment variable with a fallback. | |
bool | get_bool (const std::string &key, bool defaultValue=false) |
Read a bool value from an environment variable. | |
template<typename T > | |
T | get_numeric (const std::string &key, T defaultValue=static_cast< T >(0)) |
Read an numeric value from an environment variable. | |
bool | set_string (const std::string &key, const std::string &value) |
Set a string to an environment variable. | |
bool | set_path (const std::string &key, const std::vector< std::string > &value) |
Set a path to an environment variable. | |
bool | set_bool (const std::string &key, bool value) |
Set a bool to an environment variable (as 1 or 0). | |
template<typename T > | |
bool | set_numeric (const std::string &key, bool value) |
Set a numeric value to an environment variable. | |
bool | unset (const std::string &key) |
Remove an environment variable. | |
bool | is_set (const std::string &key) |
Check if an environment variable is set. | |
std::string | getEnvironment (const char *key, bool *found=nullptr) |
Read a string from an environment variable. | |
void | setEnvironment (const std::string &key, const std::string &value) |
Set or change an environment variable. | |
void | unsetEnvironment (const std::string &key) |
Remove an environment variable. | |
Variables | |
static constexpr char | path_separator = ':' |
|
inline |
Read a bool value from an environment variable.
key | the environment variable to read |
defaultValue | the default value to return if the environment variable is not found |
defaultValue
if not foundDefinition at line 172 of file environment.h.
|
inline |
Read an numeric value from an environment variable.
key | the environment variable to read |
defaultValue | the default value to return if the environment variable is not found |
defaultValue
if not foundDefinition at line 191 of file environment.h.
|
inline |
Read a path from an environment variable.
key | the environment variable to read |
found | an optional variable to set to true iff variable is found |
Definition at line 118 of file environment.h.
|
inline |
Read a path from an environment variable with a fallback.
key | the environment variable to read |
altKey | the alternative variable to read if key is not defined |
altDefaultValue | the default for the alternative value to use if environment variable is not found |
altAppend | a string to append to each directory in the alternative variable (or its default) if key is not defined |
defaultValue
if not foundDefinition at line 148 of file environment.h.
|
inline |
Read a path from an environment variable with a default value.
key | the environment variable to read |
defaultValue | the default value to return if the environment variable is not found |
defaultValue
if not foundDefinition at line 132 of file environment.h.
|
inline |
Read a string from an environment variable.
key | the environment variable to read |
found | an optional variable to set to true iff variable is found |
Definition at line 66 of file environment.h.
|
inline |
Read a string from an environment variable with with a fallback.
key | the environment variable to read |
defaultValue | the default value to return if the environment variable is not found |
defaultValue
if not foundDefinition at line 102 of file environment.h.
|
inline |
Read a string from an environment variable with a default value.
key | the environment variable to read |
defaultValue | the default value to return if the environment variable is not found |
defaultValue
if not foundDefinition at line 87 of file environment.h.
|
inline |
Read a string from an environment variable.
key | the environment variable to read |
found | an optional variable to set to true iff variable is found |
Definition at line 307 of file environment.h.
|
inline |
Check if an environment variable is set.
key | the environment variable to check |
Definition at line 288 of file environment.h.
|
inline |
Utility to join a vector of strings into a single string separated by the proper path_separator
, which depends on the system.
s | the vector of strings to join |
Definition at line 52 of file environment.h.
|
inline |
Set a bool to an environment variable (as 1 or 0).
key | the environment variable to set or change |
value | the target value |
Definition at line 242 of file environment.h.
|
inline |
Set a numeric value to an environment variable.
key | the environment variable to set or change |
value | the target value |
Definition at line 259 of file environment.h.
|
inline |
Set a path to an environment variable.
key | the environment variable to set or change |
value | the target value |
Definition at line 228 of file environment.h.
|
inline |
Set a string to an environment variable.
key | the environment variable to set or change |
value | the target value |
Definition at line 209 of file environment.h.
|
inline |
Set or change an environment variable.
key | the environment variable to set or change |
value | the target value |
Definition at line 322 of file environment.h.
|
inline |
Utility to split a string containing a path separated by the path_separator
, which depends on the system, into a vector of strings.
s | the string to split |
Definition at line 39 of file environment.h.
|
inline |
Remove an environment variable.
key | the environment variable to remove |
Definition at line 272 of file environment.h.
|
inline |
Remove an environment variable.
key | the environment variable to remove |
Definition at line 336 of file environment.h.
|
staticconstexpr |
Definition at line 27 of file environment.h.