class SG_EXPORT osg::ArgumentParser


Public Classes

class Parameter
[more]enum ErrorSeverity

Public Methods

[more]static bool isOption(const char* str)
return return true if specified string is an option in the form of -option or --option
[more]static bool isString(const char* str)
return return true if string is any other string apart from an option
[more]static bool isNumber(const char* str)
return return true if specified parameter is an number
[more] ArgumentParser(int* argc, char** argv)
[more]void setApplicationUsage(ApplicationUsage* usage)
[more]ApplicationUsage* getApplicationUsage()
[more]const ApplicationUsage* getApplicationUsage() const
[more]int& argc()
return the argument count
[more]char** argv()
return the argument array
[more]char* operator [] (int pos)
return char* argument at specificed position
[more]const char* operator [] (int pos) const
return const char* argument at specificed position
[more]std::string getApplicationName() const
return the application name, as specified by argv[0]
[more]int find(const std::string& str) const
return the position of an occurance of a string in the argument list.
[more]bool isOption(int pos) const
return return true if specified parameter is an option in the form of -option or --option
[more]bool isString(int pos) const
return return true if specified parameter is an string, which can be any other string apart from an option
[more]bool isNumber(int pos) const
return return true if specified parameter is an number
[more]bool containsOptions() const
[more]void remove(int pos, int num=1)
remove one or more arguments from the argv argument list, and decrement the argc respectively
[more]bool match(int pos, const std::string& str) const
return true if specified argument matches string
[more]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
[more]bool read(const std::string& str, Parameter value1)
[more]bool read(const std::string& str, Parameter value1, Parameter value2)
[more]bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3)
[more]bool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)
[more]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
[more]bool read(int pos, const std::string& str, Parameter value1)
[more]bool read(int pos, const std::string& str, Parameter value1, Parameter value2)
[more]bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3)
[more]bool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)
[more]bool errors(ErrorSeverity severity=BENIGN) const
return the error flag, true if an error has occured when reading arguments
[more]void reportError(const std::string& message, ErrorSeverity severity=CRITICAL)
report an error message by adding to the ErrorMessageMap
[more]void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN)
for each remaining option report it as an unrecongnized
[more]ErrorMessageMap& getErrorMessageMap()
return the error message, if any has occured
[more]const ErrorMessageMap& getErrorMessageMap() const
return the error message, if any has occured
[more]void writeErrorMessages(std::ostream& output, ErrorSeverity sevrity=BENIGN)
write out error messages at an above specified

Public

[more]typedef std::map<std::string,ErrorSeverity> ErrorMessageMap

Protected Fields

[more]int* _argc
[more]char** _argv
[more]ErrorMessageMap _errorMessageMap
[more]ApplicationUsage* _usage


Documentation

ostatic bool isOption(const char* str)
return return true if specified string is an option in the form of -option or --option

ostatic bool isString(const char* str)
return return true if string is any other string apart from an option

ostatic bool isNumber(const char* str)
return return true if specified parameter is an number

o ArgumentParser(int* argc, char** argv)

ovoid setApplicationUsage(ApplicationUsage* usage)

oApplicationUsage* getApplicationUsage()

oconst ApplicationUsage* getApplicationUsage() const

oint& argc()
return the argument count

ochar** argv()
return the argument array

ochar* operator [] (int pos)
return char* argument at specificed position

oconst char* operator [] (int pos) const
return const char* argument at specificed position

ostd::string getApplicationName() const
return the application name, as specified by argv[0]

oint 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.

obool isOption(int pos) const
return return true if specified parameter is an option in the form of -option or --option

obool isString(int pos) const
return return true if specified parameter is an string, which can be any other string apart from an option

obool isNumber(int pos) const
return return true if specified parameter is an number

obool containsOptions() const

ovoid remove(int pos, int num=1)
remove one or more arguments from the argv argument list, and decrement the argc respectively

obool match(int pos, const std::string& str) const
return true if specified argument matches string

obool 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

obool read(const std::string& str, Parameter value1)

obool read(const std::string& str, Parameter value1, Parameter value2)

obool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3)

obool read(const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)

obool 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

obool read(int pos, const std::string& str, Parameter value1)

obool read(int pos, const std::string& str, Parameter value1, Parameter value2)

obool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3)

obool read(int pos, const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)

oenum ErrorSeverity

o BENIGN

o CRITICAL

otypedef std::map<std::string,ErrorSeverity> ErrorMessageMap

obool errors(ErrorSeverity severity=BENIGN) const
return the error flag, true if an error has occured when reading arguments

ovoid reportError(const std::string& message, ErrorSeverity severity=CRITICAL)
report an error message by adding to the ErrorMessageMap

ovoid reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN)
for each remaining option report it as an unrecongnized

oErrorMessageMap& getErrorMessageMap()
return the error message, if any has occured

oconst ErrorMessageMap& getErrorMessageMap() const
return the error message, if any has occured

ovoid writeErrorMessages(std::ostream& output, ErrorSeverity sevrity=BENIGN)
write out error messages at an above specified

oint* _argc

ochar** _argv

oErrorMessageMap _errorMessageMap

oApplicationUsage* _usage


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.