11#ifndef ZYPP_BASE_ENV_H
12#define ZYPP_BASE_ENV_H
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;
Easy-to use interface to the ZYPP dependency resolver.
Temporarily set/unset an environment variable.
ScopedSet(const ScopedSet &)=delete
ScopedSet & operator=(const ScopedSet &)=delete
void setval(const char *val_r)
ScopedSet(std::string var_r, const char *val_r)
Set var_r to val_r (unsets var_r if val_r is a nullptr).
ScopedSet()
Default ctor (NOOP).
ScopedSet & operator=(ScopedSet &&)=default
ScopedSet(ScopedSet &&)=default
std::unique_ptr< std::string > _val
~ScopedSet()
Restore the original setting.