| Kea 3.0.2-git

isc::test::EnvVarWrapper Class Reference

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.

## Detailed Description

Wrapper for environment variable that restores the variable to its original value.

Definition at line 17 of file env_var_wrapper.h.

## Constructor & Destructor Documentation

## ◆ EnvVarWrapper()

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().

Here is the call graph for this function:

## ◆ ~EnvVarWrapper()

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().

Here is the call graph for this function:

## Member Function Documentation

## ◆ getOriginalValue()

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.

## ◆ getValue()

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().

## ◆ setValue()

void isc::test::EnvVarWrapper::setValue | ( | const std::string | value = "" | ) |

Sets the current value of the env variable.

Parameters

  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().

The documentation for this class was generated from the following files:

- env_var_wrapper.h
- env_var_wrapper.cc