11 #ifndef ZYPP_BASE_ENV_H 12 #define ZYPP_BASE_ENV_H 43 :
_var { std::move(var_r) }
47 if (
const char * orig = ::getenv(
_var.c_str() ) )
48 _val.reset(
new std::string( orig ) );
64 ::setenv(
_var.c_str(), val_r, 1 );
66 ::unsetenv(
_var.c_str() );
71 std::unique_ptr<std::string>
_val;
78 #endif // ZYPP_BASE_ENV_H ScopedSet(std::string var_r, const char *val_r)
Set var_r to val_r (unsets var_r if val_r is a nullptr).
std::unique_ptr< std::string > _val
void setval(const char *val_r)
~ScopedSet()
Restore the original setting.
Temporarily set/unset an environment variable.
ScopedSet()
Default ctor (NOOP).
ScopedSet & operator=(const ScopedSet &)=delete
Easy-to use interface to the ZYPP dependency resolver.