14 #ifndef OSG_ARGUMENTPARSER
15 #define OSG_ARGUMENTPARSER 1
18 #include <osg/ref_ptr>
19 #include <osg/ApplicationUsage>
54 Parameter(
bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; }
56 Parameter(
float& value) { _type = FLOAT_PARAMETER; _value._float = &value; }
58 Parameter(
double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; }
60 Parameter(
int& value) { _type = INT_PARAMETER; _value._int = &value; }
62 Parameter(
unsigned int& value) { _type = UNSIGNED_INT_PARAMETER; _value._uint = &value; }
64 Parameter(std::string& value) { _type = STRING_PARAMETER; _value._string = &value; }
70 bool valid(
const char* str)
const;
71 bool assign(
const char* str);
81 static bool isOption(
const char* str);
85 static bool isString(
const char* str);
88 static bool isNumber(
const char* str);
91 static bool isBool(
const char* str);
105 char**
argv() {
return _argv; }
108 char* operator [] (
int pos) {
return _argv[pos]; }
111 const char* operator [] (
int pos)
const {
return _argv[pos]; }
114 std::string getApplicationName()
const;
118 int find(
const std::string& str)
const;
122 bool isOption(
int pos)
const;
126 bool isString(
int pos)
const;
129 bool isNumber(
int pos)
const;
131 bool containsOptions()
const;
135 void remove(
int pos,
int num=1);
138 bool match(
int pos,
const std::string& str)
const;
142 bool read(
const std::string& str);
143 bool read(
const std::string& str, Parameter value1);
144 bool read(
const std::string& str, Parameter value1, Parameter value2);
145 bool read(
const std::string& str, Parameter value1, Parameter value2, Parameter value3);
146 bool read(
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4);
147 bool read(
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5);
148 bool read(
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6);
149 bool read(
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7);
150 bool read(
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
156 bool read(
int pos,
const std::string& str);
157 bool read(
int pos,
const std::string& str, Parameter value1);
158 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2);
159 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2, Parameter value3);
160 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4);
161 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5);
162 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6);
163 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7);
164 bool read(
int pos,
const std::string& str, Parameter value1, Parameter value2, Parameter value3, Parameter value4, Parameter value5, Parameter value6, Parameter value7, Parameter value8);
179 void reportError(
const std::string& message,
ErrorSeverity severity=CRITICAL);
182 void reportRemainingOptionsAsUnrecognized(
ErrorSeverity severity=BENIGN);
191 void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN);
const ApplicationUsage * getApplicationUsage() const
Parameter(std::string &value)
ErrorMessageMap & getErrorMessageMap()
ApplicationUsage * getApplicationUsage()
ErrorMessageMap _errorMessageMap
const ErrorMessageMap & getErrorMessageMap() const
std::map< std::string, ErrorSeverity > ErrorMessageMap
Parameter(const Parameter ¶m)
void setApplicationUsage(ApplicationUsage *usage)
ref_ptr< ApplicationUsage > _usage
Parameter(unsigned int &value)