|
soma-io
4.7.0
|
Cartograph options parser. More...
#include <soma-io/getopt/getopt.h>


Public Member Functions | |
| CartoApplication (int argc, const char **argv, const std::string &documentation) | |
| virtual | ~CartoApplication () |
| virtual void | initialize () |
Parse and check all parameters, and handle common options (such as the "--help" option). More... | |
Public Member Functions inherited from carto::OptionsParser | |
| OptionsParser (int argc, const char **argv) | |
| ~OptionsParser () | |
| template<typename T > | |
| void | addOption (T ¶m, const std::string &token, const std::string &description, bool optional=false) |
| Adds a single parameter to be parsed on the commandline. More... | |
| template<typename T > | |
| void | addOptionSeries (T ¶m, const std::string &token, const std::string &description, unsigned minnum=0, unsigned maxnum=0) |
| Adds a series of parameters to be parsed on the commandline. More... | |
| void | alias (const std::string &to, const std::string &from) |
Gives an alternative name (token) to to the parameter of token from. More... | |
| void | parse () |
| Parses the commandline arguments (argc, argv) and fills in the registered parameters variables. More... | |
| void | check () |
| Check all needed parameters are filled in, and series numbers are OK. More... | |
Additional Inherited Members | |
Public Types inherited from carto::OptionsParser | |
| typedef std::vector< std::string > | CommandLineArguments |
Protected Types inherited from carto::OptionsParser | |
| typedef std::vector< OptionBase *> | OptionList |
Protected Member Functions inherited from carto::OptionsParser | |
| void | pushOption (OptionBase *) |
Protected Attributes inherited from carto::OptionsParser | |
| CommandLineArguments | cla |
| OptionList | options |
| int | insertIndex |
Cartograph options parser.
Common options such as "--help", "--info" and "--version" are added. CartoApplication also requires a (short) documentation.
Usage: instantiate CartoApplication, add options using addOption(), then call initialize() to parse commandline options.
initialize() should always been called within a try..catch block, and the exception carto::user_interruption should be catched because it is thrown whenever the help is required (–help option).
| carto::CartoApplication::CartoApplication | ( | int | argc, |
| const char ** | argv, | ||
| const std::string & | documentation | ||
| ) |
|
virtual |
|
virtual |
Parse and check all parameters, and handle common options (such as the "--help" option).
initialize() also triggers loading plugins because some functionalities provided as plugins may be needed to correctly handle some options.