14#ifndef OSG_ARGUMENTPARSER
15#define OSG_ARGUMENTPARSER 1
70 bool valid(
const char* str)
const;
108 char* operator [] (
int pos) {
return _argv[pos]; }
111 const char* operator [] (
int pos)
const {
return _argv[pos]; }
118 int find(
const std::string& str)
const;
138 bool match(
int pos,
const std::string& str)
const;
142 bool read(
const std::string& str);
156 bool read(
int pos,
const std::string& str);
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Definition ApplicationUsage:26
Type
Definition ApplicationUsage:48
ApplicationUsage::Type readHelpType()
This convenience method handles help requests on the command line.
std::string getApplicationName() const
Return the application name, as specified by argv[0].
static bool isString(const char *str)
Return true if string is non-NULL and not an option in the form -option or –option.
int & argc()
Return the argument count.
Definition ArgumentParser:102
static bool isOption(const char *str)
Return true if the specified string is an option in the form -option or –option.
void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN)
For each remaining option, report it as unrecognized.
bool read(const std::string &str)
Search for an occurrence of a string in the argument list.
bool read(int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5)
void writeErrorMessages(std::ostream &output, ErrorSeverity sevrity=BENIGN)
Write error messages to the given ostream, if at or above the given severity.
char ** _argv
Definition ArgumentParser:205
bool read(const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)
ApplicationUsage * getApplicationUsage()
Definition ArgumentParser:98
bool read(int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6)
bool isNumber(int pos) const
Return true if the specified parameter is a number.
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, 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(const std::string &str, Parameter value1, Parameter value2)
ErrorMessageMap _errorMessageMap
Definition ArgumentParser:206
bool read(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)
char ** argv()
Return the argument array.
Definition ArgumentParser:105
bool read(int pos, const std::string &str, Parameter value1, Parameter value2)
const ErrorMessageMap & getErrorMessageMap() const
Return the error message, if any has occurred.
Definition ArgumentParser:188
bool read(int pos, const std::string &str)
If the argument value at the specified position matches the given string, and subsequent parameters a...
bool read(int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4)
bool read(const std::string &str, Parameter value1)
bool read(int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8)
static bool isNumber(const char *str)
Return true if specified parameter is a number.
const ApplicationUsage * getApplicationUsage() const
Definition ArgumentParser:99
void reportError(const std::string &message, ErrorSeverity severity=CRITICAL)
Report an error message by adding to the ErrorMessageMap.
int find(const std::string &str) const
Return the position of an occurrence of a string in the argument list.
bool read(int pos, const std::string &str, Parameter value1, Parameter value2, Parameter value3)
bool read(const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8)
ErrorMessageMap & getErrorMessageMap()
Return the error message, if any has occurred.
Definition ArgumentParser:185
ErrorSeverity
Definition ArgumentParser:168
@ CRITICAL
Definition ArgumentParser:170
@ BENIGN
Definition ArgumentParser:169
bool isString(int pos) const
Return true if the specified parameter is a string not in the form of an option.
bool isOption(int pos) const
Return true if the specified parameter is an option in the form of -option or –option.
bool errors(ErrorSeverity severity=BENIGN) const
Return the error flag, true if an error has occurred when reading arguments.
bool containsOptions() const
int * _argc
Definition ArgumentParser:204
bool read(const std::string &str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5)
void setApplicationUsage(ApplicationUsage *usage)
Definition ArgumentParser:97
ArgumentParser(int *argc, char **argv)
void remove(int pos, int num=1)
Remove one or more arguments from the argv argument list, and decrement the argc respectively.
ref_ptr< ApplicationUsage > _usage
Definition ArgumentParser:207
static bool isBool(const char *str)
Return true if specified parameter is a bool.
bool read(const std::string &str, Parameter value1, Parameter value2, Parameter value3)
std::map< std::string, ErrorSeverity > ErrorMessageMap
Definition ArgumentParser:173
Definition ArgumentParser:32
Parameter(float &value)
Definition ArgumentParser:56
Parameter(bool &value)
Definition ArgumentParser:54
bool assign(const char *str)
Parameter(int &value)
Definition ArgumentParser:60
ValueUnion _value
Definition ArgumentParser:76
Parameter(unsigned int &value)
Definition ArgumentParser:62
bool valid(const char *str) const
Parameter(double &value)
Definition ArgumentParser:58
Parameter(std::string &value)
Definition ArgumentParser:64
ParameterType
Definition ArgumentParser:35
@ INT_PARAMETER
Definition ArgumentParser:39
@ DOUBLE_PARAMETER
Definition ArgumentParser:38
@ FLOAT_PARAMETER
Definition ArgumentParser:37
@ BOOL_PARAMETER
Definition ArgumentParser:36
@ UNSIGNED_INT_PARAMETER
Definition ArgumentParser:40
@ STRING_PARAMETER
Definition ArgumentParser:41
Parameter(const Parameter ¶m)
Definition ArgumentParser:66
ParameterType _type
Definition ArgumentParser:75
Definition ArgumentParser:45
bool * _bool
Definition ArgumentParser:46
std::string * _string
Definition ArgumentParser:51
int * _int
Definition ArgumentParser:49
float * _float
Definition ArgumentParser:47
unsigned int * _uint
Definition ArgumentParser:50
double * _double
Definition ArgumentParser:48
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
#define OSG_EXPORT
Definition Export:39