14#include <gwenhywfar/misc.h>
15#include <gwenhywfar/debug.h>
28 if (strcasecmp(p_s,
"int")==0)
30 else if (strcasecmp(p_s,
"bool")==0)
32 else if (strcasecmp(p_s,
"float")==0)
34 else if (strcasecmp(p_s,
"string")==0)
43 if (strcasecmp(p_s,
"simple")==0)
45 else if (strcasecmp(p_s,
"choice")==0)
86 p_struct->_refCount=1;
94 p_struct->shortDescription=
NULL;
95 p_struct->longDescription=
NULL;
96 p_struct->currentValue=
NULL;
97 p_struct->defaultValue=
NULL;
98 p_struct->choices=
NULL;
99 p_struct->internalIntValue=0;
100 p_struct->internalFloatValue=0;
101 p_struct->runtimeFlags=0;
110 assert(p_struct->_refCount);
111 if (p_struct->_refCount==1) {
115 free(p_struct->name);
117 free(p_struct->shortDescription);
118 p_struct->shortDescription=
NULL;
119 free(p_struct->longDescription);
120 p_struct->longDescription=
NULL;
121 free(p_struct->currentValue);
122 p_struct->currentValue=
NULL;
123 free(p_struct->defaultValue);
124 p_struct->defaultValue=
NULL;
126 p_struct->choices=
NULL;
127 p_struct->_refCount=0;
131 p_struct->_refCount--;
138 assert(p_struct->_refCount);
139 p_struct->_refCount++;
149 if (p_struct->name) {
150 free(p_struct->name);
155 p_struct->name=strdup(p_src->name);
159 p_struct->flags=p_src->flags;
162 p_struct->type=p_src->type;
165 p_struct->dataType=p_src->dataType;
168 if (p_struct->shortDescription) {
169 free(p_struct->shortDescription);
170 p_struct->shortDescription=
NULL;
171 p_struct->shortDescription=
NULL;
173 if (p_src->shortDescription) {
174 p_struct->shortDescription=strdup(p_src->shortDescription);
178 if (p_struct->longDescription) {
179 free(p_struct->longDescription);
180 p_struct->longDescription=
NULL;
181 p_struct->longDescription=
NULL;
183 if (p_src->longDescription) {
184 p_struct->longDescription=strdup(p_src->longDescription);
188 if (p_struct->currentValue) {
189 free(p_struct->currentValue);
190 p_struct->currentValue=
NULL;
191 p_struct->currentValue=
NULL;
193 if (p_src->currentValue) {
194 p_struct->currentValue=strdup(p_src->currentValue);
198 if (p_struct->defaultValue) {
199 free(p_struct->defaultValue);
200 p_struct->defaultValue=
NULL;
201 p_struct->defaultValue=
NULL;
203 if (p_src->defaultValue) {
204 p_struct->defaultValue=strdup(p_src->defaultValue);
208 if (p_struct->choices) {
210 p_struct->choices=
NULL;
211 p_struct->choices=
NULL;
213 if (p_src->choices) {
218 p_struct->internalIntValue=p_src->internalIntValue;
221 p_struct->internalFloatValue=p_src->internalFloatValue;
224 p_struct->runtimeFlags=p_src->runtimeFlags;
234 if (p_struct->name) {
235 free(p_struct->name);
240 p_struct->name=strdup(p_src->name);
244 p_struct->flags=p_src->flags;
247 p_struct->type=p_src->type;
250 p_struct->dataType=p_src->dataType;
253 if (p_struct->shortDescription) {
254 free(p_struct->shortDescription);
255 p_struct->shortDescription=
NULL;
256 p_struct->shortDescription=
NULL;
258 if (p_src->shortDescription) {
259 p_struct->shortDescription=strdup(p_src->shortDescription);
263 if (p_struct->longDescription) {
264 free(p_struct->longDescription);
265 p_struct->longDescription=
NULL;
266 p_struct->longDescription=
NULL;
268 if (p_src->longDescription) {
269 p_struct->longDescription=strdup(p_src->longDescription);
273 if (p_struct->currentValue) {
274 free(p_struct->currentValue);
275 p_struct->currentValue=
NULL;
276 p_struct->currentValue=
NULL;
278 if (p_src->currentValue) {
279 p_struct->currentValue=strdup(p_src->currentValue);
283 if (p_struct->defaultValue) {
284 free(p_struct->defaultValue);
285 p_struct->defaultValue=
NULL;
286 p_struct->defaultValue=
NULL;
288 if (p_src->defaultValue) {
289 p_struct->defaultValue=strdup(p_src->defaultValue);
293 if (p_struct->choices) {
295 p_struct->choices=
NULL;
296 p_struct->choices=
NULL;
298 if (p_src->choices) {
303 p_struct->internalIntValue=p_src->internalIntValue;
306 p_struct->internalFloatValue=p_src->internalFloatValue;
309 p_struct->runtimeFlags=p_src->runtimeFlags;
317 return p_struct->name;
323 return p_struct->flags;
329 return p_struct->type;
335 return p_struct->dataType;
341 return p_struct->shortDescription;
347 return p_struct->longDescription;
353 return p_struct->currentValue;
359 return p_struct->defaultValue;
365 return p_struct->choices;
371 return p_struct->internalIntValue;
377 return p_struct->internalFloatValue;
383 return p_struct->runtimeFlags;
389 if (p_struct->name) {
390 free(p_struct->name);
394 p_struct->name=strdup(p_src);
404 p_struct->flags=p_src;
410 p_struct->flags|=p_src;
416 p_struct->flags&=~p_src;
422 p_struct->type=p_src;
428 p_struct->dataType=p_src;
434 if (p_struct->shortDescription) {
435 free(p_struct->shortDescription);
436 p_struct->shortDescription=
NULL;
439 p_struct->shortDescription=strdup(p_src);
442 p_struct->shortDescription=
NULL;
449 if (p_struct->longDescription) {
450 free(p_struct->longDescription);
451 p_struct->longDescription=
NULL;
454 p_struct->longDescription=strdup(p_src);
457 p_struct->longDescription=
NULL;
464 if (p_struct->currentValue) {
465 free(p_struct->currentValue);
466 p_struct->currentValue=
NULL;
469 p_struct->currentValue=strdup(p_src);
472 p_struct->currentValue=
NULL;
479 if (p_struct->defaultValue) {
480 free(p_struct->defaultValue);
481 p_struct->defaultValue=
NULL;
484 p_struct->defaultValue=strdup(p_src);
487 p_struct->defaultValue=
NULL;
494 if (p_struct->choices) {
496 p_struct->choices=
NULL;
498 p_struct->choices=p_src;
504 p_struct->internalIntValue=p_src;
510 p_struct->internalFloatValue=p_src;
516 p_struct->runtimeFlags=p_src;
522 p_struct->runtimeFlags|=p_src;
528 p_struct->runtimeFlags&=~p_src;
555 if (p_struct->name) {
556 free(p_struct->name);
563 p_struct->name=strdup(s);
565 if (p_struct->name==
NULL) {
593 if (p_struct->shortDescription) {
594 free(p_struct->shortDescription);
595 p_struct->shortDescription=
NULL;
601 p_struct->shortDescription=strdup(s);
603 if (p_struct->shortDescription==
NULL) {
604 p_struct->shortDescription=
NULL;
608 if (p_struct->longDescription) {
609 free(p_struct->longDescription);
610 p_struct->longDescription=
NULL;
616 p_struct->longDescription=strdup(s);
618 if (p_struct->longDescription==
NULL) {
619 p_struct->longDescription=
NULL;
623 if (p_struct->currentValue) {
624 free(p_struct->currentValue);
625 p_struct->currentValue=
NULL;
631 p_struct->currentValue=strdup(s);
633 if (p_struct->currentValue==
NULL) {
634 p_struct->currentValue=
NULL;
638 if (p_struct->defaultValue) {
639 free(p_struct->defaultValue);
640 p_struct->defaultValue=
NULL;
646 p_struct->defaultValue=strdup(s);
648 if (p_struct->defaultValue==
NULL) {
649 p_struct->defaultValue=
NULL;
653 if (p_struct->choices) {
655 p_struct->choices=
NULL;
660 if (p_struct->choices==
NULL) {
661 p_struct->choices=
NULL;
666 p_struct->internalIntValue=0;
670 p_struct->internalFloatValue=0;
674 p_struct->runtimeFlags=0;
718 if (p_struct->shortDescription)
730 if (p_struct->longDescription)
742 if (p_struct->currentValue)
754 if (p_struct->defaultValue)
766 if (p_struct->choices) {
804 if (p_struct->name) {
805 free(p_struct->name);
812 p_struct->name=strdup(s);
814 if (p_struct->name==
NULL) {
842 if (p_struct->shortDescription) {
843 free(p_struct->shortDescription);
844 p_struct->shortDescription=
NULL;
850 p_struct->shortDescription=strdup(s);
852 if (p_struct->shortDescription==
NULL) {
853 p_struct->shortDescription=
NULL;
857 if (p_struct->longDescription) {
858 free(p_struct->longDescription);
859 p_struct->longDescription=
NULL;
865 p_struct->longDescription=strdup(s);
867 if (p_struct->longDescription==
NULL) {
868 p_struct->longDescription=
NULL;
872 if (p_struct->currentValue) {
873 free(p_struct->currentValue);
874 p_struct->currentValue=
NULL;
880 p_struct->currentValue=strdup(s);
882 if (p_struct->currentValue==
NULL) {
883 p_struct->currentValue=
NULL;
887 if (p_struct->defaultValue) {
888 free(p_struct->defaultValue);
889 p_struct->defaultValue=
NULL;
895 p_struct->defaultValue=strdup(s);
897 if (p_struct->defaultValue==
NULL) {
898 p_struct->defaultValue=
NULL;
902 if (p_struct->choices) {
904 p_struct->choices=
NULL;
913 p_struct->choices=
NULL;
915 if (p_struct->choices==
NULL) {
916 p_struct->choices=
NULL;
921 p_struct->internalIntValue=0;
925 p_struct->internalFloatValue=0;
929 p_struct->runtimeFlags=0;
961 if (p_struct->choices) {
998 if (p_struct->name && p_cmp)
999 p_rv=strcasecmp(p_cmp, p_struct->name);
1002 else if (p_struct->name)
1018 p_struct = GWEN_Param_Tree_GetFirst(p_tree);
1022 if (p_struct->name && p_cmp)
1023 p_rv=strcasecmp(p_cmp, p_struct->name);
1026 else if (p_struct->name)
1032 p_struct = GWEN_Param_Tree_GetBelow(p_struct);
const char * GWEN_DB_GetCharValue(GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
int GWEN_DB_DeleteVar(GWEN_DB_NODE *n, const char *path)
int GWEN_DB_SetIntValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, int val)
int GWEN_DB_SetCharValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
int GWEN_DB_GetIntValue(GWEN_DB_NODE *n, const char *path, int idx, int defVal)
#define GWEN_DB_FLAGS_OVERWRITE_VARS
struct GWEN_DB_NODE GWEN_DB_NODE
#define DBG_INFO(dbg_logger, format, args...)
#define GWEN_LIST_FINI(t, element)
#define GWEN_LIST_FUNCTIONS(t, pr)
#define GWEN_LIST_INIT(t, element)
#define GWEN_LIST2_FUNCTIONS(t, pr)
GWEN_PARAM * GWEN_Param_List_Next(const GWEN_PARAM *element)
void GWEN_Param_List_Add(GWEN_PARAM *element, GWEN_PARAM_LIST *list)
GWEN_PARAM * GWEN_Param_List_First(const GWEN_PARAM_LIST *l)
GWEN_PARAM_LIST * GWEN_Param_List_new()
#define GWEN_FREE_OBJECT(varname)
#define GWEN_NEW_OBJECT(typ, varname)
int GWEN_Param_GetInternalIntValue(const GWEN_PARAM *p_struct)
GWEN_PARAM * GWEN_Param_fromXml(GWEN_XMLNODE *p_db)
void GWEN_Param_SetDataType(GWEN_PARAM *p_struct, GWEN_PARAM_DATATYPE p_src)
GWEN_PARAM * GWEN_Param_copy(GWEN_PARAM *p_struct, const GWEN_PARAM *p_src)
void GWEN_Param_SubRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src)
void GWEN_Param_AddRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src)
GWEN_PARAM * GWEN_Param_Tree_GetByName(const GWEN_PARAM_TREE *p_tree, const char *p_cmp)
int GWEN_Param_WriteDb(const GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db)
void GWEN_Param_SetChoices(GWEN_PARAM *p_struct, GWEN_STRINGLIST2 *p_src)
const char * GWEN_Param_GetShortDescription(const GWEN_PARAM *p_struct)
uint32_t GWEN_Param_GetFlags(const GWEN_PARAM *p_struct)
GWEN_PARAM_LIST * GWEN_Param_List_dup(const GWEN_PARAM_LIST *p_src)
void GWEN_Param_SetShortDescription(GWEN_PARAM *p_struct, const char *p_src)
GWEN_PARAM * GWEN_Param_List_GetByName(const GWEN_PARAM_LIST *p_list, const char *p_cmp)
void GWEN_Param_SetInternalIntValue(GWEN_PARAM *p_struct, int p_src)
const char * GWEN_Param_Type_toString(GWEN_PARAM_TYPE p_i)
GWEN_PARAM * GWEN_Param_fromDb(GWEN_DB_NODE *p_db)
void GWEN_Param_SetLongDescription(GWEN_PARAM *p_struct, const char *p_src)
const char * GWEN_Param_GetCurrentValue(const GWEN_PARAM *p_struct)
GWEN_PARAM * GWEN_Param_new(void)
void GWEN_Param_SetName(GWEN_PARAM *p_struct, const char *p_src)
GWEN_PARAM_TYPE GWEN_Param_Type_fromString(const char *p_s)
void GWEN_Param_AddFlags(GWEN_PARAM *p_struct, uint32_t p_src)
void GWEN_Param_free(GWEN_PARAM *p_struct)
GWEN_PARAM_TYPE GWEN_Param_GetType(const GWEN_PARAM *p_struct)
double GWEN_Param_GetInternalFloatValue(const GWEN_PARAM *p_struct)
void GWEN_Param_SubFlags(GWEN_PARAM *p_struct, uint32_t p_src)
void GWEN_Param_SetInternalFloatValue(GWEN_PARAM *p_struct, double p_src)
void GWEN_Param_SetType(GWEN_PARAM *p_struct, GWEN_PARAM_TYPE p_src)
int GWEN_Param_toDb(const GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db)
GWEN_PARAM * GWEN_Param_dup(const GWEN_PARAM *p_src)
void GWEN_Param_toXml(const GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db)
void GWEN_Param_Attach(GWEN_PARAM *p_struct)
GWEN_STRINGLIST2 * GWEN_Param_GetChoices(const GWEN_PARAM *p_struct)
void GWEN_Param_WriteXml(const GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db)
uint32_t GWEN_Param_GetRuntimeFlags(const GWEN_PARAM *p_struct)
void GWEN_Param_SetDefaultValue(GWEN_PARAM *p_struct, const char *p_src)
GWEN_PARAM_DATATYPE GWEN_Param_DataType_fromString(const char *p_s)
void GWEN_Param_SetFlags(GWEN_PARAM *p_struct, uint32_t p_src)
void GWEN_Param_ReadDb(GWEN_PARAM *p_struct, GWEN_DB_NODE *p_db)
const char * GWEN_Param_DataType_toString(GWEN_PARAM_DATATYPE p_i)
const char * GWEN_Param_GetLongDescription(const GWEN_PARAM *p_struct)
void GWEN_Param_SetRuntimeFlags(GWEN_PARAM *p_struct, uint32_t p_src)
void GWEN_Param_SetCurrentValue(GWEN_PARAM *p_struct, const char *p_src)
GWEN_PARAM_DATATYPE GWEN_Param_GetDataType(const GWEN_PARAM *p_struct)
const char * GWEN_Param_GetDefaultValue(const GWEN_PARAM *p_struct)
const char * GWEN_Param_GetName(const GWEN_PARAM *p_struct)
void GWEN_Param_ReadXml(GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db)
@ GWEN_Param_DataType_Float
@ GWEN_Param_DataType_Unknown
@ GWEN_Param_DataType_Int
@ GWEN_Param_DataType_String
@ GWEN_Param_DataType_Bool
@ GWEN_Param_Type_Unknown
struct GWEN_PARAM GWEN_PARAM
int GWEN_StringList2_toDb(GWEN_STRINGLIST2 *sl2, GWEN_DB_NODE *db, const char *name)
int GWEN_StringList2_toXml(GWEN_STRINGLIST2 *sl2, GWEN_XMLNODE *node)
GWEN_STRINGLIST2 * GWEN_StringList2_fromXml(GWEN_XMLNODE *node, GWEN_STRINGLIST2_INSERTMODE m)
GWEN_STRINGLIST2 * GWEN_StringList2_dup(GWEN_STRINGLIST2 *sl2)
GWEN_STRINGLIST2 * GWEN_StringList2_fromDb(GWEN_DB_NODE *db, const char *name, GWEN_STRINGLIST2_INSERTMODE m)
void GWEN_StringList2_free(GWEN_STRINGLIST2 *sl2)
struct GWEN_STRINGLIST2 GWEN_STRINGLIST2
@ GWEN_StringList2_IntertMode_AlwaysAdd
#define GWEN_TREE_FINI(t, element)
#define GWEN_TREE_FUNCTIONS(t, pr)
#define GWEN_TREE_INIT(t, element)
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
GWEN_XMLNODE * GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data)
void GWEN_XMLNode_SetIntValue(GWEN_XMLNODE *n, const char *name, int value)
int GWEN_XMLNode_GetIntValue(const GWEN_XMLNODE *n, const char *name, int defValue)
const char * GWEN_XMLNode_GetCharValue(const GWEN_XMLNODE *n, const char *name, const char *defValue)
void GWEN_XMLNode_AddChild(GWEN_XMLNODE *n, GWEN_XMLNODE *child)
void GWEN_XMLNode_SetCharValue(GWEN_XMLNODE *n, const char *name, const char *value)
struct GWEN__XMLNODE GWEN_XMLNODE