Changeset 792 for cpp/frams/param/paramobj.cpp
- Timestamp:
- 05/29/18 16:32:45 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/paramobj.cpp
r490 r792 23 23 24 24 ParamEntry* ParamObject::makeParamTab(ParamInterface *pi, bool stripgroups, bool stripproc, 25 26 { 27 // flagsexclude_data - skip while calculating data offsets28 // flagsexclude_tab - skip while creating paramtab29 // 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) 30 30 ParamEntry *tab, *t; 31 31 int i, n, offset; … … 72 72 for (i = firstprop; i < pi->getPropCount(); i++) 73 73 { 74 const char* type =pi->type(i);74 const char* type = pi->type(i); 75 75 if ((!stripproc) || (strchr("dfsox", type[0]))) 76 76 { 77 paInt flag =pi->flags(i);77 paInt flag = pi->flags(i); 78 78 int tmp_offset; 79 79 if ((!flagsexclude_data) || (!(flag&flagsexclude_data))) 80 80 { 81 if (type[0] =='p')82 tmp_offset =0;81 if (type[0] == 'p') 82 tmp_offset = 0; 83 83 else 84 84 { 85 85 tmp_offset = offset; 86 86 if (type[0] != 'x') tmp_offset += (((char*)&ex.data[0]) - ((char*)&ex)); 87 87 offset += sizeof(ExtValue); 88 88 } 89 89 } 90 90 91 91 if ((!flagsexclude_tab) || (!(flag&flagsexclude_tab))) 92 92 { 93 t->offset =tmp_offset;93 t->offset = tmp_offset; 94 94 t->group = (paInt)(stripgroups ? 0 : pi->group(i)); 95 95 t->flags = (paInt)flag; 96 96 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; 98 98 t->fun1 = 0; 99 99 t->fun2 = 0; … … 185 185 { 186 186 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])) 190 190 used_fields++; 191 191 192 if (used_fields ==0) return NULL;192 if (used_fields == 0) return NULL; 193 193 ParamObject *obj = new(used_fields)ParamObject(used_fields, tab); // new(n): allocate n fields ; ParamObject(n,...): tell the object it has n fields 194 194 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++) 197 197 switch (*t->type) 198 198 { … … 201 201 case 's': v->setString(SString::empty()); v++; break; 202 202 case 'o': 203 203 { 204 204 ExtObject new_obj; 205 205 if (t->flags & PARAM_OBJECTSET) 206 { 207 ParamInterface *cls = ExtValue::findDeserializableClass(t->type + 1); 208 if (cls) 206 209 { 207 ParamInterface *cls=ExtValue::findDeserializableClass(t->type+1);208 if (cls)210 int new_fun = cls->findId("new"); 211 if (new_fun >= 0) 209 212 { 210 int new_fun = cls->findId("new"); 211 if (new_fun>=0) 212 { 213 ExtValue dummy,new_value; 213 ExtValue dummy, new_value; 214 214 cls->call(new_fun, &dummy, &new_value); 215 new_obj=new_value.getObject(); 216 } 215 new_obj = new_value.getObject(); 217 216 } 218 217 } 218 } 219 219 v->setObject(new_obj); 220 220 v++; 221 221 } 222 222 break; 223 223 case 'x': v++; break;
Note: See TracChangeset
for help on using the changeset viewer.