void GWEN_Param_SetChoices(GWEN_PARAM *p_struct, GWEN_STRINGLIST2 *p_src) { assert(p_struct); if (p_struct->choices) { GWEN_StringList2_free(p_struct->choices); } p_struct->choices=p_src; }
int GWEN_XMLNode_NormalizeNameSpaces(GWEN_XMLNODE *n) { const char *ns; int rv; GWEN_STRINGLIST2 *sl; ns=GWEN_XMLNode_GetProperty(n, "xmlns", 0); sl=GWEN_StringList2_new(); rv=GWEN_XMLNode__CheckNameSpaceDecls1(n, sl, ns); GWEN_StringList2_free(sl); if (rv) { DBG_INFO(GWEN_LOGDOMAIN, "here"); return rv; } //rv=GWEN_XMLNode__CheckNameSpaceDecls2(n, ns); rv=GWEN_XMLNode__CheckNameSpaceDecls3(n); if (rv==-1) return rv; return 0; }
void GWEN_Param_free(GWEN_PARAM *p_struct) { if (p_struct) { assert(p_struct->_refCount); if (p_struct->_refCount==1) { GWEN_LIST_FINI(GWEN_PARAM, p_struct) GWEN_TREE_FINI(GWEN_PARAM, p_struct) /* members */ free(p_struct->name); free(p_struct->shortDescription); free(p_struct->longDescription); free(p_struct->currentValue); free(p_struct->defaultValue); GWEN_StringList2_free(p_struct->choices); p_struct->_refCount=0; GWEN_FREE_OBJECT(p_struct); } else p_struct->_refCount--; } }
void GWEN_Param_ReadXml(GWEN_PARAM *p_struct, GWEN_XMLNODE *p_db) { assert(p_struct); /* member "name" */ if (p_struct->name) { free(p_struct->name); } { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "name", NULL); if (s) p_struct->name=strdup(s); } if (p_struct->name==NULL) { /* member "name" is volatile, just presetting */ p_struct->name=NULL; } /* member "flags" */ p_struct->flags=GWEN_XMLNode_GetIntValue(p_db, "flags", 0); /* member "type" */ { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "type", NULL); if (s) p_struct->type=GWEN_Param_Type_fromString(s); else p_struct->type=GWEN_Param_Type_Unknown; } /* member "dataType" */ { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "dataType", NULL); if (s) p_struct->dataType=GWEN_Param_DataType_fromString(s); else p_struct->dataType=GWEN_Param_DataType_Unknown; } /* member "shortDescription" */ if (p_struct->shortDescription) { free(p_struct->shortDescription); } { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "shortDescription", NULL); if (s) p_struct->shortDescription=strdup(s); } if (p_struct->shortDescription==NULL) { /* member "shortDescription" is volatile, just presetting */ p_struct->shortDescription=NULL; } /* member "longDescription" */ if (p_struct->longDescription) { free(p_struct->longDescription); } { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "longDescription", NULL); if (s) p_struct->longDescription=strdup(s); } if (p_struct->longDescription==NULL) { /* member "longDescription" is volatile, just presetting */ p_struct->longDescription=NULL; } /* member "currentValue" */ if (p_struct->currentValue) { free(p_struct->currentValue); } { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "currentValue", NULL); if (s) p_struct->currentValue=strdup(s); } if (p_struct->currentValue==NULL) { /* member "currentValue" is volatile, just presetting */ p_struct->currentValue=NULL; } /* member "defaultValue" */ if (p_struct->defaultValue) { free(p_struct->defaultValue); } { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "defaultValue", NULL); if (s) p_struct->defaultValue=strdup(s); } if (p_struct->defaultValue==NULL) { /* member "defaultValue" is volatile, just presetting */ p_struct->defaultValue=NULL; } /* member "choices" */ if (p_struct->choices) { GWEN_StringList2_free(p_struct->choices); } { GWEN_XMLNODE *n; n=GWEN_XMLNode_FindFirstTag(p_db, "choices", 0, 0); if (n) { p_struct->choices=GWEN_StringList2_fromXml(n, GWEN_StringList2_IntertMode_AlwaysAdd); } else p_struct->choices=NULL; } if (p_struct->choices==NULL) { /* member "choices" is volatile, just presetting */ p_struct->choices=NULL; } /* member "internalIntValue" */ /* member "internalIntValue" is volatile, just presetting */ p_struct->internalIntValue=0; /* member "internalFloatValue" */ /* member "internalFloatValue" is volatile, just presetting */ p_struct->internalFloatValue=0; /* member "runtimeFlags" */ /* member "runtimeFlags" is volatile, just presetting */ p_struct->runtimeFlags=0; }
GWEN_PARAM *GWEN_Param_copy(GWEN_PARAM *p_struct, const GWEN_PARAM *p_src) { assert(p_struct); assert(p_src); /* member "name" */ if (p_struct->name) { free(p_struct->name); p_struct->name=NULL; } if (p_src->name) { p_struct->name=strdup(p_src->name); } /* member "flags" */ p_struct->flags=p_src->flags; /* member "type" */ p_struct->type=p_src->type; /* member "dataType" */ p_struct->dataType=p_src->dataType; /* member "shortDescription" */ if (p_struct->shortDescription) { free(p_struct->shortDescription); p_struct->shortDescription=NULL; } if (p_src->shortDescription) { p_struct->shortDescription=strdup(p_src->shortDescription); } /* member "longDescription" */ if (p_struct->longDescription) { free(p_struct->longDescription); p_struct->longDescription=NULL; } if (p_src->longDescription) { p_struct->longDescription=strdup(p_src->longDescription); } /* member "currentValue" */ if (p_struct->currentValue) { free(p_struct->currentValue); p_struct->currentValue=NULL; } if (p_src->currentValue) { p_struct->currentValue=strdup(p_src->currentValue); } /* member "defaultValue" */ if (p_struct->defaultValue) { free(p_struct->defaultValue); p_struct->defaultValue=NULL; } if (p_src->defaultValue) { p_struct->defaultValue=strdup(p_src->defaultValue); } /* member "choices" */ if (p_struct->choices) { GWEN_StringList2_free(p_struct->choices); p_struct->choices=NULL; } if (p_src->choices) { p_struct->choices=GWEN_StringList2_dup(p_src->choices); } /* member "internalIntValue" */ p_struct->internalIntValue=p_src->internalIntValue; /* member "internalFloatValue" */ p_struct->internalFloatValue=p_src->internalFloatValue; /* member "runtimeFlags" */ p_struct->runtimeFlags=p_src->runtimeFlags; return p_struct; }