Public Classes
-
class Parameter
-
enum ErrorSeverity
Public Methods
-
static bool isOption(const char* str)
- return return true if specified string is an option in the form of -option or --option
-
static bool isString(const char* str)
- return return true if string is any other string apart from an option
-
static bool isNumber(const char* str)
- return return true if specified parameter is an number
-
ArgumentParser(int* argc, char** argv)
-
void setApplicationUsage(ApplicationUsage* usage)
-
ApplicationUsage* getApplicationUsage()
-
const ApplicationUsage* getApplicationUsage() const
-
int& argc()
- return the argument count
-
char** argv()
- return the argument array
-
char* operator [] (int pos)
- return char* argument at specificed position
-
const char* operator [] (int pos) const
- return const char* argument at specificed position
-
std::string getApplicationName() const
- return the application name, as specified by argv[0]
-
int find(const std::string& str) const
- return the position of an occurance of a string in the argument list.
-
bool isOption(int pos) const
- return return true if specified parameter is an option in the form of -option or --option
-
bool isString(int pos) const
- return return true if specified parameter is an string, which can be any other string apart from an option
-
bool isNumber(int pos) const
- return return true if specified parameter is an number
-
bool containsOptions() const
-
void remove(int pos, int num=1)
- remove one or more arguments from the argv argument list, and decrement the argc respectively
-
bool match(int pos, const std::string& str) const
- return true if specified argument matches string
-
bool read(const std::string& str)
- search for an occurance of a string in the argument list, on sucess remove that occurance from the list and return true, otherwise return false
-
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)
- if the argument value at the position pos matches specified string, and subsequent paramters are also matched then set the paramter values and remove the from the list of arguments
-
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
- return the error flag, true if an error has occured when reading arguments
-
void reportError(const std::string& message, ErrorSeverity severity=CRITICAL)
- report an error message by adding to the ErrorMessageMap
-
void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN)
- for each remaining option report it as an unrecongnized
-
ErrorMessageMap& getErrorMessageMap()
- return the error message, if any has occured
-
const ErrorMessageMap& getErrorMessageMap() const
- return the error message, if any has occured
-
void writeErrorMessages(std::ostream& output, ErrorSeverity sevrity=BENIGN)
- write out error messages at an above specified
Public
-
typedef std::map<std::string,ErrorSeverity> ErrorMessageMap
Protected Fields
-
int* _argc
-
char** _argv
-
ErrorMessageMap _errorMessageMap
-
ApplicationUsage* _usage
Documentation
static bool isOption(const char* str)
- return return true if specified string is an option in the form of -option or --option
static bool isString(const char* str)
- return return true if string is any other string apart from an option
static bool isNumber(const char* str)
- return return true if specified parameter is an number
ArgumentParser(int* argc, char** argv)
void setApplicationUsage(ApplicationUsage* usage)
ApplicationUsage* getApplicationUsage()
const ApplicationUsage* getApplicationUsage() const
int& argc()
- return the argument count
char** argv()
- return the argument array
char* operator [] (int pos)
- return char* argument at specificed position
const char* operator [] (int pos) const
- return const char* argument at specificed position
std::string getApplicationName() const
- return the application name, as specified by argv[0]
int find(const std::string& str) const
- return the position of an occurance of a string in the argument list.
return -1 when no string is found.
bool isOption(int pos) const
- return return true if specified parameter is an option in the form of -option or --option
bool isString(int pos) const
- return return true if specified parameter is an string, which can be any other string apart from an option
bool isNumber(int pos) const
- return return true if specified parameter is an number
bool containsOptions() const
void remove(int pos, int num=1)
- remove one or more arguments from the argv argument list, and decrement the argc respectively
bool match(int pos, const std::string& str) const
- return true if specified argument matches string
bool read(const std::string& str)
- search for an occurance of a string in the argument list, on sucess
remove that occurance from the list and return true, otherwise return false
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)
- if the argument value at the position pos matches specified string, and subsequent
paramters are also matched then set the paramter values and remove the from the list of arguments
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)
enum ErrorSeverity
BENIGN
CRITICAL
typedef std::map<std::string,ErrorSeverity> ErrorMessageMap
bool errors(ErrorSeverity severity=BENIGN) const
- return the error flag, true if an error has occured when reading arguments
void reportError(const std::string& message, ErrorSeverity severity=CRITICAL)
- report an error message by adding to the ErrorMessageMap
void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN)
- for each remaining option report it as an unrecongnized
ErrorMessageMap& getErrorMessageMap()
- return the error message, if any has occured
const ErrorMessageMap& getErrorMessageMap() const
- return the error message, if any has occured
void writeErrorMessages(std::ostream& output, ErrorSeverity sevrity=BENIGN)
- write out error messages at an above specified
int* _argc
char** _argv
ErrorMessageMap _errorMessageMap
ApplicationUsage* _usage
- This class has no child classes.
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.