Changeset 253 for cpp/frams/param/param.cpp
- Timestamp:
- 11/18/14 17:01:07 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r247 r253 86 86 } 87 87 88 int ParamInterface::getMinMax(int prop, int& minumum, int& maximum, SString& def) 89 { 90 const char* t = type(prop) + 1; 91 while (*t) if (*t == ' ') break; else t++; 92 int ret=sscanf(t, "%d %d", &minumum, &maximum); 93 def=SString::empty(); 94 if (ret==2) 95 { 96 while (*t==' ') t++; 97 for(int skip_fields=2;skip_fields>0;skip_fields--) 98 { 99 while (*t) if (*t == ' ') break; else t++; 100 while (*t==' ') t++; 101 } 102 if (*t) 103 { 104 const char* til=strchr(t,'~'); 105 if (!til) 106 def=SString(t); 107 else 108 { 109 while ((til>t)&&(til[-1]==' ')) til--; 110 def=SString(t,til-t); 111 } 112 } 113 return 3; 114 } 115 else 116 return ret; 117 } 118 88 119 void ParamInterface::setDefault(bool numericonly) 89 120 { … … 125 156 setInt(i, c); 126 157 } 158 break; 159 case 's': if (!numericonly) 160 { 161 int a,b; SString c; 162 getMinMax(i,a,b,c); 163 setString(i,c); 164 } 127 165 break; 128 166 default: if (!numericonly) set(i, ""); … … 770 808 const char* t = pe->type + 1; 771 809 while (*t) if (*t == ' ') break; else t++; 772 paInt a = 0, b = 0;810 int a = 0, b = 0; 773 811 int result = 0; 774 if (sscanf(t, PA_INT_SCANF " " PA_INT_SCANF, &a, &b) == 2)812 if (sscanf(t, "%d %d", &a, &b) == 2) //using getMinMax would also get default value, which is not needed here 775 813 { 776 814 if ((x.len() > b) && (b > 0))
Note: See TracChangeset
for help on using the changeset viewer.