Changeset 5331 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- Oct 8, 2005, 11:26:53 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/helper_functions.cc
r5329 r5331 22 22 23 23 /** 24 * checks if the input was a Bool25 * @param BOOL a String that holds a bool: must be one of those: 1,0,true,false ,TRUE,FALSE24 * checks if the input was a bool 25 * @param BOOL a String that holds a bool: must be one of those: 1,0,true,false(case-insensitive) 26 26 * @param defaultValue a default value that is set, if BOOL is corrupt 27 27 * @return returns the bool, if BOOL was correct otherwise defaultValue … … 31 31 if (BOOL == NULL) 32 32 return defaultValue; 33 if(!strcmp(BOOL, "1") || !strc mp( BOOL,"true") || !strcmp(BOOL,"TRUE"))33 if(!strcmp(BOOL, "1") || !strcasecmp( BOOL, "true") ) 34 34 return true; 35 else if (!strcmp(BOOL, "0") || !strc mp( BOOL,"false") || !strcmp(BOOL,"FALSE"))35 else if (!strcmp(BOOL, "0") || !strcasecmp( BOOL, "false")) 36 36 return false; 37 37 else … … 40 40 } 41 41 42 43 /** 44 * checks if the input was a int 45 * @param INT a String that holds an int. 46 * @param defaultValue a default value that is set, if INT is corrupt 47 * @return returns the contained int, if INT was correct otherwise defaultValue 48 */ 42 49 int isInt(const char* INT, int defaultValue) 43 50 { … … 54 61 } 55 62 63 64 /** 65 * checks if the input was a float 66 * @param FLOAT a String that holds an float. 67 * @param defaultValue a default value that is set, if FLOAT is corrupt 68 * @return returns the contained float, if FLOAT was correct otherwise defaultValue 69 */ 56 70 float isFloat(const char* FLOAT, float defaultValue) 57 71 { … … 68 82 69 83 84 /** 85 * checks if the input was a string 86 * @param STING a String(char-array) that holds an string. 87 * @param defaultValue a default value that is set, if STRING is corrupt 88 * @return returns the contained string (char-array), if STRING was correct otherwise defaultValue 89 */ 70 90 const char* isString(const char* STRING, const char* defaultValue) 71 91 {
Note: See TracChangeset
for help on using the changeset viewer.