Marsyas
0.6.0-alpha
|
Utility for handling program options. More...
#include <CommandLineOptions.h>
Data Structures | |
struct | OptionT< bool > |
Public Member Functions | |
void | addBoolOption (const std::string &long_name, const std::string &short_name, bool value=false) |
void | addNaturalOption (const std::string &long_name, const std::string &short_name, mrs_natural value) |
void | addRealOption (const std::string &long_name, const std::string &short_name, mrs_real value) |
void | addStringOption (const std::string &long_name, const std::string &short_name, const std::string &value) |
CommandLineOptions () | |
template<typename T > | |
void | define (const std::string &long_name, char short_name, const std::string &value_name, const std::string &description, const T &default_value=T()) |
template<typename T > | |
void | define (const std::string &long_name, const std::string &value_name, const std::string &description, const T &default_value=T()) |
template<typename T > | |
void | define_old_style (const std::string &long_name, const std::string &short_name, const std::string &value_name, const std::string &description, const T &default_value=T()) |
bool | getBoolOption (const std::string &long_name) const |
mrs_natural | getNaturalOption (const std::string &long_name) const |
mrs_real | getRealOption (const std::string &long_name) const |
const std::vector< std::string > & | getRemaining () const |
std::string | getStringOption (const std::string &long_name) const |
bool | has (const std::string &long_name) const |
void | print () const |
bool | readOptions (int argc, const char **argv) |
template<typename T > | |
T | value (const std::string &long_name) const |
virtual | ~CommandLineOptions () |
Utility for handling program options.
Definition at line 39 of file CommandLineOptions.h.
Definition at line 28 of file CommandLineOptions.cpp.
~CommandLineOptions | ( | ) | [virtual] |
Definition at line 32 of file CommandLineOptions.cpp.
void addBoolOption | ( | const std::string & | long_name, |
const std::string & | short_name, | ||
bool | value = false |
||
) | [inline] |
Definition at line 166 of file CommandLineOptions.h.
void addNaturalOption | ( | const std::string & | long_name, |
const std::string & | short_name, | ||
mrs_natural | value | ||
) | [inline] |
Definition at line 180 of file CommandLineOptions.h.
void addRealOption | ( | const std::string & | long_name, |
const std::string & | short_name, | ||
mrs_real | value | ||
) | [inline] |
Definition at line 173 of file CommandLineOptions.h.
void addStringOption | ( | const std::string & | long_name, |
const std::string & | short_name, | ||
const std::string & | value | ||
) | [inline] |
Definition at line 187 of file CommandLineOptions.h.
void define | ( | const std::string & | long_name, |
char | short_name, | ||
const std::string & | value_name, | ||
const std::string & | description, | ||
const T & | default_value = T() |
||
) | [inline] |
Definition at line 112 of file CommandLineOptions.h.
void define | ( | const std::string & | long_name, |
const std::string & | value_name, | ||
const std::string & | description, | ||
const T & | default_value = T() |
||
) | [inline] |
Definition at line 126 of file CommandLineOptions.h.
void define_old_style | ( | const std::string & | long_name, |
const std::string & | short_name, | ||
const std::string & | value_name, | ||
const std::string & | description, | ||
const T & | default_value = T() |
||
) | [inline] |
Definition at line 139 of file CommandLineOptions.h.
bool getBoolOption | ( | const std::string & | long_name | ) | const [inline] |
Definition at line 194 of file CommandLineOptions.h.
mrs_natural getNaturalOption | ( | const std::string & | long_name | ) | const [inline] |
Definition at line 199 of file CommandLineOptions.h.
mrs_real getRealOption | ( | const std::string & | long_name | ) | const [inline] |
Definition at line 204 of file CommandLineOptions.h.
const std::vector<std::string>& getRemaining | ( | ) | const [inline] |
Definition at line 214 of file CommandLineOptions.h.
std::string getStringOption | ( | const std::string & | long_name | ) | const [inline] |
Definition at line 209 of file CommandLineOptions.h.
bool has | ( | const std::string & | long_name | ) | const [inline] |
Definition at line 148 of file CommandLineOptions.h.
void print | ( | ) | const |
Definition at line 41 of file CommandLineOptions.cpp.
bool readOptions | ( | int | argc, |
const char ** | argv | ||
) |
Definition at line 73 of file CommandLineOptions.cpp.
bool value< bool > | ( | const std::string & | long_name | ) | const [inline] |
Definition at line 155 of file CommandLineOptions.h.