Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5141 in orxonox.OLD for trunk/src/util/loading


Ignore:
Timestamp:
Aug 26, 2005, 4:04:53 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: moved helper-functions to helper-functions.cc

Location:
trunk/src/util/loading
Files:
2 edited

Legend:

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

    r5115 r5141  
    112112  }
    113113}
    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 }
    131 
    132 int isInt(const char* INT, int defaultValue)
    133 {
    134   char* endPtr = NULL;
    135   int result = strtol(INT, &endPtr, 10);
    136 
    137   if ( endPtr >= INT && endPtr < INT + strlen(INT))
    138     return defaultValue;
    139   else
    140     return result;
    141 }
    142 
    143 float isFloat(const char* FLOAT, float defaultValue)
    144 {
    145   char* endPtr = NULL;
    146   double result = strtod(FLOAT, &endPtr);
    147 
    148   if ( endPtr >= FLOAT && endPtr < FLOAT + strlen(FLOAT))
    149     return defaultValue;
    150   else
    151     return result;
    152 }
    153 
    154 const Vector& isVector(const char* VECTOR, const Vector& defaultValue)
    155 {
    156 
    157 
    158 }
    159 
    160 const char* isString(const char* STRING, const char* defaultValue)
    161 {
    162   if (STRING != NULL)
    163     return STRING;
    164   else
    165     return defaultValue;
    166 }
    167 
    168114
    169115/**
  • trunk/src/util/loading/load_param.h

    r5137 r5141  
    2828#include "substring.h"
    2929#include "tinyxml.h"
     30#include "helper_functions.h"
    3031
    3132// Forward Declaration //
     
    216217        PRINTF(4)("Not loaded parameter %s of %s\n", paramName, pt2Object->getClassName()); \
    217218}
    218 
    219 
    220 /***********************
    221 *** HELPER FUNCTIONS ***
    222 ***********************/
    223 bool          isBool(const char* BOOL, bool defaultValue);
    224 int           isInt(const char* INT, int defaultValue);
    225 float         isFloat(const char* FLOAT, float defaultValue);
    226 //const Vector& isVector(const char* VECTOR, const Vector& defaultValue);
    227 const char*   isString(const char* STRING, const char* defaultValue);
    228 
    229 //TiXmlEmlemnt* isXmlElem(const)
    230 
    231219
    232220/************************
Note: See TracChangeset for help on using the changeset viewer.