#include <userver/engine/subprocess/environment_variables.hpp>
Environment variables representation.
Wrapper to save environment variables and pass them to ProcessStarter::Exec. Changing an instance does not change current environment variables of the process.
Definition at line 44 of file environment_variables.hpp.
Public Types | |
using | Map = EnvironmentVariablesUpdate::Map |
using | const_iterator = Map::const_iterator |
Public Member Functions | |
EnvironmentVariables (Map vars) | |
Constructs an instance from pairs: key, value taken from the map. | |
EnvironmentVariables (const EnvironmentVariables &)=default | |
Constructs copy of the instance. | |
EnvironmentVariables & | UpdateWith (EnvironmentVariablesUpdate update) |
Updates variable. | |
const std::string & | GetValue (const std::string &variable_name) const |
Returns the value of the variable. | |
const std::string * | GetValueOptional (const std::string &variable_name) const |
void | SetValue (std::string variable_name, std::string value) |
Sets the value of the variable. | |
std::string & | operator[] (const std::string &variable_name) |
Returns the reference to the value. | |
auto | empty () const |
Checks whether the container is empty. | |
auto | size () const |
Returns the number of elements. | |
auto | begin () const |
Returns a const iterator to the beginning. | |
auto | end () const |
Returns a const iterator to the ending. | |
using engine::subprocess::EnvironmentVariables::const_iterator = Map::const_iterator |
Definition at line 78 of file environment_variables.hpp.
using engine::subprocess::EnvironmentVariables::Map = EnvironmentVariablesUpdate::Map |
Definition at line 46 of file environment_variables.hpp.
|
inline |
Returns a const iterator to the beginning.
Definition at line 81 of file environment_variables.hpp.
|
inline |
Checks whether the container is empty.
Definition at line 73 of file environment_variables.hpp.
|
inline |
Returns a const iterator to the ending.
Definition at line 84 of file environment_variables.hpp.
const std::string & engine::subprocess::EnvironmentVariables::GetValue | ( | const std::string & | variable_name | ) | const |
Returns the value of the variable.
const std::string * engine::subprocess::EnvironmentVariables::GetValueOptional | ( | const std::string & | variable_name | ) | const |
Returns the pointer to the value of the variable or nullptr if there is no variable.
|
inline |
Returns the number of elements.
Definition at line 76 of file environment_variables.hpp.
EnvironmentVariables & engine::subprocess::EnvironmentVariables::UpdateWith | ( | EnvironmentVariablesUpdate | update | ) |
Updates variable.