Changeset 278 for cpp/frams/param


Ignore:
Timestamp:
12/22/14 23:21:16 (9 years ago)
Author:
Maciej Komosinski
Message:

setDefault(numericonly) removed. 's', 'x' and 'o' are no special cases anymore

Location:
cpp/frams/param
Files:
2 edited

Legend:

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

    r273 r278  
    117117}
    118118
    119 void ParamInterface::setDefault(bool numericonly)
     119void ParamInterface::setDefault()
    120120{
    121121        int n = getPropCount();
    122122        for (int i = 0; i < n; i++)
    123                 setDefault(i, numericonly);
     123                setDefault(i);
    124124}
    125125
     
    138138}
    139139
    140 void ParamInterface::setDefault(int i, bool numericonly)
     140void ParamInterface::setDefault(int i)
    141141{
    142142        const char *t = type(i);
     
    157157        }
    158158                break;
    159         case 's': if (!numericonly)
     159        case 's': case 'x':
    160160        {
    161161                int a,b; SString c;
    162162                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()); }
    164167        }
    165168                break;
    166         default: if (!numericonly) set(i, "");
     169        case 'o':
     170                setObject(i,ExtObject::empty());
     171                break;
    167172        }
    168173}
     
    371376}
    372377
    373 int ParamInterface::load(VirtFILE* f,bool warn_unknown_fields)
     378int ParamInterface::load(VirtFILE* f,bool warn_unknown_fields,bool *abortable)
    374379{
    375380        SString buf;
     
    379384        bool loaded;
    380385        int fields_loaded = 0;
    381         while (loadSStringLine(f, buf))
     386        while ( ((!abortable)||(!*abortable)) && loadSStringLine(f, buf) )
    382387        {
    383388                const char* t = (const char*)buf;
     
    908913}
    909914
    910 void SimpleAbstractParam::setDefault(bool numericonly)
     915void SimpleAbstractParam::setDefault()
    911916{
    912917        bool save = dontcheckchanges;
    913918        dontcheckchanges = 1;
    914         ParamInterface::setDefault(numericonly);
     919        ParamInterface::setDefault();
    915920        dontcheckchanges = save;
    916921}
    917922
    918 void SimpleAbstractParam::setDefault(int i, bool numericonly)
     923void SimpleAbstractParam::setDefault(int i)
    919924{
    920925        bool save = dontcheckchanges;
    921926        dontcheckchanges = 1;
    922         ParamInterface::setDefault(i, numericonly);
     927        ParamInterface::setDefault(i);
    923928        dontcheckchanges = save;
    924929}
  • cpp/frams/param/param.h

    r268 r278  
    138138        int getMinMax(int prop, int& minumum, int& maximum, SString& def);
    139139
    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);
    142142        void setMin();
    143143        void setMax();
     
    158158        int save(VirtFILE*, const char* altname = NULL, bool force = 0);
    159159        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 loaded
     160        int load(VirtFILE*,bool warn_unknown_fields=true,bool *abortable=NULL);///< @return the number of fields loaded
    161161        int load2(const SString &, int &);///< @return the number of fields loaded
    162162
     
    284284        void save2(SString&, void *defdata, bool addcr = true, bool all_names = true);
    285285
    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);
    288288
    289289#ifdef DEBUG
Note: See TracChangeset for help on using the changeset viewer.