From 5dee322ce245ef858b3d0e6591cdc19d76e4cb30 Mon Sep 17 00:00:00 2001 From: snowdrop Date: Thu, 3 Jun 2004 13:13:07 +0000 Subject: initial import --- wsdl2c/CallList.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 wsdl2c/CallList.c (limited to 'wsdl2c/CallList.c') diff --git a/wsdl2c/CallList.c b/wsdl2c/CallList.c new file mode 100644 index 0000000..62eafcb --- /dev/null +++ b/wsdl2c/CallList.c @@ -0,0 +1,116 @@ +/** Generated by xsd2c */ +#include +#include +#include +#include "CallList.h" + + +struct CallList* CallList_Create() +{ + struct CallList* _res; + _res = (struct CallList*)malloc(sizeof(struct CallList)); + + _res->operation_head = NULL; + _res->operation_tail = NULL; + + return _res; +} + +void CallList_Free(struct CallList* obj) +{ + struct CallFunc_List* operation_cur; + struct CallFunc_List* operation_tmp; + if (obj == NULL) return; + + operation_cur = obj->operation_head; + while (operation_cur != NULL) + { + operation_tmp = operation_cur->next; + free(operation_cur); + operation_cur = operation_tmp; + } + free(obj); +} + +void CallList_Sax_Serialize(struct CallList* obj, + const char *root_element_name, + void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData), + void (*OnCharacters)(const char* element_name, const char* chars, void* userData), + void (*OnEndElement)(const char* element_name, void* userData), + void* userData) +{ + int attrCount, curCount; + char **keys; + char **values; + char buffer[255]; + + struct CallFunc_List* operation_cur; + + attrCount = 0; + + keys = (char**)malloc(sizeof(char*)*attrCount); + values = (char**)malloc(sizeof(char*)*attrCount); + + curCount = 0; + + + OnStartElement(root_element_name, attrCount, keys, values, userData); + operation_cur = obj->operation_head; + while (operation_cur != NULL) + { + if (operation_cur->value) + CallFunc_Sax_Serialize(operation_cur->value, "operation", OnStartElement, OnCharacters, OnEndElement, userData); + + operation_cur = operation_cur->next; + } + + OnEndElement(root_element_name, userData); +} + +#ifndef _DESERIALIZER_DISABLED_ + +struct CallList* CallList_Deserialize(xmlNodePtr xmlRoot) +{ + xmlNodePtr cur; + xmlChar *key; + struct CallList* obj; + obj = CallList_Create(); + cur = xmlRoot->xmlChildrenNode; + while (cur != NULL) { + if (cur->type != XML_ELEMENT_NODE) { + cur = cur->next; + continue; + } + printf("CallList->%s\n", cur->name); + if ((!xmlStrcmp(cur->name, (const xmlChar *)"operation"))){ + CallList_Add_operation( obj, CallFunc_Deserialize(cur) ); + } + // TODO: + cur = cur->next; + } + return obj; +} + +#endif +struct CallFunc_List* CallList_Get_operation(struct CallList* obj) +{ + return obj->operation_head; +} + +void CallList_Add_operation(struct CallList* obj, struct CallFunc* operation) +{ + struct CallFunc_List* operation_node; + operation_node = (struct CallFunc_List*)malloc(sizeof(struct CallFunc_List)); + operation_node->value = operation; + operation_node->next = NULL; + if (obj->operation_tail) + { + obj->operation_tail->next = operation_node; + } + if (obj->operation_head == NULL) + { + obj->operation_head = operation_node; + } + obj->operation_tail = operation_node; +} + -- cgit v1.1-32-gdbae