Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# osg::ArgumentParser Class Reference

List of all members.

## 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 ()
| Return the argument count.
char ** | argv ()
| Return the argument array.
char * | operator[] (int pos)
| Return the char* argument at the specified position.
const char * | operator[] (int pos) const
| Return the const char* argument at the specified 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 true if the specified parameter is an option in the form of -option or --option.
bool | isString (int pos) const
| Return true if the specified parameter is a string not in the form of an option.
bool | isNumber (int pos) const
| Return true if the specified parameter is a 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 the specified argument matches the given string.
bool | read (const std::string &str)
| Search for an occurance of a string in the argument list.
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 (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5)
bool | read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6)
bool | read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7)
bool | read (const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8)
bool | read (int pos, const std::string &str)
| If the argument value at the specified 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.
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 | read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5)
bool | read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6)
bool | read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7)
bool | read (int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8)
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 unrecognized.
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 error messages to the given ostream, if at or above the given severiity.
## Static Public Member Functions
bool | isOption (const char *str)
| Return true if the specified string is an option in the form -option or --option.
bool | isString (const char *str)
| Return true if string is non-NULL and not an option in the form -option or --option.
bool | isNumber (const char *str)
| Return true if specified parameter is a number.
## Protected Attributes
int * | _argc
char ** | _argv
ErrorMessageMap | _errorMessageMap
ApplicationUsage * | _usage

## Member Typedef Documentation

typedef std::map<std::string,ErrorSeverity> osg::ArgumentParser::ErrorMessageMap

## Member Enumeration Documentation

enum osg::ArgumentParser::ErrorSeverity

  | Enumeration values:
  BENIGN |
  CRITICAL |

## Constructor & Destructor Documentation

osg::ArgumentParser::ArgumentParser | ( | int * | argc,
|  | char ** | argv
| ) |

## Member Function Documentation

int& osg::ArgumentParser::argc | ( |  | ) | `[inline]`

| Return the argument count.

char** osg::ArgumentParser::argv | ( |  | ) | `[inline]`

| Return the argument array.

bool osg::ArgumentParser::containsOptions | ( |  | ) | const

bool osg::ArgumentParser::errors | ( | ErrorSeverity | severity = BENIGN | ) | const

| Return the error flag, true if an error has occured when reading arguments.

int osg::ArgumentParser::find | ( | const std::string & | str | ) | const

| Return the position of an occurance of a string in the argument list. Return -1 if no string is found.

std::string osg::ArgumentParser::getApplicationName | ( |  | ) | const

| Return the application name, as specified by argv[0].

const ApplicationUsage* osg::ArgumentParser::getApplicationUsage | ( |  | ) | const`[inline]`

ApplicationUsage* osg::ArgumentParser::getApplicationUsage | ( |  | ) | `[inline]`

const ErrorMessageMap& osg::ArgumentParser::getErrorMessageMap | ( |  | ) | const`[inline]`

| Return the error message, if any has occured.

ErrorMessageMap& osg::ArgumentParser::getErrorMessageMap | ( |  | ) | `[inline]`

| Return the error message, if any has occured.

bool osg::ArgumentParser::isNumber | ( | int | pos | ) | const

| Return true if the specified parameter is a number.

bool osg::ArgumentParser::isNumber | ( | const char * | str | ) | `[static]`

| Return true if specified parameter is a number.

bool osg::ArgumentParser::isOption | ( | int | pos | ) | const

| Return true if the specified parameter is an option in the form of -option or --option.

bool osg::ArgumentParser::isOption | ( | const char * | str | ) | `[static]`

| Return true if the specified string is an option in the form -option or --option.

bool osg::ArgumentParser::isString | ( | int | pos | ) | const

| Return true if the specified parameter is a string not in the form of an option.

bool osg::ArgumentParser::isString | ( | const char * | str | ) | `[static]`

| Return true if string is non-NULL and not an option in the form -option or --option.

bool osg::ArgumentParser::match | ( | int | pos,
|  | const std::string & | str
| ) | const

| Return true if the specified argument matches the given string.

const char* osg::ArgumentParser::operator[] | ( | int | pos | ) | const`[inline]`

| Return the const char* argument at the specified position.

char* osg::ArgumentParser::operator[] | ( | int | pos | ) | `[inline]`

| Return the char* argument at the specified position.

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5,
|  | Parameter | value6,
|  | Parameter | value7,
|  | Parameter | value8
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5,
|  | Parameter | value6,
|  | Parameter | value7
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5,
|  | Parameter | value6
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str,
|  | Parameter | value1
| ) |

bool osg::ArgumentParser::read | ( | int | pos,
|  | const std::string & | str
| ) |

| If the argument value at the specified 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.

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5,
|  | Parameter | value6,
|  | Parameter | value7,
|  | Parameter | value8
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5,
|  | Parameter | value6,
|  | Parameter | value7
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5,
|  | Parameter | value6
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4,
|  | Parameter | value5
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3,
|  | Parameter | value4
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2,
|  | Parameter | value3
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1,
|  | Parameter | value2
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str,
|  | Parameter | value1
| ) |

bool osg::ArgumentParser::read | ( | const std::string & | str | ) |

| Search for an occurance of a string in the argument list. If found, remove that occurance and return true. Otherwise, return false.

void osg::ArgumentParser::remove | ( | int | pos,
|  | int | num = 1
| ) |

| Remove one or more arguments from the argv argument list, and decrement the argc respectively.

void osg::ArgumentParser::reportError | ( | const std::string & | message,
|  | ErrorSeverity | severity = CRITICAL
| ) |

| Report an error message by adding to the ErrorMessageMap.

void osg::ArgumentParser::reportRemainingOptionsAsUnrecognized | ( | ErrorSeverity | severity = BENIGN | ) |

| For each remaining option, report it as unrecognized.

void osg::ArgumentParser::setApplicationUsage | ( | ApplicationUsage * | usage | ) | `[inline]`

void osg::ArgumentParser::writeErrorMessages | ( | std::ostream & | output,
|  | ErrorSeverity | sevrity = BENIGN
| ) |

| Write error messages to the given ostream, if at or above the given severiity.

## Member Data Documentation

int* osg::ArgumentParser::_argc`[protected]`

char** osg::ArgumentParser::_argv`[protected]`

ErrorMessageMap osg::ArgumentParser::_errorMessageMap`[protected]`

ApplicationUsage* osg::ArgumentParser::_usage`[protected]`

The documentation for this class was generated from the following file:

- ArgumentParser