(argc,argv[]) and set options.
More...
#include <Teuchos_CommandLineProcessor.hpp>
Public Types | |
Public types | |
| enum | EParseCommandLineReturn { PARSE_SUCCESSFUL = 0, PARSE_HELP_PRINTED = 1, PARSE_UNRECOGNIZED_OPTION = 2 } |
Return value for CommandLineProcessor::parse(). Note: These enums are all given non-negative values since they are designed to be returned from main(). More... | |
Public Member Functions | |
Constructors | |
| CommandLineProcessor (bool throwExceptions=true, bool recogniseAllOptions=true, bool addOutputSetupOptions=false) | |
| Default Constructor. | |
Behavior modes | |
| void | throwExceptions (const bool &throwExceptions) |
| Set if an std::exception is thrown, there is a parse error, or help is printed. | |
| bool | throwExceptions () const |
| Returns true if an std::exception is thrown, there is a parse error, or help is printed. | |
| void | recogniseAllOptions (const bool &recogniseAllOptions) |
| Set if all options must be recognized or not. | |
| bool | recogniseAllOptions () const |
| Returns true if all options are being recognized by the parser. | |
| void | addOutputSetupOptions (const bool &addOutputSetupOptions) |
Set if options will be automatically added to setup Teuchos::VerboseObjectBase::getDefaultOStream(). | |
| bool | addOutputSetupOptions () const |
Returns true options will be automatically added to setup Teuchos::VerboseObjectBase::getDefaultOStream(). | |
Set up options | |
| void | setDocString (const char doc_string[]) |
| Set a documentation sting for the entire program printed when --help is specified. | |
| void | setOption (const char option_true[], const char option_false[], bool *option_val, const char documentation[]=NULL) |
| Set a boolean option. | |
| void | setOption (const char option_name[], int *option_val, const char documentation[]=NULL, const bool required=false) |
| Set an integer option. | |
| void | setOption (const char option_name[], double *option_val, const char documentation[]=NULL, const bool required=false) |
| Set a floating-point option. | |
| void | setOption (const char option_name[], std::string *option_val, const char documentation[]=NULL, const bool required=false) |
| Set a std::string option. | |
| template<class EType> | |
| void | setOption (const char enum_option_name[], EType *enum_option_val, const int num_enum_opt_values, const EType enum_opt_values[], const char *enum_opt_names[], const char documentation[]=NULL, const bool required=false) |
| Set an enumeration option (templated by enumeration type). | |
Parse | |
| EParseCommandLineReturn | parse (int argc, char *argv[], std::ostream *errout=&std::cerr) const |
| Parse a command line. | |
Miscellaneous | |
| void | printHelpMessage (const char program_name[], std::ostream &out) const |
| Print the help message. | |
Related Functions | |
| (Note that these are not member functions.) | |
| void | setVerbosityLevelOption (const std::string &optionName, EVerbosityLevel *verbLevel, const std::string &docString, CommandLineProcessor *clp, const bool required=false) |
| Set a verbosity level parameter on a CommandLineProcessor object.. | |
(argc,argv[]) and set options.
This class will process command-line arguments in the form of (argc,argv[]) and set user-defined options. This class can also work in a number of modes. This processor can require that all options be recognized or not.
This class object will also setup the behavior of Teuchos::VerboseObjectBase::getDefaultOStream() if this->addOutputSetupOptions()==true
CommandLineProcessor/cxx_main.cpp, and FancyOutputting_test.cpp.
|
|
Return value for
|
|
||||||||||||||||
|
Default Constructor.
|
|
|
Set if an std::exception is thrown, there is a parse error, or help is printed.
|
|
|
Returns true if an std::exception is thrown, there is a parse error, or help is printed.
|
|
|
Set if all options must be recognized or not.
|
|
|
Returns true if all options are being recognized by the parser.
|
|
|
Set if options will be automatically added to setup
|
|
|
Returns true options will be automatically added to setup
|
|
|
Set a documentation sting for the entire program printed when --help is specified.
|
|
||||||||||||||||||||
|
Set a boolean option.
|
|
||||||||||||||||||||
|
Set an integer option.
|
|
||||||||||||||||||||
|
Set a floating-point option.
|
|
||||||||||||||||||||
|
Set a std::string option.
|
|
||||||||||||||||||||||||||||||||||||
|
Set an enumeration option (templated by enumeration type).
int for EType. Using any other type for EType could be trouble! |
|
||||||||||||||||
|
Parse a command line.
Note that if the option
If
|
|
||||||||||||
|
Print the help message.
|
|
||||||||||||||||||||||||
|
Set a verbosity level parameter on a CommandLineProcessor object..
|
1.3.9.1