11 #ifndef ZYPP_BASE_ENV_H 12 #define ZYPP_BASE_ENV_H 34 const char * v = ::getenv( var_r.
c_str() );
59 :
_var { std::move(var_r) }
63 if (
const char * orig = ::getenv(
_var.c_str() ) )
64 _val.reset(
new std::string( orig ) );
80 ::setenv(
_var.c_str(), val_r, 1 );
82 ::unsetenv(
_var.c_str() );
87 std::unique_ptr<std::string>
_val;
94 #endif // ZYPP_BASE_ENV_H boost::logic::tribool TriBool
3-state boolean logic (true, false and indeterminate).
Namespace intended to collect all environment variables we use.
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)
const char * c_str() const
~ScopedSet()
Restore the original setting.
Temporarily set/unset an environment variable.
TriBool strToTriBool(const C_Str &str)
Parse str into a bool if it's a legal true or false string; else indeterminate.
TriBool getenvBool(const C_Str &var_r)
If the environment variable var_r is set to a legal true or false string return bool, else indeterminate.
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
ScopedSet()
Default ctor (NOOP).
ScopedSet & operator=(const ScopedSet &)=delete
Easy-to use interface to the ZYPP dependency resolver.