MIRA
Public Member Functions | Static Public Member Functions | List of all members
Process::Environment Class Reference

Holds the environment variables that can be passed to a process. More...

#include <platform/Process.h>

Public Member Functions

 Environment ()
 
 Environment (const Environment &other)
 
 Environment (Environment &&other) noexcept
 
Environmentoperator= (const Environment &other)
 
Environmentoperator= (Environment &&other) noexcept
 
void clear ()
 Removes all environment variables. More...
 
bool empty () const
 
void insert (const std::string &var, const std::string &value)
 inserts or replaces the environment variable var with the given value. More...
 
void insert (const std::string &string)
 Inserts or replaces the environment variable. More...
 
void insertList (const std::string &string)
 Inserts all variables from the given string which has the format. More...
 
void insert (const Environment &env)
 inserts all variables from the given environment, while replacing existing variables. More...
 
void remove (const std::string &var)
 removes the environment variable More...
 
const std::string & value (const std::string &var, const std::string &defaultValue=std::string()) const
 returns the value of the environment variable var, or the default value, if it does not exist. More...
 
std::vector< std::string > envp ()
 Generates and returns an vector of strings, conventionally of the form key=value, which can be used to call low-level system functions such as execXe(). More...
 
const std::map< std::string, std::string > & variables () const
 

Static Public Member Functions

static Environment systemEnvironment ()
 

Detailed Description

Holds the environment variables that can be passed to a process.

The environment of the calling process can be obtained using systemEnvironment().

Constructor & Destructor Documentation

◆ Environment() [1/3]

Environment ( )
inline

◆ Environment() [2/3]

Environment ( const Environment other)

◆ Environment() [3/3]

Environment ( Environment &&  other)
noexcept

Member Function Documentation

◆ operator=() [1/2]

Environment& operator= ( const Environment other)

◆ operator=() [2/2]

Environment& operator= ( Environment &&  other)
noexcept

◆ clear()

void clear ( )

Removes all environment variables.

◆ empty()

bool empty ( ) const

◆ insert() [1/3]

void insert ( const std::string &  var,
const std::string &  value 
)

inserts or replaces the environment variable var with the given value.

◆ insert() [2/3]

void insert ( const std::string &  string)

Inserts or replaces the environment variable.

The variable and the value are given in the format:

variable=value

◆ insertList()

void insertList ( const std::string &  string)

Inserts all variables from the given string which has the format.

variable1=value1;variable2=value2;variable3=value3

◆ insert() [3/3]

void insert ( const Environment env)

inserts all variables from the given environment, while replacing existing variables.

◆ remove()

void remove ( const std::string &  var)

removes the environment variable

◆ value()

const std::string& value ( const std::string &  var,
const std::string &  defaultValue = std::string() 
) const

returns the value of the environment variable var, or the default value, if it does not exist.

◆ envp()

std::vector<std::string> envp ( )

Generates and returns an vector of strings, conventionally of the form key=value, which can be used to call low-level system functions such as execXe().

◆ variables()

const std::map<std::string,std::string>& variables ( ) const
inline

◆ systemEnvironment()

static Environment systemEnvironment ( )
static

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