| 1 | // This file is a part of the Framsticks GDK. |
|---|
| 2 | // Copyright (C) 2002-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. |
|---|
| 3 | // Refer to http://www.framsticks.com/ for further information. |
|---|
| 4 | |
|---|
| 5 | #ifndef _PARAMOBJ_H_ |
|---|
| 6 | #define _PARAMOBJ_H_ |
|---|
| 7 | |
|---|
| 8 | #include "param.h" |
|---|
| 9 | |
|---|
| 10 | class ParamObject |
|---|
| 11 | { |
|---|
| 12 | public: |
|---|
| 13 | /** make a ParamEntry* array for use with Param object. |
|---|
| 14 | offsets in the array are calculated for the ExtObject array as the target. |
|---|
| 15 | valid array can be created with makeObject(). |
|---|
| 16 | sample code: |
|---|
| 17 | @code |
|---|
| 18 | ParamInterface *pi=...; // any param interface |
|---|
| 19 | ParamEntry *tab=ParamObject::makeParamTab(pi); |
|---|
| 20 | void* obj=ParamObject::makeObject(tab); |
|---|
| 21 | void* obj2=ParamObject::makeObject(tab); |
|---|
| 22 | Param par(tab,obj); |
|---|
| 23 | par.set(...), par.get(...), par.load(...), par.save(...); |
|---|
| 24 | par.select(obj); |
|---|
| 25 | par.select(obj2); |
|---|
| 26 | ParamObject::freeObject(obj); |
|---|
| 27 | ParamObject::freeObject(obj2); |
|---|
| 28 | */ |
|---|
| 29 | static ParamEntry* makeParamTab(ParamInterface *pi,bool stripgroups=0,bool stripproc=0,int firstprop=0,int maxprops=9999,bool dupentries=false, int flagsexclude=0); |
|---|
| 30 | |
|---|
| 31 | /** deallocate paramtab obtained from makeParamTab() */ |
|---|
| 32 | static void freeParamTab(ParamEntry *pe); |
|---|
| 33 | |
|---|
| 34 | static bool paramTabEqual(ParamEntry *pe1,ParamEntry *pe2); |
|---|
| 35 | |
|---|
| 36 | /** @return the object, suitable for Param.select(...). |
|---|
| 37 | @return NULL if 'pi' has no usable properties */ |
|---|
| 38 | static void* makeObject(ParamEntry *tab); |
|---|
| 39 | |
|---|
| 40 | /** copy data from src to dst */ |
|---|
| 41 | static void copyObject(void* dst,void* src); |
|---|
| 42 | |
|---|
| 43 | /** duplicate object */ |
|---|
| 44 | static void* dupObject(void* obj); |
|---|
| 45 | |
|---|
| 46 | /** delete all data in the array and deallocate it */ |
|---|
| 47 | static void freeObject(void* obj); |
|---|
| 48 | }; |
|---|
| 49 | |
|---|
| 50 | #endif |
|---|