carb::extras::EnvironmentVariableParser

Defined in carb/extras/EnvironmentVariableParser.h

class EnvironmentVariableParser

Parses environment variables into program options or environment variables.

Public Types

using Options = std::map<std::string, std::string>

key/value pairs of the parsed environment variables

Public Functions

inline EnvironmentVariableParser(const char *prefix)

Construct an environment parser looking for variables starting with prefix.

inline void parse()

Parse the environment.

Variables starting with prefix given to constructor are separated into program options, whereas all others are parsed as normal environment variables

inline const Options &getOptions()

The map of program options that matched prefix.

Returns

map of key/value options

inline const Options &getEnvVariables()

The map of all environment variables that did not the prefix.

Returns

map of key/value environment variables