#include <argumentParser.h>

Public Member Functions | |
| ArgumentParser (const string &helpstr="", char hlpShrt='h', const string &hlpLng="help") | |
| Constructor using a global help string. | |
| template<class T > | |
| ArgumentParser & | option (T *ptr, char sho, char *lon, char *help) |
| Declare an optional argument. | |
| template<class T > | |
| ArgumentParser & | parameter (T *ptr, char sho, char *lon, char *help) |
| Declare a mandatory argument. | |
| void | operator() (int argc, char **argv) |
| Parse a command line. | |
| void | operator() (std::list< std::string > str) |
| ArgumentParser (const string &helpstr="", char hlpShrt='h', const string &hlpLng="help") | |
| Constructor using a global help string. | |
| template<class T > | |
| ArgumentParser & | option (T *ptr, char sho, char *lon, char *help) |
| Declare an optional argument. | |
| template<class T > | |
| ArgumentParser & | parameter (T *ptr, char sho, char *lon, char *help) |
| Declare a mandatory argument. | |
| void | operator() (int argc, char **argv) |
| Parse a command line. | |
| void | operator() (std::list< std::string > str) |
Private Types | |
| typedef std::string | string |
| String. | |
| typedef std::map< string, ArgumentBase * > | Map |
| Associate a string with a Argument object. | |
| typedef std::map< ArgumentBase *, bool > | SetMap |
| Associate name with boolean value (true iff it is set). | |
| typedef std::vector < ArgumentBase * > | ArgVec |
| Set of commands. | |
| typedef std::string | string |
| String. | |
| typedef std::map< string, ArgumentBase * > | Map |
| Associate a string with a Argument object. | |
| typedef std::map< ArgumentBase *, bool > | SetMap |
| Associate name with boolean value (true iff it is set). | |
| typedef std::vector < ArgumentBase * > | ArgVec |
| Set of commands. | |
Private Attributes | |
| std::map< char, ArgumentBase * > | shortName |
| short name -> Argument object | |
| Map | longName |
| long name -> Argument object | |
| SetMap | parameter_set |
| Set map (bool true iff parameter is set). | |
| ArgVec | commands |
| Set of commands. | |
| string | globalHelp |
| Overall presentation. | |
| char | helpShortName |
| short name for help | |
| string | helpLongName |
| long name for help | |
This object parses arguments from a command line or from an input stream. The arguments are described using a pointer, a short name, a long name and a help message. Mandatory arguments are declared using method "parameter", optional arguments are declared using method "option". Once all arguments declared, operator () does the parsing. The special option -h or --help displays help on all arguments. See examples argumentParserLine_test.cpp and argumentParserFile_test.cpp
Definition at line 190 of file argumentParser.h.
typedef std::vector<ArgumentBase*> ArgumentParser::ArgVec [private] |
typedef std::vector<ArgumentBase*> ArgumentParser::ArgVec [private] |
typedef std::map< string, ArgumentBase* > ArgumentParser::Map [private] |
typedef std::map< string, ArgumentBase* > ArgumentParser::Map [private] |
typedef std::map<ArgumentBase*,bool> ArgumentParser::SetMap [private] |
Associate name with boolean value (true iff it is set).
Definition at line 203 of file argumentParser.h.
typedef std::map<ArgumentBase*,bool> ArgumentParser::SetMap [private] |
Associate name with boolean value (true iff it is set).
Definition at line 201 of file argumentParser.h.
typedef std::string ArgumentParser::string [private] |
typedef std::string ArgumentParser::string [private] |
| void ArgumentParser::operator() | ( | std::list< std::string > | str | ) | [inline] |
Definition at line 314 of file argumentParser.h.
References commands, globalHelp, helpLongName, helpShortName, longName, parameter_set, and shortName.
| void ArgumentParser::operator() | ( | int | argc, | |
| char ** | argv | |||
| ) | [inline] |
Parse a command line.
| argc | number of arguments + 1, as usual in C | |
| argv | arguments |
Definition at line 306 of file argumentParser.h.
| void ArgumentParser::operator() | ( | std::list< std::string > | str | ) | [inline] |
Definition at line 312 of file argumentParser.h.
References commands, globalHelp, helpLongName, helpShortName, longName, parameter_set, and shortName.
| void ArgumentParser::operator() | ( | int | argc, | |
| char ** | argv | |||
| ) | [inline] |
Parse a command line.
| argc | number of arguments + 1, as usual in C | |
| argv | arguments |
Definition at line 304 of file argumentParser.h.
| ArgumentParser& ArgumentParser::option | ( | T * | ptr, | |
| char | sho, | |||
| char * | lon, | |||
| char * | help | |||
| ) | [inline] |
Declare an optional argument.
| ptr | pointer to the variable | |
| sho | short name | |
| lon | long name | |
| help |
Definition at line 234 of file argumentParser.h.
References commands, helpLongName, helpShortName, longName, and shortName.
| ArgumentParser& ArgumentParser::option | ( | T * | ptr, | |
| char | sho, | |||
| char * | lon, | |||
| char * | help | |||
| ) | [inline] |
Declare an optional argument.
| ptr | pointer to the variable | |
| sho | short name | |
| lon | long name | |
| help |
Definition at line 232 of file argumentParser.h.
References commands, helpLongName, helpShortName, longName, and shortName.
Referenced by main().
| ArgumentParser& ArgumentParser::parameter | ( | T * | ptr, | |
| char | sho, | |||
| char * | lon, | |||
| char * | help | |||
| ) | [inline] |
Declare a mandatory argument.
| ptr | pointer to the variable | |
| sho | short name | |
| lon | long name | |
| help |
Definition at line 271 of file argumentParser.h.
References commands, helpLongName, helpShortName, longName, and shortName.
| ArgumentParser& ArgumentParser::parameter | ( | T * | ptr, | |
| char | sho, | |||
| char * | lon, | |||
| char * | help | |||
| ) | [inline] |
Declare a mandatory argument.
| ptr | pointer to the variable | |
| sho | short name | |
| lon | long name | |
| help |
Definition at line 269 of file argumentParser.h.
References commands, helpLongName, helpShortName, longName, and shortName.
ArgVec ArgumentParser::commands [private] |
Set of commands.
Definition at line 209 of file argumentParser.h.
Referenced by operator()(), option(), and parameter().
string ArgumentParser::globalHelp [private] |
string ArgumentParser::helpLongName [private] |
long name for help
Definition at line 214 of file argumentParser.h.
Referenced by operator()(), option(), and parameter().
char ArgumentParser::helpShortName [private] |
short name for help
Definition at line 213 of file argumentParser.h.
Referenced by operator()(), option(), and parameter().
Map ArgumentParser::longName [private] |
long name -> Argument object
Definition at line 198 of file argumentParser.h.
Referenced by operator()(), option(), and parameter().
SetMap ArgumentParser::parameter_set [private] |
Set map (bool true iff parameter is set).
Definition at line 204 of file argumentParser.h.
Referenced by operator()().
std::map< char, ArgumentBase * > ArgumentParser::shortName [private] |
short name -> Argument object
Definition at line 196 of file argumentParser.h.
Referenced by operator()(), option(), and parameter().
1.5.7.1