gwenhywfar  4.99.8beta
tm_slot.c
Go to the documentation of this file.
1 /**********************************************************
2  * This file has been automatically created by "typemaker2"
3  * from the file "tm_slot.xml".
4  * Please do not edit this file, all changes will be lost.
5  * Better edit the mentioned source file instead.
6  **********************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 # include <config.h>
10 #endif
11 
12 #include "tm_slot_p.h"
13 
14 #include <gwenhywfar/misc.h>
15 #include <gwenhywfar/debug.h>
16 
17 /* code headers */
18 
19 /* macro functions */
20 GWEN_LIST_FUNCTIONS(TYPEMAKER2_SLOT, Typemaker2_Slot)
21 GWEN_LIST2_FUNCTIONS(TYPEMAKER2_SLOT, Typemaker2_Slot)
22 
23 
24 TYPEMAKER2_SLOT *Typemaker2_Slot_new(void) {
25  TYPEMAKER2_SLOT *p_struct;
26 
27  GWEN_NEW_OBJECT(TYPEMAKER2_SLOT, p_struct)
28  GWEN_LIST_INIT(TYPEMAKER2_SLOT, p_struct)
29  /* members */
30  p_struct->name=NULL;
31  p_struct->paramType1=NULL;
32  p_struct->paramType2=NULL;
33  p_struct->flags=0;
34  /* virtual functions */
35 
36  return p_struct;
37 }
38 
40  if (p_struct) {
42  /* members */
43  free(p_struct->name);
44  free(p_struct->paramType1);
45  free(p_struct->paramType2);
46  GWEN_FREE_OBJECT(p_struct);
47  }
48 }
49 
51  TYPEMAKER2_SLOT *p_struct;
52 
53  assert(p_src);
54  p_struct=Typemaker2_Slot_new();
55  /* member "name" */
56  if (p_struct->name) {
57  free(p_struct->name);
58  p_struct->name=NULL;
59  }
60  if (p_src->name) {
61  p_struct->name=strdup(p_src->name);
62  }
63 
64  /* member "paramType1" */
65  if (p_struct->paramType1) {
66  free(p_struct->paramType1);
67  p_struct->paramType1=NULL;
68  }
69  if (p_src->paramType1) {
70  p_struct->paramType1=strdup(p_src->paramType1);
71  }
72 
73  /* member "paramType2" */
74  if (p_struct->paramType2) {
75  free(p_struct->paramType2);
76  p_struct->paramType2=NULL;
77  }
78  if (p_src->paramType2) {
79  p_struct->paramType2=strdup(p_src->paramType2);
80  }
81 
82  /* member "flags" */
83  p_struct->flags=p_src->flags;
84 
85  return p_struct;
86 }
87 
89  assert(p_struct);
90  assert(p_src);
91  /* member "name" */
92  if (p_struct->name) {
93  free(p_struct->name);
94  p_struct->name=NULL;
95  }
96  if (p_src->name) {
97  p_struct->name=strdup(p_src->name);
98  }
99 
100  /* member "paramType1" */
101  if (p_struct->paramType1) {
102  free(p_struct->paramType1);
103  p_struct->paramType1=NULL;
104  }
105  if (p_src->paramType1) {
106  p_struct->paramType1=strdup(p_src->paramType1);
107  }
108 
109  /* member "paramType2" */
110  if (p_struct->paramType2) {
111  free(p_struct->paramType2);
112  p_struct->paramType2=NULL;
113  }
114  if (p_src->paramType2) {
115  p_struct->paramType2=strdup(p_src->paramType2);
116  }
117 
118  /* member "flags" */
119  p_struct->flags=p_src->flags;
120 
121  return p_struct;
122 }
123 
124 const char *Typemaker2_Slot_GetName(const TYPEMAKER2_SLOT *p_struct) {
125  assert(p_struct);
126  return p_struct->name;
127 }
128 
129 const char *Typemaker2_Slot_GetParamType1(const TYPEMAKER2_SLOT *p_struct) {
130  assert(p_struct);
131  return p_struct->paramType1;
132 }
133 
134 const char *Typemaker2_Slot_GetParamType2(const TYPEMAKER2_SLOT *p_struct) {
135  assert(p_struct);
136  return p_struct->paramType2;
137 }
138 
139 uint32_t Typemaker2_Slot_GetFlags(const TYPEMAKER2_SLOT *p_struct) {
140  assert(p_struct);
141  return p_struct->flags;
142 }
143 
144 void Typemaker2_Slot_SetName(TYPEMAKER2_SLOT *p_struct, const char *p_src) {
145  assert(p_struct);
146  if (p_struct->name) {
147  free(p_struct->name);
148  }
149  if (p_src) {
150  p_struct->name=strdup(p_src);
151  }
152  else {
153  p_struct->name=NULL;
154  }
155 }
156 
157 void Typemaker2_Slot_SetParamType1(TYPEMAKER2_SLOT *p_struct, const char *p_src) {
158  assert(p_struct);
159  if (p_struct->paramType1) {
160  free(p_struct->paramType1);
161  }
162  if (p_src) {
163  p_struct->paramType1=strdup(p_src);
164  }
165  else {
166  p_struct->paramType1=NULL;
167  }
168 }
169 
170 void Typemaker2_Slot_SetParamType2(TYPEMAKER2_SLOT *p_struct, const char *p_src) {
171  assert(p_struct);
172  if (p_struct->paramType2) {
173  free(p_struct->paramType2);
174  }
175  if (p_src) {
176  p_struct->paramType2=strdup(p_src);
177  }
178  else {
179  p_struct->paramType2=NULL;
180  }
181 }
182 
183 void Typemaker2_Slot_SetFlags(TYPEMAKER2_SLOT *p_struct, uint32_t p_src) {
184  assert(p_struct);
185  p_struct->flags=p_src;
186 }
187 
188 void Typemaker2_Slot_AddFlags(TYPEMAKER2_SLOT *p_struct, uint32_t p_src) {
189  assert(p_struct);
190  p_struct->flags|=p_src;
191 }
192 
193 void Typemaker2_Slot_SubFlags(TYPEMAKER2_SLOT *p_struct, uint32_t p_src) {
194  assert(p_struct);
195  p_struct->flags&=~p_src;
196 }
197 
198 TYPEMAKER2_SLOT_LIST *Typemaker2_Slot_List_dup(const TYPEMAKER2_SLOT_LIST *p_src) {
199  TYPEMAKER2_SLOT_LIST *p_dest;
200  TYPEMAKER2_SLOT *p_elem;
201 
202  assert(p_src);
203  p_dest=Typemaker2_Slot_List_new();
204  p_elem=Typemaker2_Slot_List_First(p_src);
205  while(p_elem) {
206  TYPEMAKER2_SLOT *p_cpy;
207 
208  p_cpy=Typemaker2_Slot_dup(p_elem);
209  Typemaker2_Slot_List_Add(p_cpy, p_dest);
210  p_elem=Typemaker2_Slot_List_Next(p_elem);
211  }
212 
213  return p_dest;
214 }
215 
217  assert(p_struct);
218  /* member "name" */
219  if (p_struct->name) {
220  free(p_struct->name);
221  }
222  { const char *s; s=GWEN_XMLNode_GetProperty(p_db, "name", NULL); if (s) p_struct->name=strdup(s); }
223  if (p_struct->name==NULL) { /* member "name" is volatile, just presetting */
224  p_struct->name=NULL;
225  }
226 
227  /* member "paramType1" */
228  if (p_struct->paramType1) {
229  free(p_struct->paramType1);
230  }
231  { const char *s; s=GWEN_XMLNode_GetProperty(p_db, "paramType1", NULL); if (s) p_struct->paramType1=strdup(s); }
232  if (p_struct->paramType1==NULL) { /* member "paramType1" is volatile, just presetting */
233  p_struct->paramType1=NULL;
234  }
235 
236  /* member "paramType2" */
237  if (p_struct->paramType2) {
238  free(p_struct->paramType2);
239  }
240  { const char *s; s=GWEN_XMLNode_GetProperty(p_db, "paramType2", NULL); if (s) p_struct->paramType2=strdup(s); }
241  if (p_struct->paramType2==NULL) { /* member "paramType2" is volatile, just presetting */
242  p_struct->paramType2=NULL;
243  }
244 
245  /* member "flags" */
246  p_struct->flags=GWEN_XMLNode_GetIntValue(p_db, "flags", 0);
247 
248 }
249 
251  assert(p_struct);
252  /* member "name" */
253  GWEN_XMLNode_SetProperty(p_db, "name", p_struct->name);
254 
255  /* member "paramType1" */
256  GWEN_XMLNode_SetProperty(p_db, "paramType1", p_struct->paramType1);
257 
258  /* member "paramType2" */
259  GWEN_XMLNode_SetProperty(p_db, "paramType2", p_struct->paramType2);
260 
261  /* member "flags" */
262  GWEN_XMLNode_SetIntValue(p_db, "flags", p_struct->flags);
263 
264 }
265 
266 void Typemaker2_Slot_toXml(const TYPEMAKER2_SLOT *p_struct, GWEN_XMLNODE *p_db) {
267  Typemaker2_Slot_WriteXml(p_struct, p_db);
268 }
269 
271  TYPEMAKER2_SLOT *p_struct;
272  p_struct=Typemaker2_Slot_new();
273  Typemaker2_Slot_ReadXml(p_struct, p_db);
274  return p_struct;
275 }
276 
277 
278 /* code headers */
279 
const char * GWEN_XMLNode_GetProperty(const GWEN_XMLNODE *n, const char *name, const char *defaultValue)
Definition: xml.c:228
void Typemaker2_Slot_WriteXml(const TYPEMAKER2_SLOT *p_struct, GWEN_XMLNODE *p_db)
Definition: tm_slot.c:250
TYPEMAKER2_SLOT * Typemaker2_Slot_new(void)
Definition: tm_slot.c:24
TYPEMAKER2_SLOT * Typemaker2_Slot_fromXml(GWEN_XMLNODE *p_db)
Definition: tm_slot.c:270
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:92
#define NULL
Definition: binreloc.c:290
struct TYPEMAKER2_SLOT TYPEMAKER2_SLOT
Definition: tm_slot.h:27
void GWEN_XMLNode_SetProperty(GWEN_XMLNODE *n, const char *name, const char *value)
Definition: xml.c:308
void Typemaker2_Slot_free(TYPEMAKER2_SLOT *p_struct)
Definition: tm_slot.c:39
int GWEN_XMLNode_GetIntValue(const GWEN_XMLNODE *n, const char *name, int defValue)
Definition: xml.c:837
TYPEMAKER2_SLOT_LIST * Typemaker2_Slot_List_dup(const TYPEMAKER2_SLOT_LIST *p_src)
Definition: tm_slot.c:198
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:86
void Typemaker2_Slot_toXml(const TYPEMAKER2_SLOT *p_struct, GWEN_XMLNODE *p_db)
Definition: tm_slot.c:266
uint32_t Typemaker2_Slot_GetFlags(const TYPEMAKER2_SLOT *p_struct)
Definition: tm_slot.c:139
const char * Typemaker2_Slot_GetName(const TYPEMAKER2_SLOT *p_struct)
Definition: tm_slot.c:124
void Typemaker2_Slot_SetFlags(TYPEMAKER2_SLOT *p_struct, uint32_t p_src)
Definition: tm_slot.c:183
GWEN_LIST2_FUNCTIONS(TYPEMAKER2_TYPE, Typemaker2_Type)
TYPEMAKER2_SLOT * Typemaker2_Slot_copy(TYPEMAKER2_SLOT *p_struct, const TYPEMAKER2_SLOT *p_src)
Definition: tm_slot.c:88
void Typemaker2_Slot_SetParamType2(TYPEMAKER2_SLOT *p_struct, const char *p_src)
Definition: tm_slot.c:170
const char * Typemaker2_Slot_GetParamType2(const TYPEMAKER2_SLOT *p_struct)
Definition: tm_slot.c:134
void Typemaker2_Slot_ReadXml(TYPEMAKER2_SLOT *p_struct, GWEN_XMLNODE *p_db)
Definition: tm_slot.c:216
#define GWEN_LIST_INIT(t, element)
Definition: list1.h:465
const char * Typemaker2_Slot_GetParamType1(const TYPEMAKER2_SLOT *p_struct)
Definition: tm_slot.c:129
#define GWEN_LIST_FUNCTIONS(t, pr)
Definition: list1.h:366
void Typemaker2_Slot_SetParamType1(TYPEMAKER2_SLOT *p_struct, const char *p_src)
Definition: tm_slot.c:157
void Typemaker2_Slot_AddFlags(TYPEMAKER2_SLOT *p_struct, uint32_t p_src)
Definition: tm_slot.c:188
#define GWEN_LIST_FINI(t, element)
Definition: list1.h:474
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:148
TYPEMAKER2_SLOT * Typemaker2_Slot_dup(const TYPEMAKER2_SLOT *p_src)
Definition: tm_slot.c:50
void Typemaker2_Slot_SubFlags(TYPEMAKER2_SLOT *p_struct, uint32_t p_src)
Definition: tm_slot.c:193
void Typemaker2_Slot_SetName(TYPEMAKER2_SLOT *p_struct, const char *p_src)
Definition: tm_slot.c:144
void GWEN_XMLNode_SetIntValue(GWEN_XMLNODE *n, const char *name, int value)
Definition: xml.c:853