Ignore:
Timestamp:
02/06/15 00:15:08 (9 years ago)
Author:
Maciej Komosinski
Message:

Unified parsing of ints and floats; hex notation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/param/param.cpp

    r325 r326  
    499499}
    500500
    501 static bool stringIsNumeric(const char* str)
    502 {//   /-?.?[0-9]+/
    503         if (!str) return false;
    504         if (*str == '-') str++;
    505         if (*str == '.') str++;
    506         return isdigit(*str) != 0;
    507 }
    508 
    509501int ParamInterface::setInt(int i, const char* str)
    510502{
    511         if (!stringIsNumeric(str))
     503        paInt value;
     504        if (!ExtValue::parseInt(str,value,false,true))
    512505        {
    513506                paInt mn, mx, def;
     
    518511        }
    519512        else
    520                 return setInt(i, ExtValue::getInt(str));
     513                return setInt(i, value);
    521514}
    522515
    523516int ParamInterface::setDouble(int i, const char* str)
    524517{
    525         if (!stringIsNumeric(str))
     518        double value;
     519        if (!ExtValue::parseDouble(str,value,true))
    526520        {
    527521                double mn, mx, def;
     
    532526        }
    533527        else
    534                 return setDouble(i, ExtValue::getDouble(str));
     528                return setDouble(i, value);
    535529}
    536530
Note: See TracChangeset for help on using the changeset viewer.