Go to the documentation of this file.
7 #ifndef _POWERDXX_SYS_ENV_HPP_
8 #define _POWERDXX_SYS_ENV_HPP_
48 template <
size_t Size>
69 operator char const *()
const {
70 return getenv(this->name);
90 ? setenv(this->name, assign, 1)
91 : unsetenv(this->name);
109 return *
this =
nullptr;
137 template <
typename T>
150 template <
typename T>
Can be thrown by syscall function wrappers if the function returned with an error.
Definition: error.hpp:26
A reference type refering to an environment variable.
Definition: env.hpp:32
const char *const name
A pointer to the variable name.
Definition: env.hpp:37
const Var operator[](T const &name) const
Access environment variable by name.
Definition: env.hpp:138
Wrappers around native system interfaces.
Var & erase()
Explicitly deletes the environment variable.
Definition: env.hpp:108
A singleton class providing access to environment variables.
Definition: env.hpp:128
Var & operator=(Var const &)=delete
Do not permit copy assignment.
The domain error type.
Definition: env.hpp:24
const char * c_str() const
Explicitly retrieve the value as a character array.
Definition: env.hpp:120
Var(char const (&name)[Size])
Construct an environment variable reference.
Definition: env.hpp:49
struct sys::env::Vars vars
Singleton providing access to environment variables.
Provides system call error handling.