Ignore:
Timestamp:
05/29/18 16:32:45 (6 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

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

    r490 r792  
    2323
    2424ParamEntry* ParamObject::makeParamTab(ParamInterface *pi, bool stripgroups, bool stripproc,
    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)
     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)
    3030        ParamEntry *tab, *t;
    3131        int i, n, offset;
     
    7272        for (i = firstprop; i < pi->getPropCount(); i++)
    7373        {
    74                 const char* type=pi->type(i);
     74                const char* type = pi->type(i);
    7575                if ((!stripproc) || (strchr("dfsox", type[0])))
    7676                {
    77                         paInt flag=pi->flags(i);
     77                        paInt flag = pi->flags(i);
    7878                        int tmp_offset;
    7979                        if ((!flagsexclude_data) || (!(flag&flagsexclude_data)))
    8080                        {
    81                                 if (type[0]=='p')
    82                                         tmp_offset=0;
     81                                if (type[0] == 'p')
     82                                        tmp_offset = 0;
    8383                                else
    84                                         {
     84                                {
    8585                                        tmp_offset = offset;
    8686                                        if (type[0] != 'x') tmp_offset += (((char*)&ex.data[0]) - ((char*)&ex));
    8787                                        offset += sizeof(ExtValue);
    88                                         }
     88                                }
    8989                        }
    9090
    9191                        if ((!flagsexclude_tab) || (!(flag&flagsexclude_tab)))
    9292                        {
    93                                 t->offset=tmp_offset;
     93                                t->offset = tmp_offset;
    9494                                t->group = (paInt)(stripgroups ? 0 : pi->group(i));
    9595                                t->flags = (paInt)flag;
    9696                                if (readonly_into_userreadonly && (t->flags & PARAM_READONLY))
    97                                         t->flags=(t->flags & ~PARAM_READONLY) | PARAM_USERREADONLY;
     97                                        t->flags = (t->flags & ~PARAM_READONLY) | PARAM_USERREADONLY;
    9898                                t->fun1 = 0;
    9999                                t->fun2 = 0;
     
    185185{
    186186        if (!tab) return NULL;
    187         int n=tab->flags, used_fields=0;
    188         for (ParamEntry *t=tab+tab->group; n > 0; n--, t++)
    189                 if (strchr("dfsox",t->type[0]))
     187        int n = tab->flags, used_fields = 0;
     188        for (ParamEntry *t = tab + tab->group; n > 0; n--, t++)
     189                if (strchr("dfsox", t->type[0]))
    190190                        used_fields++;
    191191
    192         if (used_fields==0) return NULL;
     192        if (used_fields == 0) return NULL;
    193193        ParamObject *obj = new(used_fields)ParamObject(used_fields, tab); // new(n): allocate n fields ; ParamObject(n,...): tell the object it has n fields
    194194        ExtValue *v = &obj->fields[0];
    195         n=tab->flags;
    196         for (ParamEntry *t=tab+tab->group; n > 0; n--, t++)
     195        n = tab->flags;
     196        for (ParamEntry *t = tab + tab->group; n > 0; n--, t++)
    197197                switch (*t->type)
    198198        {
     
    201201                case 's': v->setString(SString::empty()); v++; break;
    202202                case 'o':
    203                         {
     203                {
    204204                        ExtObject new_obj;
    205205                        if (t->flags & PARAM_OBJECTSET)
     206                        {
     207                                ParamInterface *cls = ExtValue::findDeserializableClass(t->type + 1);
     208                                if (cls)
    206209                                {
    207                                 ParamInterface *cls=ExtValue::findDeserializableClass(t->type+1);
    208                                 if (cls)
     210                                        int new_fun = cls->findId("new");
     211                                        if (new_fun >= 0)
    209212                                        {
    210                                         int new_fun = cls->findId("new");
    211                                         if (new_fun>=0)
    212                                                 {
    213                                                 ExtValue dummy,new_value;
     213                                                ExtValue dummy, new_value;
    214214                                                cls->call(new_fun, &dummy, &new_value);
    215                                                 new_obj=new_value.getObject();
    216                                                 }
     215                                                new_obj = new_value.getObject();
    217216                                        }
    218217                                }
     218                        }
    219219                        v->setObject(new_obj);
    220220                        v++;
    221                         }
     221                }
    222222                        break;
    223223                case 'x': v++; break;
Note: See TracChangeset for help on using the changeset viewer.