Changeset 737 for cpp/frams/param


Ignore:
Timestamp:
02/17/18 19:03:18 (6 years ago)
Author:
Maciej Komosinski
Message:

Made destructors virtual to avoid compiler warnings

Location:
cpp/frams/param
Files:
2 edited

Legend:

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

    r721 r737  
    6464        MultiParamLoader(const char* filename) { init(); load(filename); }
    6565
    66         ~MultiParamLoader() { abort(); clearObjects(); }
     66        virtual ~MultiParamLoader() { abort(); clearObjects(); }
    6767
    6868        void reset();
  • cpp/frams/param/mutableparam.h

    r348 r737  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    1414class VMCode;
    1515
    16 class MutableParam: public SimpleAbstractParam, public MutableParamInterface
     16class MutableParam : public SimpleAbstractParam, public MutableParamInterface
    1717{
    18 static const int staticprops=7;
    19 static ParamEntry pe_tab[];
    20 /** group #0 cannot be removed by scripting  */
    21 int persistgroup0;
    22 SString grprefix;
    23 SList entries;
    24 SList groups;
    25 int changed;
    26 ParamEntry *entry(int i) {return (i<staticprops)? pe_tab+i : ((ParamEntry*)entries(i-staticprops));}
    27 void *getTarget(int i) {return (i<staticprops)? SimpleAbstractParam::getTarget(i) : (void*)entry(i)->offset;}
    28 void call(int i,ExtValue* args,ExtValue *ret);
    29   public:
    30 void clear(int everything=0);
    31 int firstMutableIndex() {return staticprops;}
    32 SString& groupname(int g) {return *((SString*)groups(g));}
    33 MutableParam(const char*n=0,const char*g=0,int gr0=1);
    34 void setGroupName(const SString &n,int g=0) {groupname(g)=n;}
    35 ~MutableParam() {clear(1);}
    36 int getGroupCount() {return groups.size();}
    37 int getPropCount() {return entries.size()+staticprops;}
    38 const char *grname(int i) {return (i>=groups.size()) ? 0 : groupname(i).c_str();}
    39 int grmember(int g,int a);
     18        static const int staticprops = 7;
     19        static ParamEntry pe_tab[];
     20        /** group #0 cannot be removed by scripting  */
     21        int persistgroup0;
     22        SString grprefix;
     23        SList entries;
     24        SList groups;
     25        int changed;
     26        ParamEntry *entry(int i) { return (i < staticprops) ? pe_tab + i : ((ParamEntry*)entries(i - staticprops)); }
     27        void *getTarget(int i) { return (i < staticprops) ? SimpleAbstractParam::getTarget(i) : (void*)entry(i)->offset; }
     28        void call(int i, ExtValue* args, ExtValue *ret);
     29public:
     30        void clear(int everything = 0);
     31        int firstMutableIndex() { return staticprops; }
     32        SString& groupname(int g) { return *((SString*)groups(g)); }
     33        MutableParam(const char*n = 0, const char*g = 0, int gr0 = 1);
     34        void setGroupName(const SString &n, int g = 0) { groupname(g) = n; }
     35        ~MutableParam() { clear(1); }
     36        int getGroupCount() { return groups.size(); }
     37        int getPropCount() { return entries.size() + staticprops; }
     38        const char *grname(int i) { return (i >= groups.size()) ? 0 : groupname(i).c_str(); }
     39        int grmember(int g, int a);
    4040
    41 int addGroup(const SString& gname,int noprefix=0);
    42 void removeGroup(int pos);
     41        int addGroup(const SString& gname, int noprefix = 0);
     42        void removeGroup(int pos);
    4343
    44 int findGroup(const SString name,int ignoreprefix=0);
     44        int findGroup(const SString name, int ignoreprefix = 0);
    4545
    46 /** @param data pointer to the variable. 0 will allocate new variable
    47     @param position -1 = after the last one  */
    48 int addProperty(void* data,const char* id,const char* type,const char* name,const char* help=0,int flags=0,int group=0,int position=-1);
     46        /** @param data pointer to the variable. 0 will allocate new variable
     47                @param position -1 = after the last one  */
     48        int addProperty(void* data, const char* id, const char* type, const char* name, const char* help = 0, int flags = 0, int group = 0, int position = -1);
    4949
    50 int addProperty(ParamEntry *pe,int position=-1);
    51 ParamEntry * removeProperty(ParamEntry *pe);
    52 ParamEntry * removeProperty(int i);
     50        int addProperty(ParamEntry *pe, int position = -1);
     51        ParamEntry * removeProperty(ParamEntry *pe);
     52        ParamEntry * removeProperty(int i);
    5353
    54 void notify(int id);
     54        void notify(int id);
    5555
    56 int setInt(int,paInt);
    57 int setDouble(int,double);
    58 int setString(int,const SString &);
    59 int setObject(int,const ExtObject &);
    60 int setExtValue(int,const ExtValue &);
     56        int setInt(int, paInt);
     57        int setDouble(int, double);
     58        int setString(int, const SString &);
     59        int setObject(int, const ExtObject &);
     60        int setExtValue(int, const ExtValue &);
    6161
    6262#define STATRICKCLASS MutableParam
    63 PARAMPROCDEF(p_clear);
    64 PARAMPROCDEF(p_addprop);
    65 PARAMPROCDEF(p_remprop);
    66 PARAMPROCDEF(p_addgroup);
    67 PARAMPROCDEF(p_remgroup);
    68 PARAMGETDEF(changedname) {arg1->setString(id(changed));}
     63        PARAMPROCDEF(p_clear);
     64        PARAMPROCDEF(p_addprop);
     65        PARAMPROCDEF(p_remprop);
     66        PARAMPROCDEF(p_addgroup);
     67        PARAMPROCDEF(p_remgroup);
     68        PARAMGETDEF(changedname) { arg1->setString(id(changed)); }
    6969#undef STATRICKCLASS
    7070};
     
    7272class ParamSaver
    7373{
    74 SList store;
    75   public:
    76 virtual bool shouldLoad(ParamInterface &pi,int i) {return true;}
    77 ParamSaver() {}
    78 ParamSaver(ParamInterface &pi) {loadFrom(pi);}
    79 ~ParamSaver() {clear();}
    80 void loadFrom(ParamInterface& p);
    81 void saveTo(MutableParam& p);
    82 void clear();
     74        SList store;
     75public:
     76        virtual bool shouldLoad(ParamInterface &pi, int i) { return true; }
     77        ParamSaver() {}
     78        ParamSaver(ParamInterface &pi) { loadFrom(pi); }
     79        virtual ~ParamSaver() { clear(); }
     80        void loadFrom(ParamInterface& p);
     81        void saveTo(MutableParam& p);
     82        void clear();
    8383};
    8484
Note: See TracChangeset for help on using the changeset viewer.