#include <ArgumentParser.h>
Inheritance diagram for ArgumentParser:

Public Types | |
| typedef std::vector< std::string > | StringContainer |
Public Member Functions | |
| ArgumentParser () | |
| virtual | ~ArgumentParser () |
| bool | parseArguments (int argc, char **argv) |
| char * | getCstringValue (std::string name) |
| void | setDescription (const char *description) |
| void | setVersion (const char *version) |
| template<class T> | |
| T | getValue (std::string name) |
| void | clean () |
Protected Member Functions | |
| virtual void | showHelp (bool quit=true, const char *custMessage=0) |
| virtual void | showHelpAppendix ()=0 |
| void | showError (StringContainer parts) |
| void | showError (const char *message) |
| void | showVersion (bool quit=false) |
| void | setDelimiter (const char *new_var) |
| char * | getDelimiter () |
| void | addArgument (const char *name, const char *description, bool required, const char *def) |
Definition at line 21 of file ArgumentParser.h.
| typedef std::vector<std::string> ArgumentParser::StringContainer |
Definition at line 25 of file ArgumentParser.h.
| ArgumentParser::ArgumentParser | ( | ) |
Empty Constructor
| virtual ArgumentParser::~ArgumentParser | ( | ) | [virtual] |
Empty Destructor
| bool ArgumentParser::parseArguments | ( | int | argc, | |
| char ** | argv | |||
| ) |
Parse command line arguments
| argc | Argument count | |
| argv | Array of arguments. |
| char* ArgumentParser::getCstringValue | ( | std::string | name | ) |
Return char*
| name | Argument name |
| void ArgumentParser::setDescription | ( | const char * | description | ) |
Set program description
| description | Program description |
| void ArgumentParser::setVersion | ( | const char * | version | ) |
Set program version
| version | String describing program version |
| T ArgumentParser::getValue | ( | std::string | name | ) | [inline] |
Template for prasing cstrings.
| name | Argument name. |
Definition at line 69 of file ArgumentParser.h.
References showHelp().
| void ArgumentParser::clean | ( | ) |
Free malloced memory.
| virtual void ArgumentParser::showHelp | ( | bool | quit = true, |
|
| const char * | custMessage = 0 | |||
| ) | [protected, virtual] |
Show help
| quit | if is true then function call exit(0) on end | |
| custMessage | Custom message to show on the top of help |
Referenced by getValue().
| virtual void ArgumentParser::showHelpAppendix | ( | ) | [protected, pure virtual] |
This method is called after help is showed.
| void ArgumentParser::showError | ( | StringContainer | parts | ) | [protected] |
Show help message and quit
| parts | vector containing parts of error message |
| void ArgumentParser::showError | ( | const char * | message | ) | [protected] |
Show help message and quit
| message | error message |
| void ArgumentParser::showVersion | ( | bool | quit = false |
) | [protected] |
Show version
| quit | if is true then function call exit(1) on end |
| void ArgumentParser::setDelimiter | ( | const char * | new_var | ) | [protected] |
Set the value of delimiter_ Arguments delimiter.
| new_var | the new value of m_delimiter_ |
| char* ArgumentParser::getDelimiter | ( | ) | [protected] |
Get the value of delimiter_ Arguments delimiter.
| void ArgumentParser::addArgument | ( | const char * | name, | |
| const char * | description, | |||
| bool | required, | |||
| const char * | def | |||
| ) | [protected] |
Add argument
| name | Argument name | |
| description | Argument description | |
| required | True if argument is required | |
| def | Default value like cstring ( char* ) |
1.5.2