1 /**********************************************************
2  * This file has been automatically created by "typemaker2"
3  * from the file "imexporter_accountinfo.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 "./imexporter_accountinfo_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_IMEXPORTER_ACCOUNTINFO,AB_ImExporterAccountInfo)20 GWEN_LIST_FUNCTIONS(AB_IMEXPORTER_ACCOUNTINFO, AB_ImExporterAccountInfo)
21 GWEN_LIST2_FUNCTIONS(AB_IMEXPORTER_ACCOUNTINFO, AB_ImExporterAccountInfo)
22 
23 
24 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_new(void)
25 {
26   AB_IMEXPORTER_ACCOUNTINFO *p_struct;
27 
28   GWEN_NEW_OBJECT(AB_IMEXPORTER_ACCOUNTINFO, p_struct)
29   p_struct->_refCount=1;
30   GWEN_LIST_INIT(AB_IMEXPORTER_ACCOUNTINFO, p_struct)
31   /* members */
32   p_struct->country=NULL;
33   p_struct->bankCode=NULL;
34   p_struct->bankName=NULL;
35   p_struct->accountNumber=NULL;
36   p_struct->subAccountId=NULL;
37   p_struct->accountName=NULL;
38   p_struct->iban=NULL;
39   p_struct->bic=NULL;
40   p_struct->owner=NULL;
41   p_struct->currency=NULL;
42   p_struct->description=NULL;
43   p_struct->accountType=0;
44   p_struct->accountId=0;
45   p_struct->balanceList=AB_Balance_List_new();
46   p_struct->transactionList=AB_Transaction_List_new();
47   p_struct->eStatementList=AB_Document_List_new();
48   /* virtual functions */
49 
50   return p_struct;
51 }
52 
AB_ImExporterAccountInfo_free(AB_IMEXPORTER_ACCOUNTINFO * p_struct)53 void AB_ImExporterAccountInfo_free(AB_IMEXPORTER_ACCOUNTINFO *p_struct)
54 {
55   if (p_struct) {
56     assert(p_struct->_refCount);
57     if (p_struct->_refCount==1) {
58       GWEN_LIST_FINI(AB_IMEXPORTER_ACCOUNTINFO, p_struct)
59       /* members */
60       free(p_struct->country);
61       p_struct->country=NULL;
62       free(p_struct->bankCode);
63       p_struct->bankCode=NULL;
64       free(p_struct->bankName);
65       p_struct->bankName=NULL;
66       free(p_struct->accountNumber);
67       p_struct->accountNumber=NULL;
68       free(p_struct->subAccountId);
69       p_struct->subAccountId=NULL;
70       free(p_struct->accountName);
71       p_struct->accountName=NULL;
72       free(p_struct->iban);
73       p_struct->iban=NULL;
74       free(p_struct->bic);
75       p_struct->bic=NULL;
76       free(p_struct->owner);
77       p_struct->owner=NULL;
78       free(p_struct->currency);
79       p_struct->currency=NULL;
80       free(p_struct->description);
81       p_struct->description=NULL;
82       AB_Balance_List_free(p_struct->balanceList);
83       p_struct->balanceList=NULL;
84       AB_Transaction_List_free(p_struct->transactionList);
85       p_struct->transactionList=NULL;
86       AB_Document_List_free(p_struct->eStatementList);
87       p_struct->eStatementList=NULL;
88       p_struct->_refCount=0;
89       GWEN_FREE_OBJECT(p_struct);
90     }
91     else
92       p_struct->_refCount--;
93   }
94 }
95 
AB_ImExporterAccountInfo_Attach(AB_IMEXPORTER_ACCOUNTINFO * p_struct)96 void AB_ImExporterAccountInfo_Attach(AB_IMEXPORTER_ACCOUNTINFO *p_struct)
97 {
98   assert(p_struct);
99   assert(p_struct->_refCount);
100   p_struct->_refCount++;
101 }
102 
AB_ImExporterAccountInfo_dup(const AB_IMEXPORTER_ACCOUNTINFO * p_src)103 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_dup(const AB_IMEXPORTER_ACCOUNTINFO *p_src)
104 {
105   AB_IMEXPORTER_ACCOUNTINFO *p_struct;
106 
107   assert(p_src);
108   p_struct=AB_ImExporterAccountInfo_new();
109   /* member "country" */
110   if (p_struct->country) {
111     free(p_struct->country);
112     p_struct->country=NULL;
113     p_struct->country=NULL;
114   }
115   if (p_src->country) {
116     p_struct->country=strdup(p_src->country);
117   }
118 
119   /* member "bankCode" */
120   if (p_struct->bankCode) {
121     free(p_struct->bankCode);
122     p_struct->bankCode=NULL;
123     p_struct->bankCode=NULL;
124   }
125   if (p_src->bankCode) {
126     p_struct->bankCode=strdup(p_src->bankCode);
127   }
128 
129   /* member "bankName" */
130   if (p_struct->bankName) {
131     free(p_struct->bankName);
132     p_struct->bankName=NULL;
133     p_struct->bankName=NULL;
134   }
135   if (p_src->bankName) {
136     p_struct->bankName=strdup(p_src->bankName);
137   }
138 
139   /* member "accountNumber" */
140   if (p_struct->accountNumber) {
141     free(p_struct->accountNumber);
142     p_struct->accountNumber=NULL;
143     p_struct->accountNumber=NULL;
144   }
145   if (p_src->accountNumber) {
146     p_struct->accountNumber=strdup(p_src->accountNumber);
147   }
148 
149   /* member "subAccountId" */
150   if (p_struct->subAccountId) {
151     free(p_struct->subAccountId);
152     p_struct->subAccountId=NULL;
153     p_struct->subAccountId=NULL;
154   }
155   if (p_src->subAccountId) {
156     p_struct->subAccountId=strdup(p_src->subAccountId);
157   }
158 
159   /* member "accountName" */
160   if (p_struct->accountName) {
161     free(p_struct->accountName);
162     p_struct->accountName=NULL;
163     p_struct->accountName=NULL;
164   }
165   if (p_src->accountName) {
166     p_struct->accountName=strdup(p_src->accountName);
167   }
168 
169   /* member "iban" */
170   if (p_struct->iban) {
171     free(p_struct->iban);
172     p_struct->iban=NULL;
173     p_struct->iban=NULL;
174   }
175   if (p_src->iban) {
176     p_struct->iban=strdup(p_src->iban);
177   }
178 
179   /* member "bic" */
180   if (p_struct->bic) {
181     free(p_struct->bic);
182     p_struct->bic=NULL;
183     p_struct->bic=NULL;
184   }
185   if (p_src->bic) {
186     p_struct->bic=strdup(p_src->bic);
187   }
188 
189   /* member "owner" */
190   if (p_struct->owner) {
191     free(p_struct->owner);
192     p_struct->owner=NULL;
193     p_struct->owner=NULL;
194   }
195   if (p_src->owner) {
196     p_struct->owner=strdup(p_src->owner);
197   }
198 
199   /* member "currency" */
200   if (p_struct->currency) {
201     free(p_struct->currency);
202     p_struct->currency=NULL;
203     p_struct->currency=NULL;
204   }
205   if (p_src->currency) {
206     p_struct->currency=strdup(p_src->currency);
207   }
208 
209   /* member "description" */
210   if (p_struct->description) {
211     free(p_struct->description);
212     p_struct->description=NULL;
213     p_struct->description=NULL;
214   }
215   if (p_src->description) {
216     p_struct->description=strdup(p_src->description);
217   }
218 
219   /* member "accountType" */
220   p_struct->accountType=p_src->accountType;
221 
222   /* member "accountId" */
223   p_struct->accountId=p_src->accountId;
224 
225   /* member "balanceList" */
226   if (p_struct->balanceList) {
227     AB_Balance_List_free(p_struct->balanceList);
228     p_struct->balanceList=NULL;
229     p_struct->balanceList=NULL;
230   }
231   if (p_src->balanceList) {
232     p_struct->balanceList=AB_Balance_List_dup(p_src->balanceList);
233   }
234 
235   /* member "transactionList" */
236   if (p_struct->transactionList) {
237     AB_Transaction_List_free(p_struct->transactionList);
238     p_struct->transactionList=NULL;
239     p_struct->transactionList=NULL;
240   }
241   if (p_src->transactionList) {
242     p_struct->transactionList=AB_Transaction_List_dup(p_src->transactionList);
243   }
244 
245   /* member "eStatementList" */
246   if (p_struct->eStatementList) {
247     AB_Document_List_free(p_struct->eStatementList);
248     p_struct->eStatementList=NULL;
249     p_struct->eStatementList=NULL;
250   }
251   if (p_src->eStatementList) {
252     p_struct->eStatementList=AB_Document_List_dup(p_src->eStatementList);
253   }
254 
255   return p_struct;
256 }
257 
AB_ImExporterAccountInfo_copy(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const AB_IMEXPORTER_ACCOUNTINFO * p_src)258 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_copy(AB_IMEXPORTER_ACCOUNTINFO *p_struct,
259                                                          const AB_IMEXPORTER_ACCOUNTINFO *p_src)
260 {
261   assert(p_struct);
262   assert(p_src);
263   /* member "country" */
264   if (p_struct->country) {
265     free(p_struct->country);
266     p_struct->country=NULL;
267     p_struct->country=NULL;
268   }
269   if (p_src->country) {
270     p_struct->country=strdup(p_src->country);
271   }
272 
273   /* member "bankCode" */
274   if (p_struct->bankCode) {
275     free(p_struct->bankCode);
276     p_struct->bankCode=NULL;
277     p_struct->bankCode=NULL;
278   }
279   if (p_src->bankCode) {
280     p_struct->bankCode=strdup(p_src->bankCode);
281   }
282 
283   /* member "bankName" */
284   if (p_struct->bankName) {
285     free(p_struct->bankName);
286     p_struct->bankName=NULL;
287     p_struct->bankName=NULL;
288   }
289   if (p_src->bankName) {
290     p_struct->bankName=strdup(p_src->bankName);
291   }
292 
293   /* member "accountNumber" */
294   if (p_struct->accountNumber) {
295     free(p_struct->accountNumber);
296     p_struct->accountNumber=NULL;
297     p_struct->accountNumber=NULL;
298   }
299   if (p_src->accountNumber) {
300     p_struct->accountNumber=strdup(p_src->accountNumber);
301   }
302 
303   /* member "subAccountId" */
304   if (p_struct->subAccountId) {
305     free(p_struct->subAccountId);
306     p_struct->subAccountId=NULL;
307     p_struct->subAccountId=NULL;
308   }
309   if (p_src->subAccountId) {
310     p_struct->subAccountId=strdup(p_src->subAccountId);
311   }
312 
313   /* member "accountName" */
314   if (p_struct->accountName) {
315     free(p_struct->accountName);
316     p_struct->accountName=NULL;
317     p_struct->accountName=NULL;
318   }
319   if (p_src->accountName) {
320     p_struct->accountName=strdup(p_src->accountName);
321   }
322 
323   /* member "iban" */
324   if (p_struct->iban) {
325     free(p_struct->iban);
326     p_struct->iban=NULL;
327     p_struct->iban=NULL;
328   }
329   if (p_src->iban) {
330     p_struct->iban=strdup(p_src->iban);
331   }
332 
333   /* member "bic" */
334   if (p_struct->bic) {
335     free(p_struct->bic);
336     p_struct->bic=NULL;
337     p_struct->bic=NULL;
338   }
339   if (p_src->bic) {
340     p_struct->bic=strdup(p_src->bic);
341   }
342 
343   /* member "owner" */
344   if (p_struct->owner) {
345     free(p_struct->owner);
346     p_struct->owner=NULL;
347     p_struct->owner=NULL;
348   }
349   if (p_src->owner) {
350     p_struct->owner=strdup(p_src->owner);
351   }
352 
353   /* member "currency" */
354   if (p_struct->currency) {
355     free(p_struct->currency);
356     p_struct->currency=NULL;
357     p_struct->currency=NULL;
358   }
359   if (p_src->currency) {
360     p_struct->currency=strdup(p_src->currency);
361   }
362 
363   /* member "description" */
364   if (p_struct->description) {
365     free(p_struct->description);
366     p_struct->description=NULL;
367     p_struct->description=NULL;
368   }
369   if (p_src->description) {
370     p_struct->description=strdup(p_src->description);
371   }
372 
373   /* member "accountType" */
374   p_struct->accountType=p_src->accountType;
375 
376   /* member "accountId" */
377   p_struct->accountId=p_src->accountId;
378 
379   /* member "balanceList" */
380   if (p_struct->balanceList) {
381     AB_Balance_List_free(p_struct->balanceList);
382     p_struct->balanceList=NULL;
383     p_struct->balanceList=NULL;
384   }
385   if (p_src->balanceList) {
386     p_struct->balanceList=AB_Balance_List_dup(p_src->balanceList);
387   }
388 
389   /* member "transactionList" */
390   if (p_struct->transactionList) {
391     AB_Transaction_List_free(p_struct->transactionList);
392     p_struct->transactionList=NULL;
393     p_struct->transactionList=NULL;
394   }
395   if (p_src->transactionList) {
396     p_struct->transactionList=AB_Transaction_List_dup(p_src->transactionList);
397   }
398 
399   /* member "eStatementList" */
400   if (p_struct->eStatementList) {
401     AB_Document_List_free(p_struct->eStatementList);
402     p_struct->eStatementList=NULL;
403     p_struct->eStatementList=NULL;
404   }
405   if (p_src->eStatementList) {
406     p_struct->eStatementList=AB_Document_List_dup(p_src->eStatementList);
407   }
408 
409   return p_struct;
410 }
411 
AB_ImExporterAccountInfo_GetCountry(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)412 const char *AB_ImExporterAccountInfo_GetCountry(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
413 {
414   assert(p_struct);
415   return p_struct->country;
416 }
417 
AB_ImExporterAccountInfo_GetBankCode(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)418 const char *AB_ImExporterAccountInfo_GetBankCode(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
419 {
420   assert(p_struct);
421   return p_struct->bankCode;
422 }
423 
AB_ImExporterAccountInfo_GetBankName(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)424 const char *AB_ImExporterAccountInfo_GetBankName(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
425 {
426   assert(p_struct);
427   return p_struct->bankName;
428 }
429 
AB_ImExporterAccountInfo_GetAccountNumber(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)430 const char *AB_ImExporterAccountInfo_GetAccountNumber(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
431 {
432   assert(p_struct);
433   return p_struct->accountNumber;
434 }
435 
AB_ImExporterAccountInfo_GetSubAccountId(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)436 const char *AB_ImExporterAccountInfo_GetSubAccountId(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
437 {
438   assert(p_struct);
439   return p_struct->subAccountId;
440 }
441 
AB_ImExporterAccountInfo_GetAccountName(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)442 const char *AB_ImExporterAccountInfo_GetAccountName(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
443 {
444   assert(p_struct);
445   return p_struct->accountName;
446 }
447 
AB_ImExporterAccountInfo_GetIban(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)448 const char *AB_ImExporterAccountInfo_GetIban(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
449 {
450   assert(p_struct);
451   return p_struct->iban;
452 }
453 
AB_ImExporterAccountInfo_GetBic(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)454 const char *AB_ImExporterAccountInfo_GetBic(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
455 {
456   assert(p_struct);
457   return p_struct->bic;
458 }
459 
AB_ImExporterAccountInfo_GetOwner(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)460 const char *AB_ImExporterAccountInfo_GetOwner(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
461 {
462   assert(p_struct);
463   return p_struct->owner;
464 }
465 
AB_ImExporterAccountInfo_GetCurrency(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)466 const char *AB_ImExporterAccountInfo_GetCurrency(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
467 {
468   assert(p_struct);
469   return p_struct->currency;
470 }
471 
AB_ImExporterAccountInfo_GetDescription(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)472 const char *AB_ImExporterAccountInfo_GetDescription(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
473 {
474   assert(p_struct);
475   return p_struct->description;
476 }
477 
AB_ImExporterAccountInfo_GetAccountType(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)478 int AB_ImExporterAccountInfo_GetAccountType(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
479 {
480   assert(p_struct);
481   return p_struct->accountType;
482 }
483 
AB_ImExporterAccountInfo_GetAccountId(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)484 uint32_t AB_ImExporterAccountInfo_GetAccountId(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
485 {
486   assert(p_struct);
487   return p_struct->accountId;
488 }
489 
AB_ImExporterAccountInfo_GetBalanceList(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)490 AB_BALANCE_LIST *AB_ImExporterAccountInfo_GetBalanceList(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
491 {
492   assert(p_struct);
493   return p_struct->balanceList;
494 }
495 
AB_ImExporterAccountInfo_GetTransactionList(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)496 AB_TRANSACTION_LIST *AB_ImExporterAccountInfo_GetTransactionList(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
497 {
498   assert(p_struct);
499   return p_struct->transactionList;
500 }
501 
AB_ImExporterAccountInfo_GetEStatementList(const AB_IMEXPORTER_ACCOUNTINFO * p_struct)502 AB_DOCUMENT_LIST *AB_ImExporterAccountInfo_GetEStatementList(const AB_IMEXPORTER_ACCOUNTINFO *p_struct)
503 {
504   assert(p_struct);
505   return p_struct->eStatementList;
506 }
507 
AB_ImExporterAccountInfo_SetCountry(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)508 void AB_ImExporterAccountInfo_SetCountry(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
509 {
510   assert(p_struct);
511   if (p_struct->country) {
512     free(p_struct->country);
513     p_struct->country=NULL;
514   }
515   if (p_src) {
516     p_struct->country=strdup(p_src);
517   }
518   else {
519     p_struct->country=NULL;
520   }
521 }
522 
AB_ImExporterAccountInfo_SetBankCode(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)523 void AB_ImExporterAccountInfo_SetBankCode(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
524 {
525   assert(p_struct);
526   if (p_struct->bankCode) {
527     free(p_struct->bankCode);
528     p_struct->bankCode=NULL;
529   }
530   if (p_src) {
531     p_struct->bankCode=strdup(p_src);
532   }
533   else {
534     p_struct->bankCode=NULL;
535   }
536 }
537 
AB_ImExporterAccountInfo_SetBankName(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)538 void AB_ImExporterAccountInfo_SetBankName(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
539 {
540   assert(p_struct);
541   if (p_struct->bankName) {
542     free(p_struct->bankName);
543     p_struct->bankName=NULL;
544   }
545   if (p_src) {
546     p_struct->bankName=strdup(p_src);
547   }
548   else {
549     p_struct->bankName=NULL;
550   }
551 }
552 
AB_ImExporterAccountInfo_SetAccountNumber(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)553 void AB_ImExporterAccountInfo_SetAccountNumber(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
554 {
555   assert(p_struct);
556   if (p_struct->accountNumber) {
557     free(p_struct->accountNumber);
558     p_struct->accountNumber=NULL;
559   }
560   if (p_src) {
561     p_struct->accountNumber=strdup(p_src);
562   }
563   else {
564     p_struct->accountNumber=NULL;
565   }
566 }
567 
AB_ImExporterAccountInfo_SetSubAccountId(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)568 void AB_ImExporterAccountInfo_SetSubAccountId(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
569 {
570   assert(p_struct);
571   if (p_struct->subAccountId) {
572     free(p_struct->subAccountId);
573     p_struct->subAccountId=NULL;
574   }
575   if (p_src) {
576     p_struct->subAccountId=strdup(p_src);
577   }
578   else {
579     p_struct->subAccountId=NULL;
580   }
581 }
582 
AB_ImExporterAccountInfo_SetAccountName(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)583 void AB_ImExporterAccountInfo_SetAccountName(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
584 {
585   assert(p_struct);
586   if (p_struct->accountName) {
587     free(p_struct->accountName);
588     p_struct->accountName=NULL;
589   }
590   if (p_src) {
591     p_struct->accountName=strdup(p_src);
592   }
593   else {
594     p_struct->accountName=NULL;
595   }
596 }
597 
AB_ImExporterAccountInfo_SetIban(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)598 void AB_ImExporterAccountInfo_SetIban(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
599 {
600   assert(p_struct);
601   if (p_struct->iban) {
602     free(p_struct->iban);
603     p_struct->iban=NULL;
604   }
605   if (p_src) {
606     p_struct->iban=strdup(p_src);
607   }
608   else {
609     p_struct->iban=NULL;
610   }
611 }
612 
AB_ImExporterAccountInfo_SetBic(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)613 void AB_ImExporterAccountInfo_SetBic(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
614 {
615   assert(p_struct);
616   if (p_struct->bic) {
617     free(p_struct->bic);
618     p_struct->bic=NULL;
619   }
620   if (p_src) {
621     p_struct->bic=strdup(p_src);
622   }
623   else {
624     p_struct->bic=NULL;
625   }
626 }
627 
AB_ImExporterAccountInfo_SetOwner(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)628 void AB_ImExporterAccountInfo_SetOwner(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
629 {
630   assert(p_struct);
631   if (p_struct->owner) {
632     free(p_struct->owner);
633     p_struct->owner=NULL;
634   }
635   if (p_src) {
636     p_struct->owner=strdup(p_src);
637   }
638   else {
639     p_struct->owner=NULL;
640   }
641 }
642 
AB_ImExporterAccountInfo_SetCurrency(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)643 void AB_ImExporterAccountInfo_SetCurrency(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
644 {
645   assert(p_struct);
646   if (p_struct->currency) {
647     free(p_struct->currency);
648     p_struct->currency=NULL;
649   }
650   if (p_src) {
651     p_struct->currency=strdup(p_src);
652   }
653   else {
654     p_struct->currency=NULL;
655   }
656 }
657 
AB_ImExporterAccountInfo_SetDescription(AB_IMEXPORTER_ACCOUNTINFO * p_struct,const char * p_src)658 void AB_ImExporterAccountInfo_SetDescription(AB_IMEXPORTER_ACCOUNTINFO *p_struct, const char *p_src)
659 {
660   assert(p_struct);
661   if (p_struct->description) {
662     free(p_struct->description);
663     p_struct->description=NULL;
664   }
665   if (p_src) {
666     p_struct->description=strdup(p_src);
667   }
668   else {
669     p_struct->description=NULL;
670   }
671 }
672 
AB_ImExporterAccountInfo_SetAccountType(AB_IMEXPORTER_ACCOUNTINFO * p_struct,int p_src)673 void AB_ImExporterAccountInfo_SetAccountType(AB_IMEXPORTER_ACCOUNTINFO *p_struct, int p_src)
674 {
675   assert(p_struct);
676   p_struct->accountType=p_src;
677 }
678 
AB_ImExporterAccountInfo_SetAccountId(AB_IMEXPORTER_ACCOUNTINFO * p_struct,uint32_t p_src)679 void AB_ImExporterAccountInfo_SetAccountId(AB_IMEXPORTER_ACCOUNTINFO *p_struct, uint32_t p_src)
680 {
681   assert(p_struct);
682   p_struct->accountId=p_src;
683 }
684 
AB_ImExporterAccountInfo_SetBalanceList(AB_IMEXPORTER_ACCOUNTINFO * p_struct,AB_BALANCE_LIST * p_src)685 void AB_ImExporterAccountInfo_SetBalanceList(AB_IMEXPORTER_ACCOUNTINFO *p_struct, AB_BALANCE_LIST *p_src)
686 {
687   assert(p_struct);
688   if (p_struct->balanceList) {
689     AB_Balance_List_free(p_struct->balanceList);
690     p_struct->balanceList=NULL;
691   }
692   p_struct->balanceList=p_src;
693 }
694 
AB_ImExporterAccountInfo_SetTransactionList(AB_IMEXPORTER_ACCOUNTINFO * p_struct,AB_TRANSACTION_LIST * p_src)695 void AB_ImExporterAccountInfo_SetTransactionList(AB_IMEXPORTER_ACCOUNTINFO *p_struct, AB_TRANSACTION_LIST *p_src)
696 {
697   assert(p_struct);
698   if (p_struct->transactionList) {
699     AB_Transaction_List_free(p_struct->transactionList);
700     p_struct->transactionList=NULL;
701   }
702   p_struct->transactionList=p_src;
703 }
704 
AB_ImExporterAccountInfo_SetEStatementList(AB_IMEXPORTER_ACCOUNTINFO * p_struct,AB_DOCUMENT_LIST * p_src)705 void AB_ImExporterAccountInfo_SetEStatementList(AB_IMEXPORTER_ACCOUNTINFO *p_struct, AB_DOCUMENT_LIST *p_src)
706 {
707   assert(p_struct);
708   if (p_struct->eStatementList) {
709     AB_Document_List_free(p_struct->eStatementList);
710     p_struct->eStatementList=NULL;
711   }
712   p_struct->eStatementList=p_src;
713 }
714 
715 /* list1 functions */
AB_ImExporterAccountInfo_List_dup(const AB_IMEXPORTER_ACCOUNTINFO_LIST * p_src)716 AB_IMEXPORTER_ACCOUNTINFO_LIST *AB_ImExporterAccountInfo_List_dup(const AB_IMEXPORTER_ACCOUNTINFO_LIST *p_src)
717 {
718   AB_IMEXPORTER_ACCOUNTINFO_LIST *p_dest;
719   AB_IMEXPORTER_ACCOUNTINFO *p_elem;
720 
721   assert(p_src);
722   p_dest=AB_ImExporterAccountInfo_List_new();
723   p_elem=AB_ImExporterAccountInfo_List_First(p_src);
724   while (p_elem) {
725     AB_IMEXPORTER_ACCOUNTINFO *p_cpy;
726 
727     p_cpy=AB_ImExporterAccountInfo_dup(p_elem);
728     AB_ImExporterAccountInfo_List_Add(p_cpy, p_dest);
729     p_elem=AB_ImExporterAccountInfo_List_Next(p_elem);
730   }
731 
732   return p_dest;
733 }
734 
AB_ImExporterAccountInfo_ReadDb(AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_DB_NODE * p_db)735 void AB_ImExporterAccountInfo_ReadDb(AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_DB_NODE *p_db)
736 {
737   assert(p_struct);
738   /* member "country" */
739   if (p_struct->country) {
740     free(p_struct->country);
741     p_struct->country=NULL;
742   }
743   {
744     const char *s;
745     s=GWEN_DB_GetCharValue(p_db, "country", 0, NULL);
746     if (s)
747       p_struct->country=strdup(s);
748   }
749   if (p_struct->country==NULL) {
750     p_struct->country=NULL;
751   }
752 
753   /* member "bankCode" */
754   if (p_struct->bankCode) {
755     free(p_struct->bankCode);
756     p_struct->bankCode=NULL;
757   }
758   {
759     const char *s;
760     s=GWEN_DB_GetCharValue(p_db, "bankCode", 0, NULL);
761     if (s)
762       p_struct->bankCode=strdup(s);
763   }
764   if (p_struct->bankCode==NULL) {
765     p_struct->bankCode=NULL;
766   }
767 
768   /* member "bankName" */
769   if (p_struct->bankName) {
770     free(p_struct->bankName);
771     p_struct->bankName=NULL;
772   }
773   {
774     const char *s;
775     s=GWEN_DB_GetCharValue(p_db, "bankName", 0, NULL);
776     if (s)
777       p_struct->bankName=strdup(s);
778   }
779   if (p_struct->bankName==NULL) {
780     p_struct->bankName=NULL;
781   }
782 
783   /* member "accountNumber" */
784   if (p_struct->accountNumber) {
785     free(p_struct->accountNumber);
786     p_struct->accountNumber=NULL;
787   }
788   {
789     const char *s;
790     s=GWEN_DB_GetCharValue(p_db, "accountNumber", 0, NULL);
791     if (s)
792       p_struct->accountNumber=strdup(s);
793   }
794   if (p_struct->accountNumber==NULL) {
795     p_struct->accountNumber=NULL;
796   }
797 
798   /* member "subAccountId" */
799   if (p_struct->subAccountId) {
800     free(p_struct->subAccountId);
801     p_struct->subAccountId=NULL;
802   }
803   {
804     const char *s;
805     s=GWEN_DB_GetCharValue(p_db, "subAccountId", 0, NULL);
806     if (s)
807       p_struct->subAccountId=strdup(s);
808   }
809   if (p_struct->subAccountId==NULL) {
810     p_struct->subAccountId=NULL;
811   }
812 
813   /* member "accountName" */
814   if (p_struct->accountName) {
815     free(p_struct->accountName);
816     p_struct->accountName=NULL;
817   }
818   {
819     const char *s;
820     s=GWEN_DB_GetCharValue(p_db, "accountName", 0, NULL);
821     if (s)
822       p_struct->accountName=strdup(s);
823   }
824   if (p_struct->accountName==NULL) {
825     p_struct->accountName=NULL;
826   }
827 
828   /* member "iban" */
829   if (p_struct->iban) {
830     free(p_struct->iban);
831     p_struct->iban=NULL;
832   }
833   {
834     const char *s;
835     s=GWEN_DB_GetCharValue(p_db, "iban", 0, NULL);
836     if (s)
837       p_struct->iban=strdup(s);
838   }
839   if (p_struct->iban==NULL) {
840     p_struct->iban=NULL;
841   }
842 
843   /* member "bic" */
844   if (p_struct->bic) {
845     free(p_struct->bic);
846     p_struct->bic=NULL;
847   }
848   {
849     const char *s;
850     s=GWEN_DB_GetCharValue(p_db, "bic", 0, NULL);
851     if (s)
852       p_struct->bic=strdup(s);
853   }
854   if (p_struct->bic==NULL) {
855     p_struct->bic=NULL;
856   }
857 
858   /* member "owner" */
859   if (p_struct->owner) {
860     free(p_struct->owner);
861     p_struct->owner=NULL;
862   }
863   {
864     const char *s;
865     s=GWEN_DB_GetCharValue(p_db, "owner", 0, NULL);
866     if (s)
867       p_struct->owner=strdup(s);
868   }
869   if (p_struct->owner==NULL) {
870     p_struct->owner=NULL;
871   }
872 
873   /* member "currency" */
874   if (p_struct->currency) {
875     free(p_struct->currency);
876     p_struct->currency=NULL;
877   }
878   {
879     const char *s;
880     s=GWEN_DB_GetCharValue(p_db, "currency", 0, NULL);
881     if (s)
882       p_struct->currency=strdup(s);
883   }
884   if (p_struct->currency==NULL) {
885     p_struct->currency=NULL;
886   }
887 
888   /* member "description" */
889   if (p_struct->description) {
890     free(p_struct->description);
891     p_struct->description=NULL;
892   }
893   {
894     const char *s;
895     s=GWEN_DB_GetCharValue(p_db, "description", 0, NULL);
896     if (s)
897       p_struct->description=strdup(s);
898   }
899   if (p_struct->description==NULL) {
900     p_struct->description=NULL;
901   }
902 
903   /* member "accountType" */
904   p_struct->accountType=GWEN_DB_GetIntValue(p_db, "accountType", 0, 0);
905 
906   /* member "accountId" */
907   p_struct->accountId=GWEN_DB_GetIntValue(p_db, "accountId", 0, 0);
908 
909   /* member "balanceList" */
910   if (p_struct->balanceList) {
911     AB_Balance_List_free(p_struct->balanceList);
912     p_struct->balanceList=NULL;
913   }
914   {
915     GWEN_DB_NODE *dbSource;
916     dbSource=GWEN_DB_GetGroup(p_db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "balanceList");
917     if (dbSource) {
918       AB_BALANCE_LIST *t;
919       GWEN_DB_NODE *dbT;
920       t=AB_Balance_List_new();
921       dbT=GWEN_DB_FindFirstGroup(dbSource, "balance");
922       while (dbT) {
923         AB_BALANCE *elem;
924         elem=AB_Balance_fromDb(dbT);
925         if (elem)
926           AB_Balance_List_Add(elem, t);
927         dbT=GWEN_DB_FindNextGroup(dbT, "balance");
928       }
929       p_struct->balanceList=t;
930     }
931     else
932       p_struct->balanceList=AB_Balance_List_new();
933   }
934   if (p_struct->balanceList==NULL) {
935     p_struct->balanceList=AB_Balance_List_new();
936   }
937 
938   /* member "transactionList" */
939   if (p_struct->transactionList) {
940     AB_Transaction_List_free(p_struct->transactionList);
941     p_struct->transactionList=NULL;
942   }
943   {
944     GWEN_DB_NODE *dbSource;
945     dbSource=GWEN_DB_GetGroup(p_db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "transactionList");
946     if (dbSource) {
947       AB_TRANSACTION_LIST *t;
948       GWEN_DB_NODE *dbT;
949       t=AB_Transaction_List_new();
950       dbT=GWEN_DB_FindFirstGroup(dbSource, "transaction");
951       while (dbT) {
952         AB_TRANSACTION *elem;
953         elem=AB_Transaction_fromDb(dbT);
954         if (elem)
955           AB_Transaction_List_Add(elem, t);
956         dbT=GWEN_DB_FindNextGroup(dbT, "transaction");
957       }
958       p_struct->transactionList=t;
959     }
960     else
961       p_struct->transactionList=AB_Transaction_List_new();
962   }
963   if (p_struct->transactionList==NULL) {
964     p_struct->transactionList=AB_Transaction_List_new();
965   }
966 
967   /* member "eStatementList" */
968   if (p_struct->eStatementList) {
969     AB_Document_List_free(p_struct->eStatementList);
970     p_struct->eStatementList=NULL;
971   }
972   {
973     GWEN_DB_NODE *dbSource;
974     dbSource=GWEN_DB_GetGroup(p_db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "eStatementList");
975     if (dbSource) {
976       AB_DOCUMENT_LIST *t;
977       GWEN_DB_NODE *dbT;
978       t=AB_Document_List_new();
979       dbT=GWEN_DB_FindFirstGroup(dbSource, "eStatement");
980       while (dbT) {
981         AB_DOCUMENT *elem;
982         elem=AB_Document_fromDb(dbT);
983         if (elem)
984           AB_Document_List_Add(elem, t);
985         dbT=GWEN_DB_FindNextGroup(dbT, "eStatement");
986       }
987       p_struct->eStatementList=t;
988     }
989     else
990       p_struct->eStatementList=AB_Document_List_new();
991   }
992   if (p_struct->eStatementList==NULL) {
993     p_struct->eStatementList=AB_Document_List_new();
994   }
995 
996 }
997 
AB_ImExporterAccountInfo_WriteDb(const AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_DB_NODE * p_db)998 int AB_ImExporterAccountInfo_WriteDb(const AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_DB_NODE *p_db)
999 {
1000   int p_rv;
1001 
1002   assert(p_struct);
1003   /* member "country" */
1004   if (p_struct->country)
1005     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "country", p_struct->country);
1006   else {
1007     GWEN_DB_DeleteVar(p_db, "country");
1008     p_rv=0;
1009   }
1010   if (p_rv<0) {
1011     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1012     return p_rv;
1013   }
1014 
1015   /* member "bankCode" */
1016   if (p_struct->bankCode)
1017     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankCode", p_struct->bankCode);
1018   else {
1019     GWEN_DB_DeleteVar(p_db, "bankCode");
1020     p_rv=0;
1021   }
1022   if (p_rv<0) {
1023     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1024     return p_rv;
1025   }
1026 
1027   /* member "bankName" */
1028   if (p_struct->bankName)
1029     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankName", p_struct->bankName);
1030   else {
1031     GWEN_DB_DeleteVar(p_db, "bankName");
1032     p_rv=0;
1033   }
1034   if (p_rv<0) {
1035     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1036     return p_rv;
1037   }
1038 
1039   /* member "accountNumber" */
1040   if (p_struct->accountNumber)
1041     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "accountNumber", p_struct->accountNumber);
1042   else {
1043     GWEN_DB_DeleteVar(p_db, "accountNumber");
1044     p_rv=0;
1045   }
1046   if (p_rv<0) {
1047     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1048     return p_rv;
1049   }
1050 
1051   /* member "subAccountId" */
1052   if (p_struct->subAccountId)
1053     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "subAccountId", p_struct->subAccountId);
1054   else {
1055     GWEN_DB_DeleteVar(p_db, "subAccountId");
1056     p_rv=0;
1057   }
1058   if (p_rv<0) {
1059     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1060     return p_rv;
1061   }
1062 
1063   /* member "accountName" */
1064   if (p_struct->accountName)
1065     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "accountName", p_struct->accountName);
1066   else {
1067     GWEN_DB_DeleteVar(p_db, "accountName");
1068     p_rv=0;
1069   }
1070   if (p_rv<0) {
1071     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1072     return p_rv;
1073   }
1074 
1075   /* member "iban" */
1076   if (p_struct->iban)
1077     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "iban", p_struct->iban);
1078   else {
1079     GWEN_DB_DeleteVar(p_db, "iban");
1080     p_rv=0;
1081   }
1082   if (p_rv<0) {
1083     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1084     return p_rv;
1085   }
1086 
1087   /* member "bic" */
1088   if (p_struct->bic)
1089     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bic", p_struct->bic);
1090   else {
1091     GWEN_DB_DeleteVar(p_db, "bic");
1092     p_rv=0;
1093   }
1094   if (p_rv<0) {
1095     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1096     return p_rv;
1097   }
1098 
1099   /* member "owner" */
1100   if (p_struct->owner)
1101     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "owner", p_struct->owner);
1102   else {
1103     GWEN_DB_DeleteVar(p_db, "owner");
1104     p_rv=0;
1105   }
1106   if (p_rv<0) {
1107     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1108     return p_rv;
1109   }
1110 
1111   /* member "currency" */
1112   if (p_struct->currency)
1113     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "currency", p_struct->currency);
1114   else {
1115     GWEN_DB_DeleteVar(p_db, "currency");
1116     p_rv=0;
1117   }
1118   if (p_rv<0) {
1119     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1120     return p_rv;
1121   }
1122 
1123   /* member "description" */
1124   if (p_struct->description)
1125     p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "description", p_struct->description);
1126   else {
1127     GWEN_DB_DeleteVar(p_db, "description");
1128     p_rv=0;
1129   }
1130   if (p_rv<0) {
1131     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1132     return p_rv;
1133   }
1134 
1135   /* member "accountType" */
1136   p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "accountType", p_struct->accountType);
1137   if (p_rv<0) {
1138     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1139     return p_rv;
1140   }
1141 
1142   /* member "accountId" */
1143   p_rv=GWEN_DB_SetIntValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "accountId", p_struct->accountId);
1144   if (p_rv<0) {
1145     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1146     return p_rv;
1147   }
1148 
1149   /* member "balanceList" */
1150   {
1151     if (p_struct->balanceList) {
1152       GWEN_DB_NODE *dbDest;
1153       AB_BALANCE *elem;
1154       dbDest=GWEN_DB_GetGroup(p_db, GWEN_DB_FLAGS_OVERWRITE_GROUPS, "balanceList");
1155       assert(dbDest);
1156       p_rv=0;
1157       elem=AB_Balance_List_First(p_struct->balanceList);
1158       while (elem) {
1159         GWEN_DB_NODE *dbElem;
1160         dbElem=GWEN_DB_GetGroup(dbDest, GWEN_PATH_FLAGS_CREATE_GROUP, "balance");
1161         assert(dbElem);
1162         p_rv=AB_Balance_toDb(elem, dbElem);
1163         if (p_rv<0) {
1164           DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", p_rv);
1165           break;
1166         }
1167         elem=AB_Balance_List_Next(elem);
1168       }
1169     }
1170     else
1171       p_rv=0;
1172   }
1173   if (p_rv<0) {
1174     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1175     return p_rv;
1176   }
1177 
1178   /* member "transactionList" */
1179   {
1180     if (p_struct->transactionList) {
1181       GWEN_DB_NODE *dbDest;
1182       AB_TRANSACTION *elem;
1183       dbDest=GWEN_DB_GetGroup(p_db, GWEN_DB_FLAGS_OVERWRITE_GROUPS, "transactionList");
1184       assert(dbDest);
1185       p_rv=0;
1186       elem=AB_Transaction_List_First(p_struct->transactionList);
1187       while (elem) {
1188         GWEN_DB_NODE *dbElem;
1189         dbElem=GWEN_DB_GetGroup(dbDest, GWEN_PATH_FLAGS_CREATE_GROUP, "transaction");
1190         assert(dbElem);
1191         p_rv=AB_Transaction_toDb(elem, dbElem);
1192         if (p_rv<0) {
1193           DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", p_rv);
1194           break;
1195         }
1196         elem=AB_Transaction_List_Next(elem);
1197       }
1198     }
1199     else
1200       p_rv=0;
1201   }
1202   if (p_rv<0) {
1203     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1204     return p_rv;
1205   }
1206 
1207   /* member "eStatementList" */
1208   {
1209     if (p_struct->eStatementList) {
1210       GWEN_DB_NODE *dbDest;
1211       AB_DOCUMENT *elem;
1212       dbDest=GWEN_DB_GetGroup(p_db, GWEN_DB_FLAGS_OVERWRITE_GROUPS, "eStatementList");
1213       assert(dbDest);
1214       p_rv=0;
1215       elem=AB_Document_List_First(p_struct->eStatementList);
1216       while (elem) {
1217         GWEN_DB_NODE *dbElem;
1218         dbElem=GWEN_DB_GetGroup(dbDest, GWEN_PATH_FLAGS_CREATE_GROUP, "eStatement");
1219         assert(dbElem);
1220         p_rv=AB_Document_toDb(elem, dbElem);
1221         if (p_rv<0) {
1222           DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", p_rv);
1223           break;
1224         }
1225         elem=AB_Document_List_Next(elem);
1226       }
1227     }
1228     else
1229       p_rv=0;
1230   }
1231   if (p_rv<0) {
1232     DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
1233     return p_rv;
1234   }
1235 
1236   return 0;
1237 }
1238 
AB_ImExporterAccountInfo_fromDb(GWEN_DB_NODE * p_db)1239 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_fromDb(GWEN_DB_NODE *p_db)
1240 {
1241   AB_IMEXPORTER_ACCOUNTINFO *p_struct;
1242   p_struct=AB_ImExporterAccountInfo_new();
1243   AB_ImExporterAccountInfo_ReadDb(p_struct, p_db);
1244   return p_struct;
1245 }
1246 
AB_ImExporterAccountInfo_toDb(const AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_DB_NODE * p_db)1247 int AB_ImExporterAccountInfo_toDb(const AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_DB_NODE *p_db)
1248 {
1249   return AB_ImExporterAccountInfo_WriteDb(p_struct, p_db);
1250 }
1251 
AB_ImExporterAccountInfo_ReadXml(AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_XMLNODE * p_db)1252 void AB_ImExporterAccountInfo_ReadXml(AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_XMLNODE *p_db)
1253 {
1254   assert(p_struct);
1255   /* member "country" */
1256   if (p_struct->country) {
1257     free(p_struct->country);
1258     p_struct->country=NULL;
1259   }
1260   {
1261     const char *s;
1262     s=GWEN_XMLNode_GetCharValue(p_db, "country", NULL);
1263     if (s)
1264       p_struct->country=strdup(s);
1265   }
1266   if (p_struct->country==NULL) {  /* preset member "country" if empty */
1267     p_struct->country=NULL;
1268   }
1269 
1270   /* member "bankCode" */
1271   if (p_struct->bankCode) {
1272     free(p_struct->bankCode);
1273     p_struct->bankCode=NULL;
1274   }
1275   {
1276     const char *s;
1277     s=GWEN_XMLNode_GetCharValue(p_db, "bankCode", NULL);
1278     if (s)
1279       p_struct->bankCode=strdup(s);
1280   }
1281   if (p_struct->bankCode==NULL) {  /* preset member "bankCode" if empty */
1282     p_struct->bankCode=NULL;
1283   }
1284 
1285   /* member "bankName" */
1286   if (p_struct->bankName) {
1287     free(p_struct->bankName);
1288     p_struct->bankName=NULL;
1289   }
1290   {
1291     const char *s;
1292     s=GWEN_XMLNode_GetCharValue(p_db, "bankName", NULL);
1293     if (s)
1294       p_struct->bankName=strdup(s);
1295   }
1296   if (p_struct->bankName==NULL) {  /* preset member "bankName" if empty */
1297     p_struct->bankName=NULL;
1298   }
1299 
1300   /* member "accountNumber" */
1301   if (p_struct->accountNumber) {
1302     free(p_struct->accountNumber);
1303     p_struct->accountNumber=NULL;
1304   }
1305   {
1306     const char *s;
1307     s=GWEN_XMLNode_GetCharValue(p_db, "accountNumber", NULL);
1308     if (s)
1309       p_struct->accountNumber=strdup(s);
1310   }
1311   if (p_struct->accountNumber==NULL) {  /* preset member "accountNumber" if empty */
1312     p_struct->accountNumber=NULL;
1313   }
1314 
1315   /* member "subAccountId" */
1316   if (p_struct->subAccountId) {
1317     free(p_struct->subAccountId);
1318     p_struct->subAccountId=NULL;
1319   }
1320   {
1321     const char *s;
1322     s=GWEN_XMLNode_GetCharValue(p_db, "subAccountId", NULL);
1323     if (s)
1324       p_struct->subAccountId=strdup(s);
1325   }
1326   if (p_struct->subAccountId==NULL) {  /* preset member "subAccountId" if empty */
1327     p_struct->subAccountId=NULL;
1328   }
1329 
1330   /* member "accountName" */
1331   if (p_struct->accountName) {
1332     free(p_struct->accountName);
1333     p_struct->accountName=NULL;
1334   }
1335   {
1336     const char *s;
1337     s=GWEN_XMLNode_GetCharValue(p_db, "accountName", NULL);
1338     if (s)
1339       p_struct->accountName=strdup(s);
1340   }
1341   if (p_struct->accountName==NULL) {  /* preset member "accountName" if empty */
1342     p_struct->accountName=NULL;
1343   }
1344 
1345   /* member "iban" */
1346   if (p_struct->iban) {
1347     free(p_struct->iban);
1348     p_struct->iban=NULL;
1349   }
1350   {
1351     const char *s;
1352     s=GWEN_XMLNode_GetCharValue(p_db, "iban", NULL);
1353     if (s)
1354       p_struct->iban=strdup(s);
1355   }
1356   if (p_struct->iban==NULL) {  /* preset member "iban" if empty */
1357     p_struct->iban=NULL;
1358   }
1359 
1360   /* member "bic" */
1361   if (p_struct->bic) {
1362     free(p_struct->bic);
1363     p_struct->bic=NULL;
1364   }
1365   {
1366     const char *s;
1367     s=GWEN_XMLNode_GetCharValue(p_db, "bic", NULL);
1368     if (s)
1369       p_struct->bic=strdup(s);
1370   }
1371   if (p_struct->bic==NULL) {  /* preset member "bic" if empty */
1372     p_struct->bic=NULL;
1373   }
1374 
1375   /* member "owner" */
1376   if (p_struct->owner) {
1377     free(p_struct->owner);
1378     p_struct->owner=NULL;
1379   }
1380   {
1381     const char *s;
1382     s=GWEN_XMLNode_GetCharValue(p_db, "owner", NULL);
1383     if (s)
1384       p_struct->owner=strdup(s);
1385   }
1386   if (p_struct->owner==NULL) {  /* preset member "owner" if empty */
1387     p_struct->owner=NULL;
1388   }
1389 
1390   /* member "currency" */
1391   if (p_struct->currency) {
1392     free(p_struct->currency);
1393     p_struct->currency=NULL;
1394   }
1395   {
1396     const char *s;
1397     s=GWEN_XMLNode_GetCharValue(p_db, "currency", NULL);
1398     if (s)
1399       p_struct->currency=strdup(s);
1400   }
1401   if (p_struct->currency==NULL) {  /* preset member "currency" if empty */
1402     p_struct->currency=NULL;
1403   }
1404 
1405   /* member "description" */
1406   if (p_struct->description) {
1407     free(p_struct->description);
1408     p_struct->description=NULL;
1409   }
1410   {
1411     const char *s;
1412     s=GWEN_XMLNode_GetCharValue(p_db, "description", NULL);
1413     if (s)
1414       p_struct->description=strdup(s);
1415   }
1416   if (p_struct->description==NULL) {  /* preset member "description" if empty */
1417     p_struct->description=NULL;
1418   }
1419 
1420   /* member "accountType" */
1421   p_struct->accountType=GWEN_XMLNode_GetIntValue(p_db, "accountType", 0);
1422 
1423   /* member "accountId" */
1424   p_struct->accountId=GWEN_XMLNode_GetIntValue(p_db, "accountId", 0);
1425 
1426   /* member "balanceList" */
1427   if (p_struct->balanceList) {
1428     AB_Balance_List_free(p_struct->balanceList);
1429     p_struct->balanceList=NULL;
1430   }
1431   {
1432     GWEN_XMLNODE *dbSource;
1433     dbSource=GWEN_XMLNode_FindFirstTag(p_db, "balanceList", NULL, NULL);
1434     if (dbSource) {
1435       AB_BALANCE_LIST *t;
1436       GWEN_XMLNODE *dbT;
1437       t=AB_Balance_List_new();
1438       dbT=GWEN_XMLNode_FindFirstTag(dbSource, "balance", NULL, NULL);
1439       while (dbT) {
1440         AB_BALANCE *elem;
1441         elem=AB_Balance_fromXml(dbT);
1442         if (elem)
1443           AB_Balance_List_Add(elem, t);
1444         dbT=GWEN_XMLNode_FindNextTag(dbT, "balance", NULL, NULL);
1445       }
1446       p_struct->balanceList=t;
1447     }
1448     else
1449       p_struct->balanceList=AB_Balance_List_new();
1450   }
1451   if (p_struct->balanceList==NULL) {  /* preset member "balanceList" if empty */
1452     p_struct->balanceList=AB_Balance_List_new();
1453   }
1454 
1455   /* member "transactionList" */
1456   if (p_struct->transactionList) {
1457     AB_Transaction_List_free(p_struct->transactionList);
1458     p_struct->transactionList=NULL;
1459   }
1460   {
1461     GWEN_XMLNODE *dbSource;
1462     dbSource=GWEN_XMLNode_FindFirstTag(p_db, "transactionList", NULL, NULL);
1463     if (dbSource) {
1464       AB_TRANSACTION_LIST *t;
1465       GWEN_XMLNODE *dbT;
1466       t=AB_Transaction_List_new();
1467       dbT=GWEN_XMLNode_FindFirstTag(dbSource, "transaction", NULL, NULL);
1468       while (dbT) {
1469         AB_TRANSACTION *elem;
1470         elem=AB_Transaction_fromXml(dbT);
1471         if (elem)
1472           AB_Transaction_List_Add(elem, t);
1473         dbT=GWEN_XMLNode_FindNextTag(dbT, "transaction", NULL, NULL);
1474       }
1475       p_struct->transactionList=t;
1476     }
1477     else
1478       p_struct->transactionList=AB_Transaction_List_new();
1479   }
1480   if (p_struct->transactionList==NULL) {  /* preset member "transactionList" if empty */
1481     p_struct->transactionList=AB_Transaction_List_new();
1482   }
1483 
1484   /* member "eStatementList" */
1485   if (p_struct->eStatementList) {
1486     AB_Document_List_free(p_struct->eStatementList);
1487     p_struct->eStatementList=NULL;
1488   }
1489   {
1490     GWEN_XMLNODE *dbSource;
1491     dbSource=GWEN_XMLNode_FindFirstTag(p_db, "eStatementList", NULL, NULL);
1492     if (dbSource) {
1493       AB_DOCUMENT_LIST *t;
1494       GWEN_XMLNODE *dbT;
1495       t=AB_Document_List_new();
1496       dbT=GWEN_XMLNode_FindFirstTag(dbSource, "eStatement", NULL, NULL);
1497       while (dbT) {
1498         AB_DOCUMENT *elem;
1499         elem=AB_Document_fromXml(dbT);
1500         if (elem)
1501           AB_Document_List_Add(elem, t);
1502         dbT=GWEN_XMLNode_FindNextTag(dbT, "eStatement", NULL, NULL);
1503       }
1504       p_struct->eStatementList=t;
1505     }
1506     else
1507       p_struct->eStatementList=AB_Document_List_new();
1508   }
1509   if (p_struct->eStatementList==NULL) {  /* preset member "eStatementList" if empty */
1510     p_struct->eStatementList=AB_Document_List_new();
1511   }
1512 
1513 }
1514 
AB_ImExporterAccountInfo_WriteXml(const AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_XMLNODE * p_db)1515 void AB_ImExporterAccountInfo_WriteXml(const AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_XMLNODE *p_db)
1516 {
1517   assert(p_struct);
1518   /* member "country" */
1519   GWEN_XMLNode_SetCharValue(p_db, "country", p_struct->country);
1520 
1521   /* member "bankCode" */
1522   GWEN_XMLNode_SetCharValue(p_db, "bankCode", p_struct->bankCode);
1523 
1524   /* member "bankName" */
1525   GWEN_XMLNode_SetCharValue(p_db, "bankName", p_struct->bankName);
1526 
1527   /* member "accountNumber" */
1528   GWEN_XMLNode_SetCharValue(p_db, "accountNumber", p_struct->accountNumber);
1529 
1530   /* member "subAccountId" */
1531   GWEN_XMLNode_SetCharValue(p_db, "subAccountId", p_struct->subAccountId);
1532 
1533   /* member "accountName" */
1534   GWEN_XMLNode_SetCharValue(p_db, "accountName", p_struct->accountName);
1535 
1536   /* member "iban" */
1537   GWEN_XMLNode_SetCharValue(p_db, "iban", p_struct->iban);
1538 
1539   /* member "bic" */
1540   GWEN_XMLNode_SetCharValue(p_db, "bic", p_struct->bic);
1541 
1542   /* member "owner" */
1543   GWEN_XMLNode_SetCharValue(p_db, "owner", p_struct->owner);
1544 
1545   /* member "currency" */
1546   GWEN_XMLNode_SetCharValue(p_db, "currency", p_struct->currency);
1547 
1548   /* member "description" */
1549   GWEN_XMLNode_SetCharValue(p_db, "description", p_struct->description);
1550 
1551   /* member "accountType" */
1552   GWEN_XMLNode_SetIntValue(p_db, "accountType", p_struct->accountType);
1553 
1554   /* member "accountId" */
1555   GWEN_XMLNode_SetIntValue(p_db, "accountId", p_struct->accountId);
1556 
1557   /* member "balanceList" */
1558   {
1559     if (p_struct->balanceList) {
1560       GWEN_XMLNODE *dbDest;
1561       AB_BALANCE *elem;
1562       dbDest=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "balanceList");
1563       elem=AB_Balance_List_First(p_struct->balanceList);
1564       while (elem) {
1565         GWEN_XMLNODE *dbElem;
1566         dbElem=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "balance");
1567         assert(dbElem);
1568         AB_Balance_toXml(elem, dbElem);
1569         GWEN_XMLNode_AddChild(dbDest, dbElem);
1570         elem=AB_Balance_List_Next(elem);
1571       }
1572       GWEN_XMLNode_AddChild(p_db, dbDest);
1573     }
1574   }
1575 
1576   /* member "transactionList" */
1577   {
1578     if (p_struct->transactionList) {
1579       GWEN_XMLNODE *dbDest;
1580       AB_TRANSACTION *elem;
1581       dbDest=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "transactionList");
1582       elem=AB_Transaction_List_First(p_struct->transactionList);
1583       while (elem) {
1584         GWEN_XMLNODE *dbElem;
1585         dbElem=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "transaction");
1586         assert(dbElem);
1587         AB_Transaction_toXml(elem, dbElem);
1588         GWEN_XMLNode_AddChild(dbDest, dbElem);
1589         elem=AB_Transaction_List_Next(elem);
1590       }
1591       GWEN_XMLNode_AddChild(p_db, dbDest);
1592     }
1593   }
1594 
1595   /* member "eStatementList" */
1596   {
1597     if (p_struct->eStatementList) {
1598       GWEN_XMLNODE *dbDest;
1599       AB_DOCUMENT *elem;
1600       dbDest=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "eStatementList");
1601       elem=AB_Document_List_First(p_struct->eStatementList);
1602       while (elem) {
1603         GWEN_XMLNODE *dbElem;
1604         dbElem=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "eStatement");
1605         assert(dbElem);
1606         AB_Document_toXml(elem, dbElem);
1607         GWEN_XMLNode_AddChild(dbDest, dbElem);
1608         elem=AB_Document_List_Next(elem);
1609       }
1610       GWEN_XMLNode_AddChild(p_db, dbDest);
1611     }
1612   }
1613 
1614 }
1615 
AB_ImExporterAccountInfo_toXml(const AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_XMLNODE * p_db)1616 void AB_ImExporterAccountInfo_toXml(const AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_XMLNODE *p_db)
1617 {
1618   AB_ImExporterAccountInfo_WriteXml(p_struct, p_db);
1619 }
1620 
AB_ImExporterAccountInfo_fromXml(GWEN_XMLNODE * p_db)1621 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_fromXml(GWEN_XMLNODE *p_db)
1622 {
1623   AB_IMEXPORTER_ACCOUNTINFO *p_struct;
1624   p_struct=AB_ImExporterAccountInfo_new();
1625   AB_ImExporterAccountInfo_ReadXml(p_struct, p_db);
1626   return p_struct;
1627 }
1628 
AB_ImExporterAccountInfo_List_GetByIban(const AB_IMEXPORTER_ACCOUNTINFO_LIST * p_list,const char * p_cmp)1629 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_GetByIban(const AB_IMEXPORTER_ACCOUNTINFO_LIST *p_list,
1630                                                                    const char *p_cmp)
1631 {
1632   AB_IMEXPORTER_ACCOUNTINFO *p_struct;
1633 
1634   assert(p_list);
1635   p_struct = AB_ImExporterAccountInfo_List_First(p_list);
1636   while (p_struct) {
1637     int p_rv;
1638 
1639     if (p_struct->iban && p_cmp)
1640       p_rv=strcasecmp(p_cmp, p_struct->iban);
1641     else if (p_cmp)
1642       p_rv=1;
1643     else if (p_struct->iban)
1644       p_rv=-1;
1645     else
1646       p_rv=0;
1647     if (p_rv == 0)
1648       return p_struct;
1649     p_struct = AB_ImExporterAccountInfo_List_Next(p_struct);
1650   }
1651   return NULL;
1652 }
1653 
AB_ImExporterAccountInfo_List_GetByAccountId(const AB_IMEXPORTER_ACCOUNTINFO_LIST * p_list,uint32_t p_cmp)1654 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_GetByAccountId(const AB_IMEXPORTER_ACCOUNTINFO_LIST *p_list,
1655                                                                         uint32_t p_cmp)
1656 {
1657   AB_IMEXPORTER_ACCOUNTINFO *p_struct;
1658 
1659   assert(p_list);
1660   p_struct = AB_ImExporterAccountInfo_List_First(p_list);
1661   while (p_struct) {
1662     int p_rv;
1663 
1664     if (p_struct->accountId==p_cmp)
1665       p_rv=0;
1666     else if (p_cmp<p_struct->accountId)
1667       p_rv=-1;
1668     else
1669       p_rv=1;
1670     if (p_rv == 0)
1671       return p_struct;
1672     p_struct = AB_ImExporterAccountInfo_List_Next(p_struct);
1673   }
1674   return NULL;
1675 }
1676 
AB_ImExporterAccountInfo_toHashString(const AB_IMEXPORTER_ACCOUNTINFO * p_struct,GWEN_BUFFER * p_buffer)1677 void AB_ImExporterAccountInfo_toHashString(const AB_IMEXPORTER_ACCOUNTINFO *p_struct, GWEN_BUFFER *p_buffer)
1678 {
1679   assert(p_struct);
1680   /* member "country" */
1681   if (p_struct->country)
1682     GWEN_Buffer_AppendString(p_buffer, p_struct->country);
1683   GWEN_Buffer_AppendByte(p_buffer, ':');
1684   /* member "bankCode" */
1685   if (p_struct->bankCode)
1686     GWEN_Buffer_AppendString(p_buffer, p_struct->bankCode);
1687   GWEN_Buffer_AppendByte(p_buffer, ':');
1688   /* member "bankName" */
1689   if (p_struct->bankName)
1690     GWEN_Buffer_AppendString(p_buffer, p_struct->bankName);
1691   GWEN_Buffer_AppendByte(p_buffer, ':');
1692   /* member "accountNumber" */
1693   if (p_struct->accountNumber)
1694     GWEN_Buffer_AppendString(p_buffer, p_struct->accountNumber);
1695   GWEN_Buffer_AppendByte(p_buffer, ':');
1696   /* member "subAccountId" */
1697   if (p_struct->subAccountId)
1698     GWEN_Buffer_AppendString(p_buffer, p_struct->subAccountId);
1699   GWEN_Buffer_AppendByte(p_buffer, ':');
1700   /* member "accountName" */
1701   if (p_struct->accountName)
1702     GWEN_Buffer_AppendString(p_buffer, p_struct->accountName);
1703   GWEN_Buffer_AppendByte(p_buffer, ':');
1704   /* member "iban" */
1705   if (p_struct->iban)
1706     GWEN_Buffer_AppendString(p_buffer, p_struct->iban);
1707   GWEN_Buffer_AppendByte(p_buffer, ':');
1708   /* member "bic" */
1709   if (p_struct->bic)
1710     GWEN_Buffer_AppendString(p_buffer, p_struct->bic);
1711   GWEN_Buffer_AppendByte(p_buffer, ':');
1712   /* member "owner" */
1713   if (p_struct->owner)
1714     GWEN_Buffer_AppendString(p_buffer, p_struct->owner);
1715   GWEN_Buffer_AppendByte(p_buffer, ':');
1716   /* member "currency" */
1717   if (p_struct->currency)
1718     GWEN_Buffer_AppendString(p_buffer, p_struct->currency);
1719   GWEN_Buffer_AppendByte(p_buffer, ':');
1720   /* member "description" */
1721   if (p_struct->description)
1722     GWEN_Buffer_AppendString(p_buffer, p_struct->description);
1723   GWEN_Buffer_AppendByte(p_buffer, ':');
1724   /* member "accountType" */
1725   {
1726     char numbuf[32];
1727     snprintf(numbuf, sizeof(numbuf)-1, "%d", p_struct->accountType);
1728     numbuf[sizeof(numbuf)-1]=0;
1729     GWEN_Buffer_AppendString(p_buffer, numbuf);
1730   }
1731   GWEN_Buffer_AppendByte(p_buffer, ':');
1732   /* member "accountId" */
1733   {
1734     char numbuf[32];
1735     snprintf(numbuf, sizeof(numbuf)-1, "%d", p_struct->accountId);
1736     numbuf[sizeof(numbuf)-1]=0;
1737     GWEN_Buffer_AppendString(p_buffer, numbuf);
1738   }
1739   GWEN_Buffer_AppendByte(p_buffer, ':');
1740   /* member "balanceList" does not have the with_hash flag, ignoring */
1741   /* member "transactionList" does not have the with_hash flag, ignoring */
1742   /* member "eStatementList" does not have the with_hash flag, ignoring */
1743 }
1744 
AB_ImExporterAccountInfo_List2__freeAll_cb(AB_IMEXPORTER_ACCOUNTINFO * t,void * user_data)1745 static AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List2__freeAll_cb(AB_IMEXPORTER_ACCOUNTINFO *t,
1746                                                                              void *user_data)
1747 {
1748   AB_ImExporterAccountInfo_free(t);
1749   return NULL;
1750 }
AB_ImExporterAccountInfo_List2_freeAll(AB_IMEXPORTER_ACCOUNTINFO_LIST2 * tl)1751 int AB_ImExporterAccountInfo_List2_freeAll(AB_IMEXPORTER_ACCOUNTINFO_LIST2 *tl)
1752 {
1753   if (tl) {
1754     AB_ImExporterAccountInfo_List2_ForEach(tl, AB_ImExporterAccountInfo_List2__freeAll_cb, NULL);
1755     AB_ImExporterAccountInfo_List2_free(tl);
1756   }
1757   else {
1758     DBG_ERROR(AQBANKING_LOGDOMAIN, "List missing");
1759     return GWEN_ERROR_INVALID;
1760   }
1761   return 0;
1762 }
AB_ImExporterAccountInfo_GetFirstTransaction(const AB_IMEXPORTER_ACCOUNTINFO * st,int ty,int cmd)1763 AB_TRANSACTION *AB_ImExporterAccountInfo_GetFirstTransaction(const AB_IMEXPORTER_ACCOUNTINFO *st, int ty, int cmd)
1764 {
1765   assert(st);
1766   if (st->transactionList)
1767     return AB_Transaction_List_FindFirstByType(st->transactionList, ty, cmd);
1768   return NULL;
1769 }
AB_ImExporterAccountInfo_AddTransaction(AB_IMEXPORTER_ACCOUNTINFO * st,AB_TRANSACTION * t)1770 void AB_ImExporterAccountInfo_AddTransaction(AB_IMEXPORTER_ACCOUNTINFO *st, AB_TRANSACTION *t)
1771 {
1772   assert(st);
1773   if (NULL==st->transactionList)
1774     st->transactionList=AB_Transaction_List_new();
1775   AB_Transaction_List_Add(t, st->transactionList);
1776 }
AB_ImExporterAccountInfo_GetTransactionCount(const AB_IMEXPORTER_ACCOUNTINFO * st,int ty,int cmd)1777 int AB_ImExporterAccountInfo_GetTransactionCount(const AB_IMEXPORTER_ACCOUNTINFO *st, int ty, int cmd)
1778 {
1779   assert(st);
1780   if (st->transactionList)
1781     return AB_Transaction_List_CountByType(st->transactionList, ty, cmd);
1782   return 0;
1783 }
AB_ImExporterAccountInfo_GetFirstBalance(const AB_IMEXPORTER_ACCOUNTINFO * st)1784 AB_BALANCE *AB_ImExporterAccountInfo_GetFirstBalance(const AB_IMEXPORTER_ACCOUNTINFO *st)
1785 {
1786   assert(st);
1787   if (st->balanceList)
1788     return AB_Balance_List_First(st->balanceList);
1789   return NULL;
1790 }
AB_ImExporterAccountInfo_AddBalance(AB_IMEXPORTER_ACCOUNTINFO * st,AB_BALANCE * bal)1791 void AB_ImExporterAccountInfo_AddBalance(AB_IMEXPORTER_ACCOUNTINFO *st, AB_BALANCE *bal)
1792 {
1793   assert(bal);
1794   if (NULL==st->balanceList)
1795     st->balanceList=AB_Balance_List_new();
1796   AB_Balance_List_Add(bal, st->balanceList);
1797 }
AB_ImExporterAccountInfo_GetFirstEStatement(const AB_IMEXPORTER_ACCOUNTINFO * st)1798 AB_DOCUMENT *AB_ImExporterAccountInfo_GetFirstEStatement(const AB_IMEXPORTER_ACCOUNTINFO *st)
1799 {
1800   assert(st);
1801   if (st->eStatementList)
1802     return AB_Document_List_First(st->eStatementList);
1803   return NULL;
1804 }
AB_ImExporterAccountInfo_AddEStatement(AB_IMEXPORTER_ACCOUNTINFO * st,AB_DOCUMENT * d)1805 void AB_ImExporterAccountInfo_AddEStatement(AB_IMEXPORTER_ACCOUNTINFO *st, AB_DOCUMENT *d)
1806 {
1807   assert(d);
1808   if (NULL==st->eStatementList)
1809     st->eStatementList=AB_Document_List_new();
1810   AB_Document_List_Add(d, st->eStatementList);
1811 }
AB_ImExporterAccountInfo_Clear(AB_IMEXPORTER_ACCOUNTINFO * st)1812 void AB_ImExporterAccountInfo_Clear(AB_IMEXPORTER_ACCOUNTINFO *st)
1813 {
1814   assert(st);
1815   if (st->transactionList)
1816     AB_Transaction_List_Clear(st->transactionList);
1817   if (st->balanceList)
1818     AB_Balance_List_Clear(st->balanceList);
1819   if (st->eStatementList)
1820     AB_Document_List_Clear(st->eStatementList);
1821 }
AB_ImExporterAccountInfo_FillFromTransaction(AB_IMEXPORTER_ACCOUNTINFO * st,const AB_TRANSACTION * t)1822 void AB_ImExporterAccountInfo_FillFromTransaction(AB_IMEXPORTER_ACCOUNTINFO *st, const AB_TRANSACTION *t)
1823 {
1824   const char *s;
1825   assert(st);
1826   assert(t);
1827   s=AB_Transaction_GetLocalBankCode(t);
1828   AB_ImExporterAccountInfo_SetBankCode(st, s);
1829   s=AB_Transaction_GetLocalAccountNumber(t);
1830   AB_ImExporterAccountInfo_SetAccountNumber(st, s);
1831   s=AB_Transaction_GetLocalSuffix(t);
1832   AB_ImExporterAccountInfo_SetSubAccountId(st, s);
1833   s=AB_Transaction_GetLocalIban(t);
1834   AB_ImExporterAccountInfo_SetIban(st, s);
1835   s=AB_Transaction_GetLocalBic(t);
1836   AB_ImExporterAccountInfo_SetBic(st, s);
1837   s=AB_Transaction_GetLocalName(t);
1838   AB_ImExporterAccountInfo_SetOwner(st, s);
1839 }
AB_ImExporterAccountInfo_List_GetByBankCodeAndAccountNumber(AB_IMEXPORTER_ACCOUNTINFO_LIST * l,const char * bankCode,const char * accountNumber,int accountType)1840 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_GetByBankCodeAndAccountNumber(
1841   AB_IMEXPORTER_ACCOUNTINFO_LIST *l, const char *bankCode, const char *accountNumber, int accountType)
1842 {
1843   AB_IMEXPORTER_ACCOUNTINFO *iea;
1844   assert(l);
1845   if (!bankCode)
1846     bankCode="";
1847   if (!accountNumber)
1848     accountNumber="";
1849   iea=AB_ImExporterAccountInfo_List_First(l);
1850   while (iea) {
1851     const char *sBankCode;
1852     const char *sAccountNumber;
1853     sBankCode=AB_ImExporterAccountInfo_GetBankCode(iea);
1854     if (sBankCode==NULL)
1855       sBankCode="";
1856     sAccountNumber=AB_ImExporterAccountInfo_GetAccountNumber(iea);
1857     if (sAccountNumber==NULL)
1858       sAccountNumber="";
1859     if ((strcasecmp(sBankCode, bankCode)==0) && (strcasecmp(sAccountNumber, accountNumber)==0) &&
1860         ((accountType<=AB_AccountType_Unknown) || (accountType==AB_ImExporterAccountInfo_GetAccountType(iea))))
1861       return iea;
1862     iea=AB_ImExporterAccountInfo_List_Next(iea);
1863   }
1864   return NULL;
1865 }
AB_ImExporterAccountInfo_List_Find(AB_IMEXPORTER_ACCOUNTINFO_LIST * l,uint32_t uniqueId,const char * iban,const char * bankCode,const char * accountNumber,int accountType)1866 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_Find(AB_IMEXPORTER_ACCOUNTINFO_LIST *l, uint32_t uniqueId,
1867                                                               const char *iban, const char *bankCode, const char *accountNumber, int accountType)
1868 {
1869   AB_IMEXPORTER_ACCOUNTINFO *iea=NULL;
1870   assert(l);
1871   if (uniqueId)
1872     iea=AB_ImExporterAccountInfo_List_GetByAccountId(l, uniqueId);
1873   if (iea==NULL && iban && *iban)
1874     AB_ImExporterAccountInfo_List_GetByIban(l, iban);
1875   if (iea==NULL)
1876     iea=AB_ImExporterAccountInfo_List_GetByBankCodeAndAccountNumber(l, bankCode, accountNumber, accountType);
1877   return iea;
1878 }
AB_ImExporterAccountInfo_Matches(const AB_IMEXPORTER_ACCOUNTINFO * a,uint32_t uniqueId,const char * country,const char * bankId,const char * accountNumber,const char * subAccountId,const char * iban,const char * currency,int ty)1879 int AB_ImExporterAccountInfo_Matches(const AB_IMEXPORTER_ACCOUNTINFO *a, uint32_t uniqueId, const char *country,
1880                                      const char *bankId, const char *accountNumber, const char *subAccountId, const char *iban, const char *currency,
1881                                      int ty)
1882 {
1883   const char *lcountry;
1884   const char *lbankId;
1885   const char *laccountNumber;
1886   const char *lsubAccountId;
1887   const char *liban;
1888   const char *lcurrency;
1889   int lty;
1890   if (!country)
1891     country="*";
1892   if (!bankId)
1893     bankId="*";
1894   if (!accountNumber)
1895     accountNumber="*";
1896   if (!subAccountId)
1897     subAccountId="*";
1898   if (!iban)
1899     iban="*";
1900   if (!currency)
1901     currency="*";
1902   if (ty>=AB_AccountType_Last)
1903     ty=AB_AccountType_Unknown;
1904   lcountry=AB_ImExporterAccountInfo_GetCountry(a);
1905   lbankId=AB_ImExporterAccountInfo_GetBankCode(a);
1906   laccountNumber=AB_ImExporterAccountInfo_GetAccountNumber(a);
1907   lsubAccountId=AB_ImExporterAccountInfo_GetSubAccountId(a);
1908   liban=AB_ImExporterAccountInfo_GetIban(a);
1909   lcurrency=AB_ImExporterAccountInfo_GetCurrency(a);
1910   lty=AB_ImExporterAccountInfo_GetAccountType(a);
1911   if (!lcountry)
1912     lcountry="";
1913   if (!lbankId)
1914     lbankId="";
1915   if (!laccountNumber)
1916     laccountNumber="";
1917   if (!lsubAccountId)
1918     lsubAccountId="";
1919   if (!liban)
1920     liban="";
1921   if (!lcurrency)
1922     lcurrency="";
1923   if (lty>=AB_AccountType_Last || lty <=AB_AccountType_Unknown)
1924     lty=AB_AccountType_Unknown;
1925   if (((uniqueId==0 || uniqueId==AB_ImExporterAccountInfo_GetAccountId(a))) &&
1926       (-1!=GWEN_Text_ComparePattern(lcountry, country, 0)) && (-1!=GWEN_Text_ComparePattern(lbankId, bankId, 0)) &&
1927       (-1!=GWEN_Text_ComparePattern(laccountNumber, accountNumber, 0)) &&
1928       (-1!=GWEN_Text_ComparePattern(lsubAccountId, subAccountId, 0)) && (-1!=GWEN_Text_ComparePattern(liban, iban, 0)) &&
1929       (-1!=GWEN_Text_ComparePattern(lcurrency, currency, 0)) && ((ty==AB_AccountType_Unknown) || (ty==lty)))
1930     return 1;
1931   return 0;
1932 }
AB_ImExporterAccountInfo_List__FindInternal(AB_IMEXPORTER_ACCOUNTINFO * a,uint32_t uniqueId,const char * country,const char * bankId,const char * accountNumber,const char * subAccountId,const char * iban,const char * currency,int ty)1933 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List__FindInternal(AB_IMEXPORTER_ACCOUNTINFO *a, uint32_t uniqueId,
1934                                                                        const char *country, const char *bankId, const char *accountNumber, const char *subAccountId, const char *iban,
1935                                                                        const char *currency, int ty)
1936 {
1937   if (!country)
1938     country="*";
1939   if (!bankId)
1940     bankId="*";
1941   if (!accountNumber)
1942     accountNumber="*";
1943   if (!subAccountId)
1944     subAccountId="*";
1945   if (!iban)
1946     iban="*";
1947   if (!currency)
1948     currency="*";
1949   if (ty>=AB_AccountType_Last)
1950     ty=AB_AccountType_Unknown;
1951   while (a) {
1952     int rv;
1953     rv=AB_ImExporterAccountInfo_Matches(a, uniqueId, country, bankId, accountNumber, subAccountId, iban, currency, ty);
1954     if (rv==1)
1955       break;
1956     a=AB_ImExporterAccountInfo_List_Next(a);
1957   } /* while */ return a;
1958 }
AB_ImExporterAccountInfo_List_FindFirst(AB_IMEXPORTER_ACCOUNTINFO_LIST * al,uint32_t uniqueId,const char * country,const char * bankId,const char * accountNumber,const char * subAccountId,const char * iban,const char * currency,int ty)1959 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_FindFirst(AB_IMEXPORTER_ACCOUNTINFO_LIST *al,
1960                                                                    uint32_t uniqueId, const char *country, const char *bankId, const char *accountNumber, const char *subAccountId,
1961                                                                    const char *iban, const char *currency, int ty)
1962 {
1963   AB_IMEXPORTER_ACCOUNTINFO *a;
1964   if (AB_ImExporterAccountInfo_List_GetCount(al)==0) {
1965     DBG_INFO(AQBANKING_LOGDOMAIN, "No accounts");
1966     return NULL;
1967   }
1968   a=AB_ImExporterAccountInfo_List_First(al);
1969   assert(a);
1970   return AB_ImExporterAccountInfo_List__FindInternal(a, uniqueId, country, bankId, accountNumber, subAccountId, iban,
1971                                                      currency, ty);
1972 }
AB_ImExporterAccountInfo_List_FindNext(AB_IMEXPORTER_ACCOUNTINFO * a,uint32_t uniqueId,const char * country,const char * bankId,const char * accountNumber,const char * subAccountId,const char * iban,const char * currency,int ty)1973 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_FindNext(AB_IMEXPORTER_ACCOUNTINFO *a, uint32_t uniqueId,
1974                                                                   const char *country, const char *bankId, const char *accountNumber, const char *subAccountId, const char *iban,
1975                                                                   const char *currency, int ty)
1976 {
1977   assert(a);
1978   a=AB_ImExporterAccountInfo_List_Next(a);
1979   if (a==NULL) {
1980     DBG_INFO(AQBANKING_LOGDOMAIN, "No more account specs");
1981     return NULL;
1982   }
1983   return AB_ImExporterAccountInfo_List__FindInternal(a, uniqueId, country, bankId, accountNumber, subAccountId, iban,
1984                                                      currency, ty);
1985 }
AB_ImExporterAccountInfo_List_GetOrAdd(AB_IMEXPORTER_ACCOUNTINFO_LIST * l,uint32_t uniqueId,const char * iban,const char * bankCode,const char * accountNumber,int accountType)1986 AB_IMEXPORTER_ACCOUNTINFO *AB_ImExporterAccountInfo_List_GetOrAdd(AB_IMEXPORTER_ACCOUNTINFO_LIST *l, uint32_t uniqueId,
1987                                                                   const char *iban, const char *bankCode, const char *accountNumber, int accountType)
1988 {
1989   AB_IMEXPORTER_ACCOUNTINFO *iea=NULL;
1990   assert(l);
1991   iea=AB_ImExporterAccountInfo_List_Find(l, uniqueId, iban, bankCode, accountNumber, accountType);
1992   if (iea==NULL) {
1993     iea=AB_ImExporterAccountInfo_new();
1994     AB_ImExporterAccountInfo_SetAccountId(iea, uniqueId);
1995     AB_ImExporterAccountInfo_SetIban(iea, iban);
1996     AB_ImExporterAccountInfo_SetBankCode(iea, bankCode);
1997     AB_ImExporterAccountInfo_SetAccountNumber(iea, accountNumber);
1998     AB_ImExporterAccountInfo_SetAccountType(iea, accountType);
1999     AB_ImExporterAccountInfo_List_Add(iea, l);
2000   }
2001   return iea;
2002 }
2003 
2004 /* code headers */
2005 
2006