Public Types | |
typedef std::map< std::string, ErrorSeverity > | ErrorMessageMap |
enum | ErrorSeverity { BENIGN = 0, CRITICAL = 1 } |
Public Member Functions | |
ArgumentParser (int *argc, char **argv) | |
void | setApplicationUsage (ApplicationUsage *usage) |
ApplicationUsage * | getApplicationUsage () |
const ApplicationUsage * | getApplicationUsage () const |
int & | argc () |
char ** | argv () |
char * | operator[] (int pos) |
const char * | operator[] (int pos) const |
std::string | getApplicationName () const |
int | find (const std::string &str) const |
bool | isOption (int pos) const |
bool | isString (int pos) const |
bool | isNumber (int pos) const |
bool | containsOptions () const |
void | remove (int pos, int num=1) |
bool | match (int pos, const std::string &str) const |
bool | read (const std::string &str) |
bool | read (const std::string &str, Parameter value1) |
bool | read (const std::string &str, Parameter value1, Parameter value2) |
bool | read (const std::string &str, Parameter value1, Parameter value2, Parameter value3) |
bool | read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4) |
bool | read (int pos, const std::string &str) |
bool | read (int pos, const std::string &str, Parameter value1) |
bool | read (int pos, const std::string &str, Parameter value1, Parameter value2) |
bool | read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3) |
bool | read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4) |
bool | errors (ErrorSeverity severity=BENIGN) const |
void | reportError (const std::string &message, ErrorSeverity severity=CRITICAL) |
void | reportRemainingOptionsAsUnrecognized (ErrorSeverity severity=BENIGN) |
ErrorMessageMap & | getErrorMessageMap () |
const ErrorMessageMap & | getErrorMessageMap () const |
void | writeErrorMessages (std::ostream &output, ErrorSeverity sevrity=BENIGN) |
Static Public Member Functions | |
static bool | isOption (const char *str) |
static bool | isString (const char *str) |
static bool | isNumber (const char *str) |
Protected Attributes | |
int * | _argc |
char ** | _argv |
ErrorMessageMap | _errorMessageMap |
ApplicationUsage * | _usage |
Classes | |
class | Parameter |
|
|
|
|
|
|
|
Return the argument count. |
|
Return the argument array. |
|
|
|
Return the error flag, true if an error has occured when reading arguments. |
|
Return the position of an occurance of a string in the argument list. Return -1 if no string is found. |
|
Return the application name, as specified by argv[0] |
|
|
|
|
|
Return the error message, if any has occured. |
|
Return the error message, if any has occured. |
|
Return true if the specified parameter is a number. |
|
Return true if specified parameter is a number. |
|
Return true if the specified parameter is an option in the form of -option or --option. |
|
Return true if the specified string is an option in the form -option or --option. |
|
Return true if the specified parameter is a string not in the form of an option. |
|
Return true if string is non-NULL and not an option in the form -option or --option. |
|
Return true if the specified argument matches the given string. |
|
Return the const char* argument at the specified position. |
|
Return the char* argument at the specified position. |
|
|
|
|
|
|
|
|
|
If the argument value at the speciified position matches the given string, and subsequent parameters are also matched, then set the parameter values, remove the arguments from the list, and return true. Otherwise, return false. |
|
|
|
|
|
|
|
|
|
Search for an occurance of a string in the argument list. If found, remove that occurance and return true. Otherwise, return false. |
|
Remove one or more arguments from the argv argument list, and decrement the argc respectively. |
|
Report an error message by adding to the ErrorMessageMap. |
|
For each remaining option, report it as unrecognized. |
|
|
|
Write error messages to the given ostream, if at or above the given severiity. |
|
|
|
|
|
|
|
|