Webdar 1.0.0
Web user interface to libdar
Public Member Functions | List of all members
environment Class Reference

class environment holds environment variables passed to webdar from its parent process (a shell for example) More...

#include <environment.hpp>

Public Member Functions

 environment (const environment &ref)=default
 
 environment (environment &&ref) noexcept=default
 
environmentoperator= (const environment &ref)=default
 
environmentoperator= (environment &&ref) noexcept=default
 
void feed (char **env)
 feed the object with the system provided environment
 
bool get_value_of (const std::string &var, std::string &value) const
 provide the value associated to a given environment variable More...
 
std::string get_value_with_default (const std::string &var, const std::string &defaulted) const
 provide the value associated to a given environment variable or the provided defaulted value More...
 

Detailed Description

class environment holds environment variables passed to webdar from its parent process (a shell for example)

Member Function Documentation

◆ get_value_of()

bool environment::get_value_of ( const std::string &  var,
std::string &  value 
) const

provide the value associated to a given environment variable

Parameters
[in]varis the name of the variable to fetch
[out]valueis the value associated with this value if it exists
Returns
true if a value is available and the "value" argument is set, if the variable does not exist in the environment "value" is unchanged and this method returns false

◆ get_value_with_default()

string environment::get_value_with_default ( const std::string &  var,
const std::string &  defaulted 
) const

provide the value associated to a given environment variable or the provided defaulted value

Parameters
[in]varis the name of the variable to fetch
[in]defaultedit the default value to return if the variable is not found in the environment
Returns
the value or default valuer associated to the "var" environment variable

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