libzypp 17.31.23
zypp::env::ScopedSet Class Reference

Temporarily set/unset an environment variable. More...

#include <base/Env.h>

Public Member Functions

 ScopedSet (const ScopedSet &)=delete
 
ScopedSetoperator= (const ScopedSet &)=delete
 
 ScopedSet (ScopedSet &&)=default
 
ScopedSetoperator= (ScopedSet &&)=default
 
 ScopedSet ()
 Default ctor (NOOP).
 
 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 ()
 Restore the original setting.
 

Private Member Functions

void setval (const char *val_r)
 

Private Attributes

std::string _var
 
std::unique_ptr< std::string > _val
 

Detailed Description

Temporarily set/unset an environment variable.

Definition at line 28 of file Env.h.

Constructor & Destructor Documentation

◆ ScopedSet() [1/4]

zypp::env::ScopedSet::ScopedSet ( const ScopedSet )
delete

◆ ScopedSet() [2/4]

zypp::env::ScopedSet::ScopedSet ( ScopedSet &&  )
default

◆ ScopedSet() [3/4]

zypp::env::ScopedSet::ScopedSet ( )
inline

Default ctor (NOOP).

Definition at line 38 of file Env.h.

◆ ScopedSet() [4/4]

zypp::env::ScopedSet::ScopedSet ( std::string  var_r,
const char *  val_r 
)
inline

Set var_r to val_r (unsets var_r if val_r is a nullptr).

Definition at line 42 of file Env.h.

◆ ~ScopedSet()

zypp::env::ScopedSet::~ScopedSet ( )
inline

Restore the original setting.

Definition at line 54 of file Env.h.

Member Function Documentation

◆ operator=() [1/2]

ScopedSet & zypp::env::ScopedSet::operator= ( const ScopedSet )
delete

◆ operator=() [2/2]

ScopedSet & zypp::env::ScopedSet::operator= ( ScopedSet &&  )
default

◆ setval()

void zypp::env::ScopedSet::setval ( const char *  val_r)
inlineprivate

Definition at line 61 of file Env.h.

Member Data Documentation

◆ _var

std::string zypp::env::ScopedSet::_var
private

Definition at line 70 of file Env.h.

◆ _val

std::unique_ptr<std::string> zypp::env::ScopedSet::_val
private

Definition at line 71 of file Env.h.


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