Changeset 13041 for OpenSceneGraph/trunk/include/osg/ArgumentParser
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/ArgumentParser (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/ArgumentParser
r11790 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 41 41 STRING_PARAMETER 42 42 }; 43 43 44 44 union ValueUnion 45 45 { … … 55 55 56 56 Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; } 57 57 58 58 Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; } 59 59 … … 61 61 62 62 Parameter(unsigned int& value) { _type = UNSIGNED_INT_PARAMETER; _value._uint = &value; } 63 63 64 64 Parameter(std::string& value) { _type = STRING_PARAMETER; _value._string = &value; } 65 65 … … 72 72 73 73 protected: 74 74 75 75 ParameterType _type; 76 76 ValueUnion _value; … … 80 80 * -option or --option. */ 81 81 static bool isOption(const char* str); 82 82 83 83 /** Return true if string is non-NULL and not an option in the form 84 84 * -option or --option. */ 85 85 static bool isString(const char* str); 86 86 87 87 /** Return true if specified parameter is a number. */ 88 88 static bool isNumber(const char* str); … … 121 121 * -option or --option. */ 122 122 bool isOption(int pos) const; 123 123 124 124 /** Return true if the specified parameter is a string not in 125 125 * the form of an option. */ 126 126 bool isString(int pos) const; 127 127 128 128 /** Return true if the specified parameter is a number. */ 129 129 bool isNumber(int pos) const; 130 130 131 131 bool containsOptions() const; 132 132 … … 134 134 * and decrement the argc respectively. */ 135 135 void remove(int pos,int num=1); 136 136 137 137 /** Return true if the specified argument matches the given string. */ 138 138 bool match(int pos, const std::string& str) const; … … 181 181 /** For each remaining option, report it as unrecognized. */ 182 182 void reportRemainingOptionsAsUnrecognized(ErrorSeverity severity=BENIGN); 183 183 184 184 /** Return the error message, if any has occurred. */ 185 185 ErrorMessageMap& getErrorMessageMap() { return _errorMessageMap; } 186 186 187 187 /** Return the error message, if any has occurred. */ 188 188 const ErrorMessageMap& getErrorMessageMap() const { return _errorMessageMap; } … … 191 191 void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN); 192 192 193 193 194 194 /** This convenience method handles help requests on the command line. 195 195 * Return the type(s) of help requested. The return value of this 196 196 * function is suitable for passing into getApplicationUsage()->write(). 197 * If ApplicationUsage::NO_HELP is returned then no help commandline option 197 * If ApplicationUsage::NO_HELP is returned then no help commandline option 198 198 * was found on the command line. */ 199 199 ApplicationUsage::Type readHelpType(); 200 200 201 201 202 202 protected: 203 203 204 204 int* _argc; 205 205 char** _argv; 206 206 ErrorMessageMap _errorMessageMap; 207 207 ref_ptr<ApplicationUsage> _usage; 208 208 209 209 }; 210 210
