Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4860 in orxonox.OLD for orxonox/trunk/src/util/loading/load_param.cc


Ignore:
Timestamp:
Jul 14, 2005, 1:04:21 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: made bool's loadable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/loading/load_param.cc

    r4836 r4860  
    113113}
    114114
     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 */
     121bool 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}
    115131
    116132int isInt(const char* INT, int defaultValue)
Note: See TracChangeset for help on using the changeset viewer.