Changeset 278
- Timestamp:
- 12/22/14 23:21:16 (10 years ago)
- Location:
- cpp/frams/param
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/param.cpp
r273 r278 117 117 } 118 118 119 void ParamInterface::setDefault( bool numericonly)119 void ParamInterface::setDefault() 120 120 { 121 121 int n = getPropCount(); 122 122 for (int i = 0; i < n; i++) 123 setDefault(i , numericonly);123 setDefault(i); 124 124 } 125 125 … … 138 138 } 139 139 140 void ParamInterface::setDefault(int i , bool numericonly)140 void ParamInterface::setDefault(int i) 141 141 { 142 142 const char *t = type(i); … … 157 157 } 158 158 break; 159 case 's': if (!numericonly)159 case 's': case 'x': 160 160 { 161 161 int a,b; SString c; 162 162 getMinMax(i,a,b,c); 163 setString(i,c); 163 if (*t=='s') 164 setString(i,c); 165 else 166 { if (c.len()>0) setExtValue(i,ExtValue(c)); else setExtValue(i,ExtValue::empty()); } 164 167 } 165 168 break; 166 default: if (!numericonly) set(i, ""); 169 case 'o': 170 setObject(i,ExtObject::empty()); 171 break; 167 172 } 168 173 } … … 371 376 } 372 377 373 int ParamInterface::load(VirtFILE* f,bool warn_unknown_fields )378 int ParamInterface::load(VirtFILE* f,bool warn_unknown_fields,bool *abortable) 374 379 { 375 380 SString buf; … … 379 384 bool loaded; 380 385 int fields_loaded = 0; 381 while ( loadSStringLine(f, buf))386 while ( ((!abortable)||(!*abortable)) && loadSStringLine(f, buf) ) 382 387 { 383 388 const char* t = (const char*)buf; … … 908 913 } 909 914 910 void SimpleAbstractParam::setDefault( bool numericonly)915 void SimpleAbstractParam::setDefault() 911 916 { 912 917 bool save = dontcheckchanges; 913 918 dontcheckchanges = 1; 914 ParamInterface::setDefault( numericonly);919 ParamInterface::setDefault(); 915 920 dontcheckchanges = save; 916 921 } 917 922 918 void SimpleAbstractParam::setDefault(int i , bool numericonly)923 void SimpleAbstractParam::setDefault(int i) 919 924 { 920 925 bool save = dontcheckchanges; 921 926 dontcheckchanges = 1; 922 ParamInterface::setDefault(i , numericonly);927 ParamInterface::setDefault(i); 923 928 dontcheckchanges = save; 924 929 } -
cpp/frams/param/param.h
r268 r278 138 138 int getMinMax(int prop, int& minumum, int& maximum, SString& def); 139 139 140 virtual void setDefault( bool numericonly = false);141 virtual void setDefault(int i , bool numericonly = false);140 virtual void setDefault(); 141 virtual void setDefault(int i); 142 142 void setMin(); 143 143 void setMax(); … … 158 158 int save(VirtFILE*, const char* altname = NULL, bool force = 0); 159 159 int saveprop(VirtFILE*, int i, const char* p, bool force = 0); 160 int load(VirtFILE*,bool warn_unknown_fields=true );///< @return the number of fields loaded160 int load(VirtFILE*,bool warn_unknown_fields=true,bool *abortable=NULL);///< @return the number of fields loaded 161 161 int load2(const SString &, int &);///< @return the number of fields loaded 162 162 … … 284 284 void save2(SString&, void *defdata, bool addcr = true, bool all_names = true); 285 285 286 virtual void setDefault( bool numericonly = false);287 virtual void setDefault(int i , bool numericonly = false);286 virtual void setDefault(); 287 virtual void setDefault(int i); 288 288 289 289 #ifdef DEBUG
Note: See TracChangeset
for help on using the changeset viewer.