Changeset 396
- Timestamp:
- 06/23/15 00:52:00 (9 years ago)
- Location:
- cpp/frams/param
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/param/paramobj.cpp
r348 r396 23 23 24 24 ParamEntry* ParamObject::makeParamTab(ParamInterface *pi, bool stripgroups, bool stripproc, 25 int firstprop, int maxprops, bool dupentries, int flagsexclude, bool addnew, const char* rename)25 int firstprop, int maxprops, bool dupentries, int flagsexclude, bool addnew, const char* rename, bool readonly_into_userreadonly) 26 26 { 27 27 ParamEntry *tab, *t; … … 69 69 for (i = firstprop; i < pi->getPropCount(); i++) 70 70 { 71 if ((!stripproc) || (strchr("dfsox", *pi->type(i)))) 71 const char* type=pi->type(i); 72 if ((!stripproc) || (strchr("dfsox", type[0]))) 72 73 { 73 74 if ((!flagsexclude) || (!(pi->flags(i)&flagsexclude))) 74 75 { 75 t->offset = offset; 76 if (*pi->type(i) != 'x') t->offset += (((char*)&ex.data[0]) - ((char*)&ex)); 76 if (type[0]=='p') 77 t->offset=0; 78 else 79 { 80 t->offset = offset; 81 if (type[0] != 'x') t->offset += (((char*)&ex.data[0]) - ((char*)&ex)); 82 offset += sizeof(ExtValue); 83 } 77 84 t->group = (short)(stripgroups ? 0 : pi->group(i)); 78 85 t->flags = (short)pi->flags(i); 86 if (readonly_into_userreadonly && (t->flags & PARAM_READONLY)) 87 t->flags=(t->flags & ~PARAM_READONLY) | PARAM_USERREADONLY; 79 88 t->fun1 = 0; 80 89 t->fun2 = 0; 81 90 t->id = maybedup(dupentries, pi->id(i)); 82 91 t->name = maybedup(dupentries, pi->name(i)); 83 t->type = maybedup(dupentries, pi->type(i));92 t->type = maybedup(dupentries, type); 84 93 t->help = maybedup(dupentries, pi->help(i)); 85 t++; n++; offset += sizeof(ExtValue);94 t++; n++; 86 95 if (n > count) break; 87 96 } … … 165 174 ParamObject* ParamObject::makeObject(ParamEntry *tab) 166 175 { 167 if (!tab) return 0; 168 int n = tab->flags; 169 if (!n) return 0; 170 ParamObject *obj = new(n)ParamObject(n, tab); // new(n): allocate n fields ; ParamObject(n,...): tell the object it has n fields 176 if (!tab) return NULL; 177 int n=tab->flags, used_fields=0; 178 for (ParamEntry *t=tab+tab->group; n > 0; n--, t++) 179 if (strchr("dfsox",t->type[0])) 180 used_fields++; 181 182 if (used_fields==0) return NULL; 183 ParamObject *obj = new(used_fields)ParamObject(used_fields, tab); // new(n): allocate n fields ; ParamObject(n,...): tell the object it has n fields 171 184 ExtValue *v = &obj->fields[0]; 172 tab += tab->group;173 for ( ; n > 0; n--, tab++)174 switch (*t ab->type)185 n=tab->flags; 186 for (ParamEntry *t=tab+tab->group; n > 0; n--, t++) 187 switch (*t->type) 175 188 { 176 189 case 'd': v->setInt(0); v++; break; -
cpp/frams/param/paramobj.h
r333 r396 53 53 ParamObject::freeObject(obj2); 54 54 */ 55 static ParamEntry* makeParamTab(ParamInterface *pi, bool stripgroups = 0, bool stripproc = 0, int firstprop = 0, int maxprops = 9999, bool dupentries = false, int flagsexclude = 0, bool addnew = false, const char* rename = NULL );55 static ParamEntry* makeParamTab(ParamInterface *pi, bool stripgroups = 0, bool stripproc = 0, int firstprop = 0, int maxprops = 9999, bool dupentries = false, int flagsexclude = 0, bool addnew = false, const char* rename = NULL,bool readonly_into_userreadonly=false); 56 56 57 57 /** deallocate paramtab obtained from makeParamTab() */
Note: See TracChangeset
for help on using the changeset viewer.