1 /**********************************************************
2 * This file has been automatically created by "typemaker2"
3 * from the file "user.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 "./user_p.h"
13
14 #include <gwenhywfar/misc.h>
15 #include <gwenhywfar/debug.h>
16
17 /* code headers */
18
19 /* macro functions */
GWEN_LIST_FUNCTIONS(AB_USER,AB_User)20 GWEN_LIST_FUNCTIONS(AB_USER, AB_User)
21 GWEN_LIST2_FUNCTIONS(AB_USER, AB_User)
22 GWEN_INHERIT_FUNCTIONS(AB_USER)
23
24
25 AB_USER *AB_User_new(void)
26 {
27 AB_USER *p_struct;
28
29 GWEN_NEW_OBJECT(AB_USER, p_struct)
30 p_struct->_refCount=1;
31 GWEN_INHERIT_INIT(AB_USER, p_struct)
32 GWEN_LIST_INIT(AB_USER, p_struct)
33 /* members */
34 p_struct->uniqueId=0;
35 p_struct->backendName=NULL;
36 p_struct->userName=NULL;
37 p_struct->userId=NULL;
38 p_struct->customerId=NULL;
39 p_struct->country=NULL;
40 p_struct->bankCode=NULL;
41 p_struct->provider=NULL;
42 p_struct->certDb=NULL;
43 p_struct->lastSessionId=0;
44 /* virtual functions */
45 p_struct->readFromDbFn=AB_User__ReadFromDb;
46 p_struct->writeToDbFn=AB_User__WriteToDb;
47
48 return p_struct;
49 }
50
AB_User_free(AB_USER * p_struct)51 void AB_User_free(AB_USER *p_struct)
52 {
53 if (p_struct) {
54 assert(p_struct->_refCount);
55 if (p_struct->_refCount==1) {
56 GWEN_INHERIT_FINI(AB_USER, p_struct)
57 GWEN_LIST_FINI(AB_USER, p_struct)
58 /* members */
59 free(p_struct->backendName);
60 p_struct->backendName=NULL;
61 free(p_struct->userName);
62 p_struct->userName=NULL;
63 free(p_struct->userId);
64 p_struct->userId=NULL;
65 free(p_struct->customerId);
66 p_struct->customerId=NULL;
67 free(p_struct->country);
68 p_struct->country=NULL;
69 free(p_struct->bankCode);
70 p_struct->bankCode=NULL;
71 GWEN_DB_Group_free(p_struct->certDb);
72 p_struct->certDb=NULL;
73 p_struct->_refCount=0;
74 GWEN_FREE_OBJECT(p_struct);
75 }
76 else
77 p_struct->_refCount--;
78 }
79 }
80
AB_User_Attach(AB_USER * p_struct)81 void AB_User_Attach(AB_USER *p_struct)
82 {
83 assert(p_struct);
84 assert(p_struct->_refCount);
85 p_struct->_refCount++;
86 }
87
AB_User_GetUniqueId(const AB_USER * p_struct)88 uint32_t AB_User_GetUniqueId(const AB_USER *p_struct)
89 {
90 assert(p_struct);
91 return p_struct->uniqueId;
92 }
93
AB_User_GetBackendName(const AB_USER * p_struct)94 const char *AB_User_GetBackendName(const AB_USER *p_struct)
95 {
96 assert(p_struct);
97 return p_struct->backendName;
98 }
99
AB_User_GetUserName(const AB_USER * p_struct)100 const char *AB_User_GetUserName(const AB_USER *p_struct)
101 {
102 assert(p_struct);
103 return p_struct->userName;
104 }
105
AB_User_GetUserId(const AB_USER * p_struct)106 const char *AB_User_GetUserId(const AB_USER *p_struct)
107 {
108 assert(p_struct);
109 return p_struct->userId;
110 }
111
AB_User_GetCustomerId(const AB_USER * p_struct)112 const char *AB_User_GetCustomerId(const AB_USER *p_struct)
113 {
114 assert(p_struct);
115 return p_struct->customerId;
116 }
117
AB_User_GetCountry(const AB_USER * p_struct)118 const char *AB_User_GetCountry(const AB_USER *p_struct)
119 {
120 assert(p_struct);
121 return p_struct->country;
122 }
123
AB_User_GetBankCode(const AB_USER * p_struct)124 const char *AB_User_GetBankCode(const AB_USER *p_struct)
125 {
126 assert(p_struct);
127 return p_struct->bankCode;
128 }
129
AB_User_GetProvider(const AB_USER * p_struct)130 AB_PROVIDER *AB_User_GetProvider(const AB_USER *p_struct)
131 {
132 assert(p_struct);
133 return p_struct->provider;
134 }
135
AB_User_GetCertDb(const AB_USER * p_struct)136 GWEN_DB_NODE *AB_User_GetCertDb(const AB_USER *p_struct)
137 {
138 assert(p_struct);
139 return p_struct->certDb;
140 }
141
AB_User_GetLastSessionId(const AB_USER * p_struct)142 uint32_t AB_User_GetLastSessionId(const AB_USER *p_struct)
143 {
144 assert(p_struct);
145 return p_struct->lastSessionId;
146 }
147
AB_User_SetUniqueId(AB_USER * p_struct,uint32_t p_src)148 void AB_User_SetUniqueId(AB_USER *p_struct, uint32_t p_src)
149 {
150 assert(p_struct);
151 p_struct->uniqueId=p_src;
152 }
153
AB_User_SetBackendName(AB_USER * p_struct,const char * p_src)154 void AB_User_SetBackendName(AB_USER *p_struct, const char *p_src)
155 {
156 assert(p_struct);
157 if (p_struct->backendName) {
158 free(p_struct->backendName);
159 p_struct->backendName=NULL;
160 }
161 if (p_src) {
162 p_struct->backendName=strdup(p_src);
163 }
164 else {
165 p_struct->backendName=NULL;
166 }
167 }
168
AB_User_SetUserName(AB_USER * p_struct,const char * p_src)169 void AB_User_SetUserName(AB_USER *p_struct, const char *p_src)
170 {
171 assert(p_struct);
172 if (p_struct->userName) {
173 free(p_struct->userName);
174 p_struct->userName=NULL;
175 }
176 if (p_src) {
177 p_struct->userName=strdup(p_src);
178 }
179 else {
180 p_struct->userName=NULL;
181 }
182 }
183
AB_User_SetUserId(AB_USER * p_struct,const char * p_src)184 void AB_User_SetUserId(AB_USER *p_struct, const char *p_src)
185 {
186 assert(p_struct);
187 if (p_struct->userId) {
188 free(p_struct->userId);
189 p_struct->userId=NULL;
190 }
191 if (p_src) {
192 p_struct->userId=strdup(p_src);
193 }
194 else {
195 p_struct->userId=NULL;
196 }
197 }
198
AB_User_SetCustomerId(AB_USER * p_struct,const char * p_src)199 void AB_User_SetCustomerId(AB_USER *p_struct, const char *p_src)
200 {
201 assert(p_struct);
202 if (p_struct->customerId) {
203 free(p_struct->customerId);
204 p_struct->customerId=NULL;
205 }
206 if (p_src) {
207 p_struct->customerId=strdup(p_src);
208 }
209 else {
210 p_struct->customerId=NULL;
211 }
212 }
213
AB_User_SetCountry(AB_USER * p_struct,const char * p_src)214 void AB_User_SetCountry(AB_USER *p_struct, const char *p_src)
215 {
216 assert(p_struct);
217 if (p_struct->country) {
218 free(p_struct->country);
219 p_struct->country=NULL;
220 }
221 if (p_src) {
222 p_struct->country=strdup(p_src);
223 }
224 else {
225 p_struct->country=NULL;
226 }
227 }
228
AB_User_SetBankCode(AB_USER * p_struct,const char * p_src)229 void AB_User_SetBankCode(AB_USER *p_struct, const char *p_src)
230 {
231 assert(p_struct);
232 if (p_struct->bankCode) {
233 free(p_struct->bankCode);
234 p_struct->bankCode=NULL;
235 }
236 if (p_src) {
237 p_struct->bankCode=strdup(p_src);
238 }
239 else {
240 p_struct->bankCode=NULL;
241 }
242 }
243
AB_User_SetProvider(AB_USER * p_struct,AB_PROVIDER * p_src)244 void AB_User_SetProvider(AB_USER *p_struct, AB_PROVIDER *p_src)
245 {
246 assert(p_struct);
247 p_struct->provider=p_src;
248 }
249
AB_User_SetCertDb(AB_USER * p_struct,GWEN_DB_NODE * p_src)250 void AB_User_SetCertDb(AB_USER *p_struct, GWEN_DB_NODE *p_src)
251 {
252 assert(p_struct);
253 if (p_struct->certDb) {
254 GWEN_DB_Group_free(p_struct->certDb);
255 p_struct->certDb=NULL;
256 }
257 p_struct->certDb=p_src;
258 }
259
AB_User_SetLastSessionId(AB_USER * p_struct,uint32_t p_src)260 void AB_User_SetLastSessionId(AB_USER *p_struct, uint32_t p_src)
261 {
262 assert(p_struct);
263 p_struct->lastSessionId=p_src;
264 }
265
266 /* code for virtual functions */
AB_User_ReadFromDb(AB_USER * p_struct,GWEN_DB_NODE * dbData)267 int AB_User_ReadFromDb(AB_USER *p_struct, GWEN_DB_NODE *dbData)
268 {
269 assert(p_struct);
270 if (p_struct->readFromDbFn)
271 return p_struct->readFromDbFn(p_struct, dbData);
272 else
273 return GWEN_ERROR_NOT_IMPLEMENTED;
274 }
275
AB_User_WriteToDb(const AB_USER * p_struct,GWEN_DB_NODE * dbData)276 int AB_User_WriteToDb(const AB_USER *p_struct, GWEN_DB_NODE *dbData)
277 {
278 assert(p_struct);
279 if (p_struct->writeToDbFn)
280 return p_struct->writeToDbFn(p_struct, dbData);
281 else
282 return GWEN_ERROR_NOT_IMPLEMENTED;
283 }
284
285 /* setters for virtual functions */
AB_User_SetReadFromDbFn(AB_USER * p_struct,AB_USER_READFROMDB_FN fn)286 AB_USER_READFROMDB_FN AB_User_SetReadFromDbFn(AB_USER *p_struct, AB_USER_READFROMDB_FN fn)
287 {
288 AB_USER_READFROMDB_FN oldFn;
289
290 assert(p_struct);
291 oldFn=p_struct->readFromDbFn;
292 p_struct->readFromDbFn=fn;
293 return oldFn;
294 }
295
AB_User_SetWriteToDbFn(AB_USER * p_struct,AB_USER_WRITETODB_FN fn)296 AB_USER_WRITETODB_FN AB_User_SetWriteToDbFn(AB_USER *p_struct, AB_USER_WRITETODB_FN fn)
297 {
298 AB_USER_WRITETODB_FN oldFn;
299
300 assert(p_struct);
301 oldFn=p_struct->writeToDbFn;
302 p_struct->writeToDbFn=fn;
303 return oldFn;
304 }
305
306 /* getters for virtual functions */
AB_User_GetReadFromDbFn(const AB_USER * p_struct)307 AB_USER_READFROMDB_FN AB_User_GetReadFromDbFn(const AB_USER *p_struct)
308 {
309 assert(p_struct);
310 return p_struct->readFromDbFn;
311 }
312
AB_User_GetWriteToDbFn(const AB_USER * p_struct)313 AB_USER_WRITETODB_FN AB_User_GetWriteToDbFn(const AB_USER *p_struct)
314 {
315 assert(p_struct);
316 return p_struct->writeToDbFn;
317 }
318
AB_User_ReadDb(AB_USER * p_struct,GWEN_DB_NODE * p_db)319 void AB_User_ReadDb(AB_USER *p_struct, GWEN_DB_NODE *p_db)
320 {
321 assert(p_struct);
322 /* member "uniqueId" */
323 p_struct->uniqueId=GWEN_DB_GetIntValue(p_db, "uniqueId", 0, 0);
324
325 /* member "backendName" */
326 if (p_struct->backendName) {
327 free(p_struct->backendName);
328 p_struct->backendName=NULL;
329 }
330 {
331 const char *s;
332 s=GWEN_DB_GetCharValue(p_db, "backendName", 0, NULL);
333 if (s)
334 p_struct->backendName=strdup(s);
335 }
336 if (p_struct->backendName==NULL) {
337 p_struct->backendName=NULL;
338 }
339
340 /* member "userName" */
341 if (p_struct->userName) {
342 free(p_struct->userName);
343 p_struct->userName=NULL;
344 }
345 {
346 const char *s;
347 s=GWEN_DB_GetCharValue(p_db, "userName", 0, NULL);
348 if (s)
349 p_struct->userName=strdup(s);
350 }
351 if (p_struct->userName==NULL) {
352 p_struct->userName=NULL;
353 }
354
355 /* member "userId" */
356 if (p_struct->userId) {
357 free(p_struct->userId);
358 p_struct->userId=NULL;
359 }
360 {
361 const char *s;
362 s=GWEN_DB_GetCharValue(p_db, "userId", 0, NULL);
363 if (s)
364 p_struct->userId=strdup(s);
365 }
366 if (p_struct->userId==NULL) {
367 p_struct->userId=NULL;
368 }
369
370 /* member "customerId" */
371 if (p_struct->customerId) {
372 free(p_struct->customerId);
373 p_struct->customerId=NULL;
374 }
375 {
376 const char *s;
377 s=GWEN_DB_GetCharValue(p_db, "customerId", 0, NULL);
378 if (s)
379 p_struct->customerId=strdup(s);
380 }
381 if (p_struct->customerId==NULL) {
382 p_struct->customerId=NULL;
383 }
384
385 /* member "country" */
386 if (p_struct->country) {
387 free(p_struct->country);
388 p_struct->country=NULL;
389 }
390 {
391 const char *s;
392 s=GWEN_DB_GetCharValue(p_db, "country", 0, NULL);
393 if (s)
394 p_struct->country=strdup(s);
395 }
396 if (p_struct->country==NULL) {
397 p_struct->country=NULL;
398 }
399
400 /* member "bankCode" */
401 if (p_struct->bankCode) {
402 free(p_struct->bankCode);
403 p_struct->bankCode=NULL;
404 }
405 {
406 const char *s;
407 s=GWEN_DB_GetCharValue(p_db, "bankCode", 0, NULL);
408 if (s)
409 p_struct->bankCode=strdup(s);
410 }
411 if (p_struct->bankCode==NULL) {
412 p_struct->bankCode=NULL;
413 }
414
415 /* member "provider" */
416 /* member "provider" is volatile, just presetting */
417 p_struct->provider=NULL;
418
419 /* member "certDb" */
420 if (p_struct->certDb) {
421 GWEN_DB_Group_free(p_struct->certDb);
422 p_struct->certDb=NULL;
423 }
424 {
425 GWEN_DB_NODE *dbSrc;
426 dbSrc=GWEN_DB_GetGroup(p_db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "certDb");
427 if (dbSrc) {
428 p_struct->certDb=GWEN_DB_Group_dup(dbSrc);
429 }
430 else
431 p_struct->certDb=NULL;
432 }
433 if (p_struct->certDb==NULL) {
434 p_struct->certDb=NULL;
435 }
436
437 /* member "lastSessionId" */
438 p_struct->lastSessionId=GWEN_DB_GetIntValue(p_db, "lastSessionId", 0, 0);
439
440 }
441
AB_User_WriteDb(const AB_USER * p_struct,GWEN_DB_NODE * p_db)442 int AB_User_WriteDb(const AB_USER *p_struct, GWEN_DB_NODE *p_db)
443 {
444 int p_rv;
445
446 assert(p_struct);
447 /* member "uniqueId" */
448 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "uniqueId", p_struct->uniqueId);
449 if (p_rv<0) {
450 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
451 return p_rv;
452 }
453
454 /* member "backendName" */
455 if (p_struct->backendName)
456 p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "backendName", p_struct->backendName);
457 else {
458 GWEN_DB_DeleteVar(p_db, "backendName");
459 p_rv=0;
460 }
461 if (p_rv<0) {
462 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
463 return p_rv;
464 }
465
466 /* member "userName" */
467 if (p_struct->userName)
468 p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "userName", p_struct->userName);
469 else {
470 GWEN_DB_DeleteVar(p_db, "userName");
471 p_rv=0;
472 }
473 if (p_rv<0) {
474 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
475 return p_rv;
476 }
477
478 /* member "userId" */
479 if (p_struct->userId)
480 p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "userId", p_struct->userId);
481 else {
482 GWEN_DB_DeleteVar(p_db, "userId");
483 p_rv=0;
484 }
485 if (p_rv<0) {
486 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
487 return p_rv;
488 }
489
490 /* member "customerId" */
491 if (p_struct->customerId)
492 p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "customerId", p_struct->customerId);
493 else {
494 GWEN_DB_DeleteVar(p_db, "customerId");
495 p_rv=0;
496 }
497 if (p_rv<0) {
498 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
499 return p_rv;
500 }
501
502 /* member "country" */
503 if (p_struct->country)
504 p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "country", p_struct->country);
505 else {
506 GWEN_DB_DeleteVar(p_db, "country");
507 p_rv=0;
508 }
509 if (p_rv<0) {
510 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
511 return p_rv;
512 }
513
514 /* member "bankCode" */
515 if (p_struct->bankCode)
516 p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankCode", p_struct->bankCode);
517 else {
518 GWEN_DB_DeleteVar(p_db, "bankCode");
519 p_rv=0;
520 }
521 if (p_rv<0) {
522 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
523 return p_rv;
524 }
525
526 /* member "provider" is volatile, not writing to db */
527
528 /* member "certDb" */
529 if (p_struct->certDb) {
530 GWEN_DB_NODE *dbCopy;
531 dbCopy=GWEN_DB_GetGroup(p_db, GWEN_DB_FLAGS_DEFAULT, "certDb");
532 assert(dbCopy);
533 p_rv=GWEN_DB_AddGroupChildren(dbCopy, p_struct->certDb);
534 }
535 else {
536 GWEN_DB_DeleteGroup(p_db, "certDb");
537 p_rv=0;
538 }
539 if (p_rv<0) {
540 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
541 return p_rv;
542 }
543
544 /* member "lastSessionId" */
545 p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "lastSessionId", p_struct->lastSessionId);
546 if (p_rv<0) {
547 DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
548 return p_rv;
549 }
550
551 return 0;
552 }
553
AB_User_fromDb(GWEN_DB_NODE * p_db)554 AB_USER *AB_User_fromDb(GWEN_DB_NODE *p_db)
555 {
556 AB_USER *p_struct;
557 p_struct=AB_User_new();
558 AB_User_ReadDb(p_struct, p_db);
559 return p_struct;
560 }
561
AB_User_toDb(const AB_USER * p_struct,GWEN_DB_NODE * p_db)562 int AB_User_toDb(const AB_USER *p_struct, GWEN_DB_NODE *p_db)
563 {
564 return AB_User_WriteDb(p_struct, p_db);
565 }
566
AB_User_ReadXml(AB_USER * p_struct,GWEN_XMLNODE * p_db)567 void AB_User_ReadXml(AB_USER *p_struct, GWEN_XMLNODE *p_db)
568 {
569 assert(p_struct);
570 /* member "uniqueId" */
571 p_struct->uniqueId=GWEN_XMLNode_GetIntValue(p_db, "uniqueId", 0);
572
573 /* member "backendName" */
574 if (p_struct->backendName) {
575 free(p_struct->backendName);
576 p_struct->backendName=NULL;
577 }
578 {
579 const char *s;
580 s=GWEN_XMLNode_GetCharValue(p_db, "backendName", NULL);
581 if (s)
582 p_struct->backendName=strdup(s);
583 }
584 if (p_struct->backendName==NULL) { /* preset member "backendName" if empty */
585 p_struct->backendName=NULL;
586 }
587
588 /* member "userName" */
589 if (p_struct->userName) {
590 free(p_struct->userName);
591 p_struct->userName=NULL;
592 }
593 {
594 const char *s;
595 s=GWEN_XMLNode_GetCharValue(p_db, "userName", NULL);
596 if (s)
597 p_struct->userName=strdup(s);
598 }
599 if (p_struct->userName==NULL) { /* preset member "userName" if empty */
600 p_struct->userName=NULL;
601 }
602
603 /* member "userId" */
604 if (p_struct->userId) {
605 free(p_struct->userId);
606 p_struct->userId=NULL;
607 }
608 {
609 const char *s;
610 s=GWEN_XMLNode_GetCharValue(p_db, "userId", NULL);
611 if (s)
612 p_struct->userId=strdup(s);
613 }
614 if (p_struct->userId==NULL) { /* preset member "userId" if empty */
615 p_struct->userId=NULL;
616 }
617
618 /* member "customerId" */
619 if (p_struct->customerId) {
620 free(p_struct->customerId);
621 p_struct->customerId=NULL;
622 }
623 {
624 const char *s;
625 s=GWEN_XMLNode_GetCharValue(p_db, "customerId", NULL);
626 if (s)
627 p_struct->customerId=strdup(s);
628 }
629 if (p_struct->customerId==NULL) { /* preset member "customerId" if empty */
630 p_struct->customerId=NULL;
631 }
632
633 /* member "country" */
634 if (p_struct->country) {
635 free(p_struct->country);
636 p_struct->country=NULL;
637 }
638 {
639 const char *s;
640 s=GWEN_XMLNode_GetCharValue(p_db, "country", NULL);
641 if (s)
642 p_struct->country=strdup(s);
643 }
644 if (p_struct->country==NULL) { /* preset member "country" if empty */
645 p_struct->country=NULL;
646 }
647
648 /* member "bankCode" */
649 if (p_struct->bankCode) {
650 free(p_struct->bankCode);
651 p_struct->bankCode=NULL;
652 }
653 {
654 const char *s;
655 s=GWEN_XMLNode_GetCharValue(p_db, "bankCode", NULL);
656 if (s)
657 p_struct->bankCode=strdup(s);
658 }
659 if (p_struct->bankCode==NULL) { /* preset member "bankCode" if empty */
660 p_struct->bankCode=NULL;
661 }
662
663 /* member "provider" */
664 /* member "provider" is volatile, just presetting */
665 p_struct->provider=NULL;
666
667 /* member "certDb" */
668 if (p_struct->certDb) {
669 GWEN_DB_Group_free(p_struct->certDb);
670 p_struct->certDb=NULL;
671 }
672
673 if (p_struct->certDb==NULL) { /* preset member "certDb" if empty */
674 p_struct->certDb=NULL;
675 }
676
677 /* member "lastSessionId" */
678 p_struct->lastSessionId=GWEN_XMLNode_GetIntValue(p_db, "lastSessionId", 0);
679
680 }
681
AB_User_WriteXml(const AB_USER * p_struct,GWEN_XMLNODE * p_db)682 void AB_User_WriteXml(const AB_USER *p_struct, GWEN_XMLNODE *p_db)
683 {
684 assert(p_struct);
685 /* member "uniqueId" */
686 GWEN_XMLNode_SetIntValue(p_db, "uniqueId", p_struct->uniqueId);
687
688 /* member "backendName" */
689 GWEN_XMLNode_SetCharValue(p_db, "backendName", p_struct->backendName);
690
691 /* member "userName" */
692 GWEN_XMLNode_SetCharValue(p_db, "userName", p_struct->userName);
693
694 /* member "userId" */
695 GWEN_XMLNode_SetCharValue(p_db, "userId", p_struct->userId);
696
697 /* member "customerId" */
698 GWEN_XMLNode_SetCharValue(p_db, "customerId", p_struct->customerId);
699
700 /* member "country" */
701 GWEN_XMLNode_SetCharValue(p_db, "country", p_struct->country);
702
703 /* member "bankCode" */
704 GWEN_XMLNode_SetCharValue(p_db, "bankCode", p_struct->bankCode);
705
706 /* member "provider" is volatile, not writing to xml */
707
708 /* member "certDb" */
709
710
711 /* member "lastSessionId" */
712 GWEN_XMLNode_SetIntValue(p_db, "lastSessionId", p_struct->lastSessionId);
713
714 }
715
AB_User_toXml(const AB_USER * p_struct,GWEN_XMLNODE * p_db)716 void AB_User_toXml(const AB_USER *p_struct, GWEN_XMLNODE *p_db)
717 {
718 AB_User_WriteXml(p_struct, p_db);
719 }
720
AB_User_fromXml(GWEN_XMLNODE * p_db)721 AB_USER *AB_User_fromXml(GWEN_XMLNODE *p_db)
722 {
723 AB_USER *p_struct;
724 p_struct=AB_User_new();
725 AB_User_ReadXml(p_struct, p_db);
726 return p_struct;
727 }
728
AB_User_List_GetByUniqueId(const AB_USER_LIST * p_list,uint32_t p_cmp)729 AB_USER *AB_User_List_GetByUniqueId(const AB_USER_LIST *p_list, uint32_t p_cmp)
730 {
731 AB_USER *p_struct;
732
733 assert(p_list);
734 p_struct = AB_User_List_First(p_list);
735 while (p_struct) {
736 int p_rv;
737
738 if (p_struct->uniqueId==p_cmp)
739 p_rv=0;
740 else if (p_cmp<p_struct->uniqueId)
741 p_rv=-1;
742 else
743 p_rv=1;
744 if (p_rv == 0)
745 return p_struct;
746 p_struct = AB_User_List_Next(p_struct);
747 }
748 return NULL;
749 }
750
AB_User_List_GetByLastSessionId(const AB_USER_LIST * p_list,uint32_t p_cmp)751 AB_USER *AB_User_List_GetByLastSessionId(const AB_USER_LIST *p_list, uint32_t p_cmp)
752 {
753 AB_USER *p_struct;
754
755 assert(p_list);
756 p_struct = AB_User_List_First(p_list);
757 while (p_struct) {
758 int p_rv;
759
760 if (p_struct->lastSessionId==p_cmp)
761 p_rv=0;
762 else if (p_cmp<p_struct->lastSessionId)
763 p_rv=-1;
764 else
765 p_rv=1;
766 if (p_rv == 0)
767 return p_struct;
768 p_struct = AB_User_List_Next(p_struct);
769 }
770 return NULL;
771 }
772
AB_User__ReadFromDb(AB_USER * a,GWEN_DB_NODE * db)773 int AB_User__ReadFromDb(AB_USER *a, GWEN_DB_NODE *db)
774 {
775 assert(a);
776 AB_User_ReadDb(a, db);
777 return 0;
778 }
AB_User__WriteToDb(const AB_USER * a,GWEN_DB_NODE * db)779 int AB_User__WriteToDb(const AB_USER *a, GWEN_DB_NODE *db)
780 {
781 assert(a);
782 AB_User_WriteDb(a, db);
783 return 0;
784 }
785
786 /* code headers */
787
788