1 /** Generated by xsd2c */
2 #include <stdio.h>
3 #include <string.h>
4 #include <stdlib.h>
5 #include "CallList.h"
6 
7 
CallList_Create()8 struct CallList* CallList_Create()
9 {
10 	struct CallList* _res;
11 	_res = (struct CallList*)malloc(sizeof(struct CallList));
12 
13 	_res->operation_head = NULL;
14 	_res->operation_tail = NULL;
15 
16 	return _res;
17 }
18 
CallList_Free(struct CallList * obj)19 void CallList_Free(struct CallList* obj)
20 {
21 	struct CallFunc_List* operation_cur;
22 	struct CallFunc_List* operation_tmp;
23 	if (obj == NULL) return;
24 
25 	operation_cur = obj->operation_head;
26 	while (operation_cur != NULL)
27 	{
28 		operation_tmp = operation_cur->next;
29 		free(operation_cur);
30 		operation_cur = operation_tmp;
31 	}
32 	free(obj);
33 }
34 
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)35 void CallList_Sax_Serialize(struct CallList* obj,
36 		 const char *root_element_name,
37 		 void (*OnStartElement)(const char* element_name, int attr_count, char **keys, char **values, void* userData),
38 		 void (*OnCharacters)(const char* element_name, const char* chars, void* userData),
39 		 void (*OnEndElement)(const char* element_name, void* userData),
40 		 void* userData)
41 {
42 	int attrCount, curCount;
43 	char **keys;
44 	char **values;
45 	char buffer[255];
46 
47 	struct CallFunc_List* operation_cur;
48 
49 	attrCount = 0;
50 
51 	keys = (char**)malloc(sizeof(char*)*attrCount);
52 	values = (char**)malloc(sizeof(char*)*attrCount);
53 
54 	curCount = 0;
55 
56 
57 	OnStartElement(root_element_name, attrCount, keys, values, userData);
58 	operation_cur = obj->operation_head;
59 	while (operation_cur != NULL)
60 	{
61 	if (operation_cur->value)
62 		CallFunc_Sax_Serialize(operation_cur->value, "operation", OnStartElement, OnCharacters, OnEndElement, userData);
63 
64 		operation_cur = operation_cur->next;
65 	}
66 
67 	OnEndElement(root_element_name, userData);
68 }
69 
70 #ifndef _DESERIALIZER_DISABLED_
71 
CallList_Deserialize(xmlNodePtr xmlRoot)72 struct CallList* CallList_Deserialize(xmlNodePtr xmlRoot)
73 {
74 	xmlNodePtr cur;
75 	xmlChar *key;
76 	struct CallList* obj;
77 	obj = CallList_Create();
78 	cur = xmlRoot->xmlChildrenNode;
79 	while (cur != NULL) {
80 		if (cur->type != XML_ELEMENT_NODE) {
81 			cur = cur->next;
82 			continue;
83 		}
84 		printf("CallList->%s\n", cur->name);
85 		if ((!xmlStrcmp(cur->name, (const xmlChar *)"operation"))){
86 			CallList_Add_operation( obj, CallFunc_Deserialize(cur) );
87 		}
88 	// TODO:
89 		cur = cur->next;
90 	}
91 	return obj;
92 }
93 
94 #endif
CallList_Get_operation(struct CallList * obj)95 struct CallFunc_List* CallList_Get_operation(struct CallList* obj)
96 {
97 	return obj->operation_head;
98 }
99 
CallList_Add_operation(struct CallList * obj,struct CallFunc * operation)100 void CallList_Add_operation(struct CallList* obj, struct CallFunc* operation)
101 {
102 	struct CallFunc_List* operation_node;
103 	operation_node = (struct CallFunc_List*)malloc(sizeof(struct CallFunc_List));
104 	operation_node->value = operation;
105 	operation_node->next = NULL;
106 	if (obj->operation_tail)
107 	{
108 		obj->operation_tail->next = operation_node;
109 	}
110 	if (obj->operation_head == NULL)
111 	{
112 		obj->operation_head = operation_node;
113 	}
114 	obj->operation_tail = operation_node;
115 }
116 
117