process-cpp
3.0.0
A simple convenience library for handling processes in C++11.
|
Functions | |
CORE_POSIX_DLL_PUBLIC void | for_each (const std::function< void(const std::string &, const std::string &)> &functor) noexcept(true) |
for_each invokes a functor for every key-value pair in the environment. More... | |
CORE_POSIX_DLL_PUBLIC std::string | get_or_throw (const std::string &key) |
get queries the value of an environment variable. More... | |
CORE_POSIX_DLL_PUBLIC std::string | get (const std::string &key, const std::string &default_value=std::string()) noexcept(true) |
get queries the value of an environment variable. More... | |
CORE_POSIX_DLL_PUBLIC void | unset_or_throw (const std::string &key) |
unset_or_throw removes the variable with name key from the environment. More... | |
CORE_POSIX_DLL_PUBLIC bool | unset (const std::string &key, std::error_code &se) noexcept(true) |
unset removes the variable with name key from the environment. More... | |
CORE_POSIX_DLL_PUBLIC void | set_or_throw (const std::string &key, const std::string &value) |
set_or_throw will adjust the contents of the variable identified by key to the provided value. More... | |
CORE_POSIX_DLL_PUBLIC bool | set (const std::string &key, const std::string &value, std::error_code &se) noexcept(true) |
set will adjust the contents of the variable identified by key to the provided value. More... | |
|
noexcept |
for_each invokes a functor for every key-value pair in the environment.
[in] | functor | Invoked for every key-value pair. |
Definition at line 55 of file this_process.cpp.
References environ.
Referenced by TEST().
|
noexcept |
get queries the value of an environment variable.
[in] | key | Name of the variable to query the value for. |
[in] | default_value | Default value to return when key is not present in the environment. |
Definition at line 84 of file this_process.cpp.
Referenced by TEST().
std::string core::posix::this_process::env::get_or_throw | ( | const std::string & | key | ) |
get queries the value of an environment variable.
std::runtime_error | if there is no variable with the given key defined in the env. |
[in] | key | Name of the variable to query the value for. |
Definition at line 68 of file this_process.cpp.
|
noexcept |
set will adjust the contents of the variable identified by key to the provided value.
[in] | key | Name of the variable to set the value for. |
[in] | value | New contents of the variable. |
[out] | se | Receives the details in case of errors. |
Definition at line 131 of file this_process.cpp.
void core::posix::this_process::env::set_or_throw | ( | const std::string & | key, |
const std::string & | value | ||
) |
set_or_throw will adjust the contents of the variable identified by key to the provided value.
std::system_error | in case of errors. |
[in] | key | Name of the variable to set the value for. |
[in] | value | New contents of the variable. |
Definition at line 119 of file this_process.cpp.
Referenced by TEST().
|
noexcept |
unset removes the variable with name key from the environment.
[in] | key | Name of the variable to unset. |
[out] | se | Receives error details if unset returns false. |
Definition at line 103 of file this_process.cpp.
void core::posix::this_process::env::unset_or_throw | ( | const std::string & | key | ) |
unset_or_throw removes the variable with name key from the environment.
std::system_error | in case of errors. |
[in] | key | Name of the variable to unset. |
Definition at line 93 of file this_process.cpp.
Referenced by TEST().