#include <TypedOptionParser.h>
Inheritance diagram for optparse::TypedOptionParser:
Public Member Functions | |
TypedOptionParser (std::string usage="") | |
virtual | ~TypedOptionParser () |
void | add_option (std::string shrt_flag, std::string lng_flag, std::string destination, std::string help="", action_t act=STORE, type_t type=STRING, std::string dfault="", std::string allowed_values="") |
void | add_option (Teuchos::ParameterList ¶ms, std::string shrt_flag, std::string lng_flag, std::string destination, std::string help="", action_t act=STORE, std::string allowed_values="") |
std::string | get_option (std::string option_name) |
void | set_parameter_list (Teuchos::ParameterList ¶ms) |
Protected Member Functions | |
virtual void | set_option (Option &option, std::string argument) |
Definition at line 25 of file TypedOptionParser.h.
optparse::TypedOptionParser::TypedOptionParser | ( | std::string | usage = "" |
) | [inline] |
Definition at line 27 of file TypedOptionParser.h.
virtual optparse::TypedOptionParser::~TypedOptionParser | ( | ) | [inline, virtual] |
Definition at line 30 of file TypedOptionParser.h.
void optparse::TypedOptionParser::add_option | ( | Teuchos::ParameterList & | params, | |
std::string | shrt_flag, | |||
std::string | lng_flag, | |||
std::string | destination, | |||
std::string | help = "" , |
|||
action_t | act = STORE , |
|||
std::string | allowed_values = "" | |||
) |
Add an option to the parser. Default value and type are taken from a Teuchos parameter list entry.
Definition at line 20 of file TypedOptionParser.cpp.
References optparse::OptionParser::add_option(), optparse::BOOL, optparse::DOUBLE, optparse::INT, and optparse::STRING.
Here is the call graph for this function:
void optparse::TypedOptionParser::add_option | ( | std::string | shrt_flag, | |
std::string | lng_flag, | |||
std::string | destination, | |||
std::string | help = "" , |
|||
action_t | act = STORE , |
|||
type_t | type = STRING , |
|||
std::string | dfault = "" , |
|||
std::string | allowed_values = "" | |||
) | [inline] |
Add an option to the parser.
shrt_flag | Short option name, like e.g. "-q". | |
lng_flag | Long option name, like e.g. "--quiet" | |
destination | Key under which the option argument is stored in the dictionary. | |
help | Help string for generating the usage info. | |
act | Action, one of STORE, STORE_TRUE, STORE_FALSE. | |
type | Type info of the expected option argument. One of INT, DOUBLE, STRING, BOOL. | |
dfault | Default value. Value stored in the dictionary if the option is not given. | |
allowed_values | List of possible option values. A string of comma-separated allowed values. An empty string means that any value is allowed. |
Reimplemented from optparse::OptionParser.
Definition at line 45 of file TypedOptionParser.h.
References optparse::OptionParser::add_option(), and optparse::OptionParser::help().
Here is the call graph for this function:
string optparse::TypedOptionParser::get_option | ( | std::string | option_name | ) |
Get option argument.
option_name | Name of option, as given in "destination" parameter of "add_option". |
Definition at line 86 of file TypedOptionParser.cpp.
References optparse::OptionParser::options.
virtual void optparse::TypedOptionParser::set_option | ( | Option & | option, | |
std::string | argument | |||
) | [protected, virtual] |
Function, that the parser uses to store an option argument or a default value in options dictionary. Overrides OptionParser::set_option. Additionally stores the type string in the argument.
option | ||
argument |
Reimplemented from optparse::OptionParser.
void optparse::TypedOptionParser::set_parameter_list | ( | Teuchos::ParameterList & | params | ) |
Store parsed options in Teuchos parameter list. Must be called after parse_args.
params | Parameter list. |
Definition at line 56 of file TypedOptionParser.cpp.
References optparse::OptionParser::options.