Ignore:
Timestamp:
03/30/16 17:08:08 (8 years ago)
Author:
Maciej Komosinski
Message:

Introduced general-use ErrorObject?, fixed enumeration of mixed private/public property lists

File:
1 edited

Legend:

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

    r478 r490  
    2323
    2424ParamEntry* ParamObject::makeParamTab(ParamInterface *pi, bool stripgroups, bool stripproc,
    25                                       int firstprop, int maxprops, bool dupentries, int flagsexclude, bool addnew, const char* rename, bool readonly_into_userreadonly)
    26 {
     25                                      int firstprop, int maxprops, bool dupentries, int flagsexclude_data, int flagsexclude_tab, bool addnew, const char* rename, bool readonly_into_userreadonly)
     26{
     27// flagsexclude_data - skip while calculating data offsets
     28// flagsexclude_tab - skip while creating paramtab
     29// usually _data==_tab, but vmneuron public properties need _data=0 and _tab=PARAM_USERHIDDEN (data object has all fields, paramtab skips private fields)
    2730        ParamEntry *tab, *t;
    2831        int i, n, offset;
     
    3033        int count = 0, gcount = 1;
    3134        if (!stripgroups) gcount = pi->getGroupCount();
    32         if (stripproc || flagsexclude)
     35        if (stripproc || flagsexclude_tab)
    3336                for (int i = firstprop; i < pi->getPropCount(); i++)
    3437                {
    3538                const char*t = pi->type(i);
    3639                if ((!stripproc) || (strchr("dfsox", *t)))
    37                         if ((!flagsexclude) || (!(pi->flags(i)&flagsexclude)))
     40                        if ((!flagsexclude_tab) || (!(pi->flags(i)&flagsexclude_tab)))
    3841                                if (++count >= maxprops) break;
    3942                }
     
    7275                if ((!stripproc) || (strchr("dfsox", type[0])))
    7376                {
    74                         if ((!flagsexclude) || (!(pi->flags(i)&flagsexclude)))
     77                        paInt flag=pi->flags(i);
     78                        int tmp_offset;
     79                        if ((!flagsexclude_data) || (!(flag&flagsexclude_data)))
    7580                        {
    7681                                if (type[0]=='p')
    77                                         t->offset=0;
     82                                        tmp_offset=0;
    7883                                else
    7984                                        {
    80                                         t->offset = offset;
    81                                         if (type[0] != 'x') t->offset += (((char*)&ex.data[0]) - ((char*)&ex));
     85                                        tmp_offset = offset;
     86                                        if (type[0] != 'x') tmp_offset += (((char*)&ex.data[0]) - ((char*)&ex));
    8287                                        offset += sizeof(ExtValue);
    8388                                        }
     89                        }
     90
     91                        if ((!flagsexclude_tab) || (!(flag&flagsexclude_tab)))
     92                        {
     93                                t->offset=tmp_offset;
    8494                                t->group = (paInt)(stripgroups ? 0 : pi->group(i));
    85                                 t->flags = (paInt)pi->flags(i);
     95                                t->flags = (paInt)flag;
    8696                                if (readonly_into_userreadonly && (t->flags & PARAM_READONLY))
    8797                                        t->flags=(t->flags & ~PARAM_READONLY) | PARAM_USERREADONLY;
     
    190200                case 'f': v->setDouble(0); v++; break;
    191201                case 's': v->setString(SString::empty()); v++; break;
    192                 case 'o': v->setObject(ExtObject()); v++; break;
     202                case 'o':
     203                        {
     204                        ExtObject new_obj;
     205                        if (t->flags & PARAM_OBJECTSET)
     206                                {
     207                                ParamInterface *cls=ExtValue::findDeserializableClass(t->type+1);
     208                                if (cls)
     209                                        {
     210                                        int new_fun = cls->findId("new");
     211                                        if (new_fun>=0)
     212                                                {
     213                                                ExtValue dummy,new_value;
     214                                                cls->call(new_fun, &dummy, &new_value);
     215                                                new_obj=new_value.getObject();
     216                                                }
     217                                        }
     218                                }
     219                        v->setObject(new_obj);
     220                        v++;
     221                        }
     222                        break;
    193223                case 'x': v++; break;
    194224        }
Note: See TracChangeset for help on using the changeset viewer.