Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4734 in orxonox.OLD for orxonox/trunk/src/util


Ignore:
Timestamp:
Jun 29, 2005, 3:05:47 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: light loadable

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

Legend:

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

    r4637 r4734  
    114114
    115115
    116 int isInt(const char* Int, int defaultValue)
     116int isInt(const char* INT, int defaultValue)
    117117{
    118118  char* endPtr = NULL;
    119   int result = strtol(Int, &endPtr, 10);
    120 
    121   if ( endPtr >= Int && endPtr < Int + strlen(Int))
     119  int result = strtol(INT, &endPtr, 10);
     120
     121  if ( endPtr >= INT && endPtr < INT + strlen(INT))
    122122    return defaultValue;
    123123  else
     
    125125}
    126126
    127 float isFloat(const char* Float, float defaultValue)
     127float isFloat(const char* FLOAT, float defaultValue)
    128128{
    129129  char* endPtr = NULL;
    130   double result = strtod(Float, &endPtr);
    131 
    132   if ( endPtr >= Float && endPtr < Float + strlen(Float))
     130  double result = strtod(FLOAT, &endPtr);
     131
     132  if ( endPtr >= FLOAT && endPtr < FLOAT + strlen(FLOAT))
    133133    return defaultValue;
    134134  else
     
    136136}
    137137
    138 const char* isString(const char* string, const char* defaultValue)
    139 {
    140   if (string != NULL)
    141     return string;
     138const Vector& isVector(const char* VECTOR, const Vector& defaultValue)
     139{
     140
     141
     142}
     143
     144const char* isString(const char* STRING, const char* defaultValue)
     145{
     146  if (STRING != NULL)
     147    return STRING;
    142148  else
    143149    return defaultValue;
  • orxonox/trunk/src/util/loading/load_param.h

    r4726 r4734  
    2323
    2424#include "base_object.h"
     25#include "vector.h"
    2526#include "factory.h"
    2627#include "debug.h"
     
    6970#define l_FLOAT_NAME       "float"              //!< The name of a FLOAT
    7071#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
    7177
    7278#define l_STRING_TYPE      const char*          //!< The type of a STRING
     
    230236*** HELPER FUNCTIONS ***
    231237***********************/
    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);
     238int           isInt(const char* INT, int defaultValue);
     239float         isFloat(const char* FLOAT, float defaultValue);
     240//const Vector& isVector(const char* VECTOR, const Vector& defaultValue);
     241const char*   isString(const char* STRING, const char* defaultValue);
     242
    235243//TiXmlEmlemnt* isXmlElem(const)
    236244
     
    346354  LoadParam5(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT);
    347355
     356  //! makes functions with one Vector loadable
     357  //LoadParam1(l_VECTOR);
     358
    348359  // loads a Ti-XML-element
    349360  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.