Changeset 4734 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jun 29, 2005, 3:05:47 PM (20 years ago)
- Location:
- orxonox/trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/loading/load_param.cc
r4637 r4734 114 114 115 115 116 int isInt(const char* I nt, int defaultValue)116 int isInt(const char* INT, int defaultValue) 117 117 { 118 118 char* endPtr = NULL; 119 int result = strtol(I nt, &endPtr, 10);120 121 if ( endPtr >= I nt && endPtr < Int + strlen(Int))119 int result = strtol(INT, &endPtr, 10); 120 121 if ( endPtr >= INT && endPtr < INT + strlen(INT)) 122 122 return defaultValue; 123 123 else … … 125 125 } 126 126 127 float isFloat(const char* F loat, float defaultValue)127 float isFloat(const char* FLOAT, float defaultValue) 128 128 { 129 129 char* endPtr = NULL; 130 double result = strtod(F loat, &endPtr);131 132 if ( endPtr >= F loat && endPtr < Float + strlen(Float))130 double result = strtod(FLOAT, &endPtr); 131 132 if ( endPtr >= FLOAT && endPtr < FLOAT + strlen(FLOAT)) 133 133 return defaultValue; 134 134 else … … 136 136 } 137 137 138 const char* isString(const char* string, const char* defaultValue) 139 { 140 if (string != NULL) 141 return string; 138 const Vector& isVector(const char* VECTOR, const Vector& defaultValue) 139 { 140 141 142 } 143 144 const char* isString(const char* STRING, const char* defaultValue) 145 { 146 if (STRING != NULL) 147 return STRING; 142 148 else 143 149 return defaultValue; -
orxonox/trunk/src/util/loading/load_param.h
r4726 r4734 23 23 24 24 #include "base_object.h" 25 #include "vector.h" 25 26 #include "factory.h" 26 27 #include "debug.h" … … 69 70 #define l_FLOAT_NAME "float" //!< The name of a FLOAT 70 71 #define l_FLOAT_DEFAULT 0.0 //!< a default Value for a FLOAT 72 73 //#define l_VECTOR_TYPE const Vector& //!< The type of a VECTOR 74 //#define l_VECTOR_FUNC isVector //!< The function to parse a VECTOR 75 //#define l_VECTOR_NAME "Vector[x/y/z]" //!< The name of a VECTOR 76 //#define l_VECTOR_DEFAULT Vector(0,0,0) //!< Default value for a VECTOR 71 77 72 78 #define l_STRING_TYPE const char* //!< The type of a STRING … … 230 236 *** HELPER FUNCTIONS *** 231 237 ***********************/ 232 int isInt(const char* Int, int defaultValue); 233 float isFloat(const char* Float, float defaultValue); 234 const char* isString(const char* string, const char* defaultValue); 238 int isInt(const char* INT, int defaultValue); 239 float isFloat(const char* FLOAT, float defaultValue); 240 //const Vector& isVector(const char* VECTOR, const Vector& defaultValue); 241 const char* isString(const char* STRING, const char* defaultValue); 242 235 243 //TiXmlEmlemnt* isXmlElem(const) 236 244 … … 346 354 LoadParam5(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); 347 355 356 //! makes functions with one Vector loadable 357 //LoadParam1(l_VECTOR); 358 348 359 // loads a Ti-XML-element 349 360 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(const TiXmlElement*), bool multi = false)
Note: See TracChangeset
for help on using the changeset viewer.