Changeset 4860 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jul 14, 2005, 1:04:21 AM (19 years ago)
- Location:
- orxonox/trunk/src/util/loading
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/loading/load_param.cc
r4836 r4860 113 113 } 114 114 115 /** 116 * checks if the input was a Bool 117 * @param BOOL a String that holds a bool: must be one of those: 1,0,true,false,TRUE,FALSE 118 * @param defaultValue a default value that is set, if BOOL is corrupt 119 * @return returns the bool, if BOOL was correct otherwise defaultValue 120 */ 121 bool isBool(const char* BOOL, bool defaultValue) 122 { 123 if(!strcmp(BOOL, "1") || !strcmp( BOOL,"true") || !strcmp(BOOL,"TRUE")) 124 return true; 125 else if (!strcmp(BOOL, "0") || !strcmp( BOOL,"false") || !strcmp(BOOL,"FALSE")) 126 return false; 127 else 128 return defaultValue; 129 130 } 115 131 116 132 int isInt(const char* INT, int defaultValue) -
orxonox/trunk/src/util/loading/load_param.h
r4836 r4860 70 70 */ 71 71 72 #define l_BOOL_TYPE bool //!< The type of an BOOL 73 #define l_BOOL_FUNC isBool //!< The function to call to parse BOOL 74 #define l_BOOL_NAME "bool" //!< The name of an BOOL 75 #define l_BOOL_DEFAULT 0 //!< a default Value for an BOOL 76 77 72 78 #define l_INT_TYPE int //!< The type of an INT 73 79 #define l_INT_FUNC isInt //!< The function to call to parse INT 74 80 #define l_INT_NAME "int" //!< The name of an INT 75 #define l_INT_DEFAULT 0//!< a default Value for an INT81 #define l_INT_DEFAULT true //!< a default Value for an INT 76 82 77 83 #define l_LONG_TYPE long //!< The type of a LONG … … 255 261 *** HELPER FUNCTIONS *** 256 262 ***********************/ 263 bool isBool(const char* BOOL, bool defaultValue); 257 264 int isInt(const char* INT, int defaultValue); 258 265 float isFloat(const char* FLOAT, float defaultValue); … … 353 360 LoadParam4(l_STRING, l_STRING, l_STRING, l_STRING); 354 361 362 //! makes functions with one bool loadeable 363 LoadParam1(l_BOOL); 364 355 365 //! makes functions with one int loadable 356 366 LoadParam1(l_INT);
Note: See TracChangeset
for help on using the changeset viewer.