- Timestamp:
- 12/31/16 20:35:12 (8 years ago)
- Location:
- cpp/frams/param
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r640 r645 574 574 } 575 575 576 int ParamInterface::setInt(int i, const char* str )576 int ParamInterface::setInt(int i, const char* str, bool strict) 577 577 { 578 578 paInt value; 579 if (!ExtValue::parseInt(str, value, false, true))579 if (!ExtValue::parseInt(str, value, strict, true)) 580 580 { 581 581 paInt mn, mx, def; … … 645 645 } 646 646 647 int ParamInterface::set(int i, const char *v )647 int ParamInterface::set(int i, const char *v, bool strict) 648 648 { 649 649 char typ = type(i)[0]; 650 650 switch (typ) 651 651 { 652 case 'd': return setInt(i, v );652 case 'd': return setInt(i, v, strict); 653 653 case 'f': return setDouble(i, v); 654 654 case 's': { SString t(v); return setString(i, t); } … … 745 745 { 746 746 case 'd': t+="integer"; 747 {paInt a,b,c; int n=getMinMax(type,a,b,c); if ( n>=2) t+=SString::sprintf(" %d..%d",a,b); if (n>=3) t+=SString::sprintf(" (default %d)",c);}747 {paInt a,b,c; int n=getMinMax(type,a,b,c); if ((n>=2)&&(b>=a)) t+=SString::sprintf(" %d..%d",a,b); if (n>=3) t+=SString::sprintf(" (default %d)",c);} 748 748 break; 749 749 case 'f': t+="float"; 750 {double a,b,c; int n=getMinMax(type,a,b,c); if ( n>=2) t+=SString::sprintf(" %g..%g",a,b); if (n>=3) t+=SString::sprintf(" (default %g)",c);}750 {double a,b,c; int n=getMinMax(type,a,b,c); if ((n>=2)&&(b>=a)) t+=SString::sprintf(" %g..%g",a,b); if (n>=3) t+=SString::sprintf(" (default %g)",c);} 751 751 break; 752 752 case 's': t+="string"; … … 1202 1202 remember = *valstop; 1203 1203 *(char*)valstop = 0; 1204 ret = set(i, value );1204 ret = set(i, value, true); 1205 1205 fields_loaded++; 1206 1206 if (ret&(PSET_HITMAX | PSET_HITMIN)) -
cpp/frams/param/param.h
r640 r645 118 118 ExtValue getById(const char* prop); 119 119 120 int setInt(int i, const char* str );120 int setInt(int i, const char* str, bool strict=false); 121 121 int setDouble(int i, const char* str); 122 122 virtual int setInt(int, paInt) = 0; ///< set long value, you can only use this for "d" type prop … … 128 128 int set(int, const ExtValue &);///< most universal set, can be used for every datatype 129 129 130 int set(int, const char* ); ///< oldstyle set, can convert string to long or double130 int set(int, const char*, bool strict=false); ///< oldstyle set, can convert string to long or double 131 131 132 132 int setIntById(const char* prop, paInt);///< set long value, you can only use this for "d" type prop
Note: See TracChangeset
for help on using the changeset viewer.