An EnvVar object exists to provide information about environment variables stored in the map of environment variables without having the user know about the implementation. Here is how an EnvVar is used: More...
#include <options.h>
Public Member Functions | |
char const * | c_str () const |
EnvVar (string const &name, string const &value) | |
EnvVar (string const &name) | |
string const & | name () const |
get the name of the thing this represents | |
operator bool () const | |
convert this object to a bool so you can find out if the variable is set or not. | |
operator string const & () const | |
convert this object to a string, which is the value of environment variable it corresonds to. | |
Public Attributes | |
string | name_ |
the name of the variable you are talking about | |
bool | set_ |
is this variable actually defined? | |
string | value_ |
the value of it (or empty string if not set) |
An EnvVar object exists to provide information about environment variables stored in the map of environment variables without having the user know about the implementation. Here is how an EnvVar is used:
if( op.getenv("PATH") ) { // environment variable is set
Or you can do this:
string s = op.getenv("PATH"); // gets the value of PATH string n = op.getenv("PATH").name() // gets 'PATH'
If you want to print one of these things, convert it to a std::string
Definition at line 488 of file options.h.
string const& name | ( | ) | const |
operator bool | ( | ) | const |
operator string const & | ( | ) | const |