MIRA
|
A central singleton class for accessing command line parameters Underlying class is boost::program::options See http://www.boost.org/doc/libs/1_44_0/doc/html/program_options.html Usage: More...
#include <utils/ProgramOptions.h>
Public Types | |
typedef boost::program_options::options_description | Description |
typedef boost::program_options::positional_options_description | PositionalDescription |
typedef boost::program_options::variables_map | VariableMap |
typedef Base::Type | Type |
Public Member Functions | |
ProgramOptions (int argc, char **argv, const std::string &helpCategory="") | |
Constructor that takes command line arguments. More... | |
ProgramOptions (const std::vector< std::string > &args, const std::string &helpCategory="") | |
Constructor that takes command line arguments as vector. More... | |
Description & | getDescriptions () |
Return the option description map. More... | |
PositionalDescription & | getPositionalDescriptions () |
Return the option description map. More... | |
void | getOptions (VariableMap &oMap) const |
Return the option variable map. More... | |
VariableMap | getOptions () const |
Return the option variable map. More... | |
const std::vector< std::string > & | getArgs () const |
Return the command line arguments as passed in the constructor. More... | |
Static Public Member Functions | |
static Description | createOptionsDescription (const std::string &name="") |
Create empty options description. More... | |
static Type & | instance () |
Returns a reference to the singleton instance. More... | |
static bool | isDestroyed () |
Returns true, if the singleton was already destroyed. More... | |
A central singleton class for accessing command line parameters Underlying class is boost::program::options See http://www.boost.org/doc/libs/1_44_0/doc/html/program_options.html Usage:
typedef boost::program_options::options_description Description |
typedef boost::program_options::positional_options_description PositionalDescription |
typedef boost::program_options::variables_map VariableMap |
|
inherited |
ProgramOptions | ( | int | argc, |
char ** | argv, | ||
const std::string & | helpCategory = "" |
||
) |
Constructor that takes command line arguments.
helpCategory | name of a category to be created where the '–help' option is added (if empty, it is added to options directly without subcategory) |
ProgramOptions | ( | const std::vector< std::string > & | args, |
const std::string & | helpCategory = "" |
||
) |
Constructor that takes command line arguments as vector.
helpCategory | see above |
|
inlinestatic |
Create empty options description.
Use this e.g. to create an options category with automatically determined display width, to add to the main options description after populating it (see example code above). Categories are just for structured display of options, they do not affect querying the values.
|
inline |
Return the option description map.
Provided to add more options.
|
inline |
Return the option description map.
Provided to add more options. Calling this method also enables positional arguments. Positional arguments are identified by their position rather than their name. For positional options only the relative order of the arguments matters.
void getOptions | ( | VariableMap & | oMap | ) | const |
Return the option variable map.
Command line arguments are parsed according to the given description map and stored in this variable map.
|
inline |
Return the option variable map.
Command line arguments are parsed according to the given description map and stored in this variable map.
|
inline |
Return the command line arguments as passed in the constructor.
|
inlinestaticinherited |
Returns a reference to the singleton instance.
XSingleton | If the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation). |
|
inlinestaticinherited |
Returns true, if the singleton was already destroyed.
Trying to access it will result in an exception.