![]() |
Kea 3.1.1
|
Wrapper for environment variable that restores the variable to its original value. More...
#include <env_var_wrapper.h>
Public Member Functions | |
EnvVarWrapper (const std::string &name) | |
Constructor. | |
~EnvVarWrapper () | |
Destructor. | |
std::string | getOriginalValue () const |
Fetches the original value of the env variable. | |
std::string | getValue () const |
Fetches the current value of the env variable. | |
void | setValue (const std::string value="") |
Sets the current value of the env variable. | |
Wrapper for environment variable that restores the variable to its original value.
Definition at line 17 of file env_var_wrapper.h.
isc::test::EnvVarWrapper::EnvVarWrapper | ( | const std::string & | name | ) |
Constructor.
Fetchs and retains the variable's current value as the "original" value.
Definition at line 14 of file env_var_wrapper.cc.
References getValue().
isc::test::EnvVarWrapper::~EnvVarWrapper | ( | ) |
Destructor.
Restores the original value (if one), otherwise it unsets it.
Definition at line 18 of file env_var_wrapper.cc.
References setValue().
std::string isc::test::EnvVarWrapper::getOriginalValue | ( | ) | const |
Fetches the original value of the env variable.
Definition at line 23 of file env_var_wrapper.cc.
std::string isc::test::EnvVarWrapper::getValue | ( | ) | const |
Fetches the current value of the env variable.
Definition at line 28 of file env_var_wrapper.cc.
Referenced by EnvVarWrapper().
void isc::test::EnvVarWrapper::setValue | ( | const std::string | value = "" | ) |
Sets the current value of the env variable.
value | new value of the variable. If empty the variable is unset. |
Definition at line 34 of file env_var_wrapper.cc.
Referenced by ~EnvVarWrapper().