/**********************************************************
 * This file has been automatically created by "typemaker2"
 * from the file "bankinfo.xml".
 * Please do not edit this file, all changes will be lost.
 * Better edit the mentioned source file instead.
 **********************************************************/

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include "./bankinfo_p.h"

#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>

/* code headers */

/* macro functions */
GWEN_LIST_FUNCTIONS(AB_BANKINFO, AB_BankInfo)
GWEN_LIST2_FUNCTIONS(AB_BANKINFO, AB_BankInfo)


AB_BANKINFO *AB_BankInfo_new(void) {
  AB_BANKINFO *p_struct;

  GWEN_NEW_OBJECT(AB_BANKINFO, p_struct)
  p_struct->_refCount=1;
  GWEN_LIST_INIT(AB_BANKINFO, p_struct)
  /* members */
  p_struct->country=NULL;
  p_struct->branchId=NULL;
  p_struct->bankId=NULL;
  p_struct->bic=NULL;
  p_struct->bankName=NULL;
  p_struct->location=NULL;
  p_struct->street=NULL;
  p_struct->zipcode=NULL;
  p_struct->city=NULL;
  p_struct->region=NULL;
  p_struct->phone=NULL;
  p_struct->fax=NULL;
  p_struct->email=NULL;
  p_struct->website=NULL;
  p_struct->services=AB_BankInfoService_List_new();
  /* virtual functions */

  return p_struct;
}

void AB_BankInfo_free(AB_BANKINFO *p_struct) {
  if (p_struct) {
  assert(p_struct->_refCount);
  if (p_struct->_refCount==1) {
    GWEN_LIST_FINI(AB_BANKINFO, p_struct)
  /* members */
    free(p_struct->country); p_struct->country=NULL;
    free(p_struct->branchId); p_struct->branchId=NULL;
    free(p_struct->bankId); p_struct->bankId=NULL;
    free(p_struct->bic); p_struct->bic=NULL;
    free(p_struct->bankName); p_struct->bankName=NULL;
    free(p_struct->location); p_struct->location=NULL;
    free(p_struct->street); p_struct->street=NULL;
    free(p_struct->zipcode); p_struct->zipcode=NULL;
    free(p_struct->city); p_struct->city=NULL;
    free(p_struct->region); p_struct->region=NULL;
    free(p_struct->phone); p_struct->phone=NULL;
    free(p_struct->fax); p_struct->fax=NULL;
    free(p_struct->email); p_struct->email=NULL;
    free(p_struct->website); p_struct->website=NULL;
    AB_BankInfoService_List_free(p_struct->services); p_struct->services=NULL;
    p_struct->_refCount=0;
    GWEN_FREE_OBJECT(p_struct);
  }
  else
    p_struct->_refCount--;
  }
}

void AB_BankInfo_Attach(AB_BANKINFO *p_struct) {
  assert(p_struct);
  assert(p_struct->_refCount);
  p_struct->_refCount++;
}

AB_BANKINFO *AB_BankInfo_dup(const AB_BANKINFO *p_src) {
  AB_BANKINFO *p_struct;

  assert(p_src);
  p_struct=AB_BankInfo_new();
  /* member "country" */
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
    p_struct->country=NULL;
  }
  if (p_src->country) {
    p_struct->country=strdup(p_src->country);
  }

  /* member "branchId" */
  if (p_struct->branchId) {
    free(p_struct->branchId); p_struct->branchId=NULL;
    p_struct->branchId=NULL;
  }
  if (p_src->branchId) {
    p_struct->branchId=strdup(p_src->branchId);
  }

  /* member "bankId" */
  if (p_struct->bankId) {
    free(p_struct->bankId); p_struct->bankId=NULL;
    p_struct->bankId=NULL;
  }
  if (p_src->bankId) {
    p_struct->bankId=strdup(p_src->bankId);
  }

  /* member "bic" */
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
    p_struct->bic=NULL;
  }
  if (p_src->bic) {
    p_struct->bic=strdup(p_src->bic);
  }

  /* member "bankName" */
  if (p_struct->bankName) {
    free(p_struct->bankName); p_struct->bankName=NULL;
    p_struct->bankName=NULL;
  }
  if (p_src->bankName) {
    p_struct->bankName=strdup(p_src->bankName);
  }

  /* member "location" */
  if (p_struct->location) {
    free(p_struct->location); p_struct->location=NULL;
    p_struct->location=NULL;
  }
  if (p_src->location) {
    p_struct->location=strdup(p_src->location);
  }

  /* member "street" */
  if (p_struct->street) {
    free(p_struct->street); p_struct->street=NULL;
    p_struct->street=NULL;
  }
  if (p_src->street) {
    p_struct->street=strdup(p_src->street);
  }

  /* member "zipcode" */
  if (p_struct->zipcode) {
    free(p_struct->zipcode); p_struct->zipcode=NULL;
    p_struct->zipcode=NULL;
  }
  if (p_src->zipcode) {
    p_struct->zipcode=strdup(p_src->zipcode);
  }

  /* member "city" */
  if (p_struct->city) {
    free(p_struct->city); p_struct->city=NULL;
    p_struct->city=NULL;
  }
  if (p_src->city) {
    p_struct->city=strdup(p_src->city);
  }

  /* member "region" */
  if (p_struct->region) {
    free(p_struct->region); p_struct->region=NULL;
    p_struct->region=NULL;
  }
  if (p_src->region) {
    p_struct->region=strdup(p_src->region);
  }

  /* member "phone" */
  if (p_struct->phone) {
    free(p_struct->phone); p_struct->phone=NULL;
    p_struct->phone=NULL;
  }
  if (p_src->phone) {
    p_struct->phone=strdup(p_src->phone);
  }

  /* member "fax" */
  if (p_struct->fax) {
    free(p_struct->fax); p_struct->fax=NULL;
    p_struct->fax=NULL;
  }
  if (p_src->fax) {
    p_struct->fax=strdup(p_src->fax);
  }

  /* member "email" */
  if (p_struct->email) {
    free(p_struct->email); p_struct->email=NULL;
    p_struct->email=NULL;
  }
  if (p_src->email) {
    p_struct->email=strdup(p_src->email);
  }

  /* member "website" */
  if (p_struct->website) {
    free(p_struct->website); p_struct->website=NULL;
    p_struct->website=NULL;
  }
  if (p_src->website) {
    p_struct->website=strdup(p_src->website);
  }

  /* member "services" */
  if (p_struct->services) {
    AB_BankInfoService_List_free(p_struct->services); p_struct->services=NULL;
    p_struct->services=NULL;
  }
  if (p_src->services) {
    p_struct->services=AB_BankInfoService_List_dup(p_src->services);
  }

  return p_struct;
}

AB_BANKINFO *AB_BankInfo_copy(AB_BANKINFO *p_struct, const AB_BANKINFO *p_src) {
    assert(p_struct);
  assert(p_src);
  /* member "country" */
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
    p_struct->country=NULL;
  }
  if (p_src->country) {
    p_struct->country=strdup(p_src->country);
  }

  /* member "branchId" */
  if (p_struct->branchId) {
    free(p_struct->branchId); p_struct->branchId=NULL;
    p_struct->branchId=NULL;
  }
  if (p_src->branchId) {
    p_struct->branchId=strdup(p_src->branchId);
  }

  /* member "bankId" */
  if (p_struct->bankId) {
    free(p_struct->bankId); p_struct->bankId=NULL;
    p_struct->bankId=NULL;
  }
  if (p_src->bankId) {
    p_struct->bankId=strdup(p_src->bankId);
  }

  /* member "bic" */
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
    p_struct->bic=NULL;
  }
  if (p_src->bic) {
    p_struct->bic=strdup(p_src->bic);
  }

  /* member "bankName" */
  if (p_struct->bankName) {
    free(p_struct->bankName); p_struct->bankName=NULL;
    p_struct->bankName=NULL;
  }
  if (p_src->bankName) {
    p_struct->bankName=strdup(p_src->bankName);
  }

  /* member "location" */
  if (p_struct->location) {
    free(p_struct->location); p_struct->location=NULL;
    p_struct->location=NULL;
  }
  if (p_src->location) {
    p_struct->location=strdup(p_src->location);
  }

  /* member "street" */
  if (p_struct->street) {
    free(p_struct->street); p_struct->street=NULL;
    p_struct->street=NULL;
  }
  if (p_src->street) {
    p_struct->street=strdup(p_src->street);
  }

  /* member "zipcode" */
  if (p_struct->zipcode) {
    free(p_struct->zipcode); p_struct->zipcode=NULL;
    p_struct->zipcode=NULL;
  }
  if (p_src->zipcode) {
    p_struct->zipcode=strdup(p_src->zipcode);
  }

  /* member "city" */
  if (p_struct->city) {
    free(p_struct->city); p_struct->city=NULL;
    p_struct->city=NULL;
  }
  if (p_src->city) {
    p_struct->city=strdup(p_src->city);
  }

  /* member "region" */
  if (p_struct->region) {
    free(p_struct->region); p_struct->region=NULL;
    p_struct->region=NULL;
  }
  if (p_src->region) {
    p_struct->region=strdup(p_src->region);
  }

  /* member "phone" */
  if (p_struct->phone) {
    free(p_struct->phone); p_struct->phone=NULL;
    p_struct->phone=NULL;
  }
  if (p_src->phone) {
    p_struct->phone=strdup(p_src->phone);
  }

  /* member "fax" */
  if (p_struct->fax) {
    free(p_struct->fax); p_struct->fax=NULL;
    p_struct->fax=NULL;
  }
  if (p_src->fax) {
    p_struct->fax=strdup(p_src->fax);
  }

  /* member "email" */
  if (p_struct->email) {
    free(p_struct->email); p_struct->email=NULL;
    p_struct->email=NULL;
  }
  if (p_src->email) {
    p_struct->email=strdup(p_src->email);
  }

  /* member "website" */
  if (p_struct->website) {
    free(p_struct->website); p_struct->website=NULL;
    p_struct->website=NULL;
  }
  if (p_src->website) {
    p_struct->website=strdup(p_src->website);
  }

  /* member "services" */
  if (p_struct->services) {
    AB_BankInfoService_List_free(p_struct->services); p_struct->services=NULL;
    p_struct->services=NULL;
  }
  if (p_src->services) {
    p_struct->services=AB_BankInfoService_List_dup(p_src->services);
  }

  return p_struct;
}

const char *AB_BankInfo_GetCountry(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->country;
}

const char *AB_BankInfo_GetBranchId(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->branchId;
}

const char *AB_BankInfo_GetBankId(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->bankId;
}

const char *AB_BankInfo_GetBic(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->bic;
}

const char *AB_BankInfo_GetBankName(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->bankName;
}

const char *AB_BankInfo_GetLocation(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->location;
}

const char *AB_BankInfo_GetStreet(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->street;
}

const char *AB_BankInfo_GetZipcode(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->zipcode;
}

const char *AB_BankInfo_GetCity(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->city;
}

const char *AB_BankInfo_GetRegion(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->region;
}

const char *AB_BankInfo_GetPhone(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->phone;
}

const char *AB_BankInfo_GetFax(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->fax;
}

const char *AB_BankInfo_GetEmail(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->email;
}

const char *AB_BankInfo_GetWebsite(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->website;
}

AB_BANKINFO_SERVICE_LIST *AB_BankInfo_GetServices(const AB_BANKINFO *p_struct) {
  assert(p_struct);
  return p_struct->services;
}

void AB_BankInfo_SetCountry(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
  }
  if (p_src) {
    p_struct->country=strdup(p_src);
  }
  else {
    p_struct->country=NULL;
  }
}

void AB_BankInfo_SetBranchId(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->branchId) {
    free(p_struct->branchId); p_struct->branchId=NULL;
  }
  if (p_src) {
    p_struct->branchId=strdup(p_src);
  }
  else {
    p_struct->branchId=NULL;
  }
}

void AB_BankInfo_SetBankId(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->bankId) {
    free(p_struct->bankId); p_struct->bankId=NULL;
  }
  if (p_src) {
    p_struct->bankId=strdup(p_src);
  }
  else {
    p_struct->bankId=NULL;
  }
}

void AB_BankInfo_SetBic(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
  }
  if (p_src) {
    p_struct->bic=strdup(p_src);
  }
  else {
    p_struct->bic=NULL;
  }
}

void AB_BankInfo_SetBankName(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->bankName) {
    free(p_struct->bankName); p_struct->bankName=NULL;
  }
  if (p_src) {
    p_struct->bankName=strdup(p_src);
  }
  else {
    p_struct->bankName=NULL;
  }
}

void AB_BankInfo_SetLocation(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->location) {
    free(p_struct->location); p_struct->location=NULL;
  }
  if (p_src) {
    p_struct->location=strdup(p_src);
  }
  else {
    p_struct->location=NULL;
  }
}

void AB_BankInfo_SetStreet(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->street) {
    free(p_struct->street); p_struct->street=NULL;
  }
  if (p_src) {
    p_struct->street=strdup(p_src);
  }
  else {
    p_struct->street=NULL;
  }
}

void AB_BankInfo_SetZipcode(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->zipcode) {
    free(p_struct->zipcode); p_struct->zipcode=NULL;
  }
  if (p_src) {
    p_struct->zipcode=strdup(p_src);
  }
  else {
    p_struct->zipcode=NULL;
  }
}

void AB_BankInfo_SetCity(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->city) {
    free(p_struct->city); p_struct->city=NULL;
  }
  if (p_src) {
    p_struct->city=strdup(p_src);
  }
  else {
    p_struct->city=NULL;
  }
}

void AB_BankInfo_SetRegion(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->region) {
    free(p_struct->region); p_struct->region=NULL;
  }
  if (p_src) {
    p_struct->region=strdup(p_src);
  }
  else {
    p_struct->region=NULL;
  }
}

void AB_BankInfo_SetPhone(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->phone) {
    free(p_struct->phone); p_struct->phone=NULL;
  }
  if (p_src) {
    p_struct->phone=strdup(p_src);
  }
  else {
    p_struct->phone=NULL;
  }
}

void AB_BankInfo_SetFax(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->fax) {
    free(p_struct->fax); p_struct->fax=NULL;
  }
  if (p_src) {
    p_struct->fax=strdup(p_src);
  }
  else {
    p_struct->fax=NULL;
  }
}

void AB_BankInfo_SetEmail(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->email) {
    free(p_struct->email); p_struct->email=NULL;
  }
  if (p_src) {
    p_struct->email=strdup(p_src);
  }
  else {
    p_struct->email=NULL;
  }
}

void AB_BankInfo_SetWebsite(AB_BANKINFO *p_struct, const char *p_src) {
  assert(p_struct);
  if (p_struct->website) {
    free(p_struct->website); p_struct->website=NULL;
  }
  if (p_src) {
    p_struct->website=strdup(p_src);
  }
  else {
    p_struct->website=NULL;
  }
}

void AB_BankInfo_SetServices(AB_BANKINFO *p_struct, AB_BANKINFO_SERVICE_LIST *p_src) {
  assert(p_struct);
  if (p_struct->services) {
    AB_BankInfoService_List_free(p_struct->services); p_struct->services=NULL;
  }
  p_struct->services=p_src;
}

/* list1 functions */
AB_BANKINFO_LIST *AB_BankInfo_List_dup(const AB_BANKINFO_LIST *p_src) {
  AB_BANKINFO_LIST *p_dest;
  AB_BANKINFO *p_elem;

  assert(p_src);
  p_dest=AB_BankInfo_List_new();
  p_elem=AB_BankInfo_List_First(p_src);
  while(p_elem) {
    AB_BANKINFO *p_cpy;

    p_cpy=AB_BankInfo_dup(p_elem);
    AB_BankInfo_List_Add(p_cpy, p_dest);
    p_elem=AB_BankInfo_List_Next(p_elem);
  }

  return p_dest;
}

void AB_BankInfo_ReadDb(AB_BANKINFO *p_struct, GWEN_DB_NODE *p_db) {
  assert(p_struct);
  /* member "country" */
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "country", 0, NULL); if (s) p_struct->country=strdup(s); }
  if (p_struct->country==NULL) {  p_struct->country=NULL;
  }

  /* member "branchId" */
  if (p_struct->branchId) {
    free(p_struct->branchId); p_struct->branchId=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "branchId", 0, NULL); if (s) p_struct->branchId=strdup(s); }
  if (p_struct->branchId==NULL) {  p_struct->branchId=NULL;
  }

  /* member "bankId" */
  if (p_struct->bankId) {
    free(p_struct->bankId); p_struct->bankId=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "bankId", 0, NULL); if (s) p_struct->bankId=strdup(s); }
  if (p_struct->bankId==NULL) {  p_struct->bankId=NULL;
  }

  /* member "bic" */
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "bic", 0, NULL); if (s) p_struct->bic=strdup(s); }
  if (p_struct->bic==NULL) {  p_struct->bic=NULL;
  }

  /* member "bankName" */
  if (p_struct->bankName) {
    free(p_struct->bankName); p_struct->bankName=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "bankName", 0, NULL); if (s) p_struct->bankName=strdup(s); }
  if (p_struct->bankName==NULL) {  p_struct->bankName=NULL;
  }

  /* member "location" */
  if (p_struct->location) {
    free(p_struct->location); p_struct->location=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "location", 0, NULL); if (s) p_struct->location=strdup(s); }
  if (p_struct->location==NULL) {  p_struct->location=NULL;
  }

  /* member "street" */
  if (p_struct->street) {
    free(p_struct->street); p_struct->street=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "street", 0, NULL); if (s) p_struct->street=strdup(s); }
  if (p_struct->street==NULL) {  p_struct->street=NULL;
  }

  /* member "zipcode" */
  if (p_struct->zipcode) {
    free(p_struct->zipcode); p_struct->zipcode=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "zipcode", 0, NULL); if (s) p_struct->zipcode=strdup(s); }
  if (p_struct->zipcode==NULL) {  p_struct->zipcode=NULL;
  }

  /* member "city" */
  if (p_struct->city) {
    free(p_struct->city); p_struct->city=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "city", 0, NULL); if (s) p_struct->city=strdup(s); }
  if (p_struct->city==NULL) {  p_struct->city=NULL;
  }

  /* member "region" */
  if (p_struct->region) {
    free(p_struct->region); p_struct->region=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "region", 0, NULL); if (s) p_struct->region=strdup(s); }
  if (p_struct->region==NULL) {  p_struct->region=NULL;
  }

  /* member "phone" */
  if (p_struct->phone) {
    free(p_struct->phone); p_struct->phone=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "phone", 0, NULL); if (s) p_struct->phone=strdup(s); }
  if (p_struct->phone==NULL) {  p_struct->phone=NULL;
  }

  /* member "fax" */
  if (p_struct->fax) {
    free(p_struct->fax); p_struct->fax=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "fax", 0, NULL); if (s) p_struct->fax=strdup(s); }
  if (p_struct->fax==NULL) {  p_struct->fax=NULL;
  }

  /* member "email" */
  if (p_struct->email) {
    free(p_struct->email); p_struct->email=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "email", 0, NULL); if (s) p_struct->email=strdup(s); }
  if (p_struct->email==NULL) {  p_struct->email=NULL;
  }

  /* member "website" */
  if (p_struct->website) {
    free(p_struct->website); p_struct->website=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "website", 0, NULL); if (s) p_struct->website=strdup(s); }
  if (p_struct->website==NULL) {  p_struct->website=NULL;
  }

  /* member "services" */
  if (p_struct->services) {
    AB_BankInfoService_List_free(p_struct->services); p_struct->services=NULL;
  }
  { GWEN_DB_NODE *dbSource; dbSource=GWEN_DB_GetGroup(p_db, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "services"); if (dbSource) { AB_BANKINFO_SERVICE_LIST *t; GWEN_DB_NODE *dbT; t=AB_BankInfoService_List_new(); dbT=GWEN_DB_FindFirstGroup(dbSource, "element"); while(dbT) { AB_BANKINFO_SERVICE *elem; elem=AB_BankInfoService_fromDb(dbT); if (elem) AB_BankInfoService_List_Add(elem, t); dbT=GWEN_DB_FindNextGroup(dbT, "element"); } p_struct->services=t; } else p_struct->services=AB_BankInfoService_List_new(); }
  if (p_struct->services==NULL) {  p_struct->services=AB_BankInfoService_List_new();
  }

}

int AB_BankInfo_WriteDb(const AB_BANKINFO *p_struct, GWEN_DB_NODE *p_db) {
  int p_rv;

  assert(p_struct);
  /* member "country" */
  if (p_struct->country) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "country", p_struct->country); else { GWEN_DB_DeleteVar(p_db, "country"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "branchId" */
  if (p_struct->branchId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "branchId", p_struct->branchId); else { GWEN_DB_DeleteVar(p_db, "branchId"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "bankId" */
  if (p_struct->bankId) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankId", p_struct->bankId); else { GWEN_DB_DeleteVar(p_db, "bankId"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "bic" */
  if (p_struct->bic) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bic", p_struct->bic); else { GWEN_DB_DeleteVar(p_db, "bic"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "bankName" */
  if (p_struct->bankName) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankName", p_struct->bankName); else { GWEN_DB_DeleteVar(p_db, "bankName"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "location" */
  if (p_struct->location) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "location", p_struct->location); else { GWEN_DB_DeleteVar(p_db, "location"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "street" */
  if (p_struct->street) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "street", p_struct->street); else { GWEN_DB_DeleteVar(p_db, "street"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "zipcode" */
  if (p_struct->zipcode) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "zipcode", p_struct->zipcode); else { GWEN_DB_DeleteVar(p_db, "zipcode"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "city" */
  if (p_struct->city) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "city", p_struct->city); else { GWEN_DB_DeleteVar(p_db, "city"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "region" */
  if (p_struct->region) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "region", p_struct->region); else { GWEN_DB_DeleteVar(p_db, "region"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "phone" */
  if (p_struct->phone) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "phone", p_struct->phone); else { GWEN_DB_DeleteVar(p_db, "phone"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "fax" */
  if (p_struct->fax) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "fax", p_struct->fax); else { GWEN_DB_DeleteVar(p_db, "fax"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "email" */
  if (p_struct->email) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "email", p_struct->email); else { GWEN_DB_DeleteVar(p_db, "email"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "website" */
  if (p_struct->website) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "website", p_struct->website); else { GWEN_DB_DeleteVar(p_db, "website"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  /* member "services" */
  { if (p_struct->services) { GWEN_DB_NODE *dbDest; AB_BANKINFO_SERVICE *elem; dbDest=GWEN_DB_GetGroup(p_db, GWEN_DB_FLAGS_OVERWRITE_GROUPS, "services"); assert(dbDest); p_rv=0; elem=AB_BankInfoService_List_First(p_struct->services); while(elem) { GWEN_DB_NODE *dbElem; dbElem=GWEN_DB_GetGroup(dbDest, GWEN_PATH_FLAGS_CREATE_GROUP, "element"); assert(dbElem); p_rv=AB_BankInfoService_toDb(elem, dbElem); if (p_rv<0) { DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", p_rv); break; } elem=AB_BankInfoService_List_Next(elem); } } else p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }

  return 0;
}

AB_BANKINFO *AB_BankInfo_fromDb(GWEN_DB_NODE *p_db) {
  AB_BANKINFO *p_struct;
  p_struct=AB_BankInfo_new();
  AB_BankInfo_ReadDb(p_struct, p_db);
  return p_struct;
}

int AB_BankInfo_toDb(const AB_BANKINFO *p_struct, GWEN_DB_NODE *p_db) {
  return AB_BankInfo_WriteDb(p_struct, p_db);
}

void AB_BankInfo_ReadXml(AB_BANKINFO *p_struct, GWEN_XMLNODE *p_db) {
  assert(p_struct);
  /* member "country" */
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "country", NULL); if (s) p_struct->country=strdup(s); }
  if (p_struct->country==NULL) {  /* preset member "country" if empty */
  p_struct->country=NULL;
  }

  /* member "branchId" */
  if (p_struct->branchId) {
    free(p_struct->branchId); p_struct->branchId=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "branchId", NULL); if (s) p_struct->branchId=strdup(s); }
  if (p_struct->branchId==NULL) {  /* preset member "branchId" if empty */
  p_struct->branchId=NULL;
  }

  /* member "bankId" */
  if (p_struct->bankId) {
    free(p_struct->bankId); p_struct->bankId=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "bankId", NULL); if (s) p_struct->bankId=strdup(s); }
  if (p_struct->bankId==NULL) {  /* preset member "bankId" if empty */
  p_struct->bankId=NULL;
  }

  /* member "bic" */
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "bic", NULL); if (s) p_struct->bic=strdup(s); }
  if (p_struct->bic==NULL) {  /* preset member "bic" if empty */
  p_struct->bic=NULL;
  }

  /* member "bankName" */
  if (p_struct->bankName) {
    free(p_struct->bankName); p_struct->bankName=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "bankName", NULL); if (s) p_struct->bankName=strdup(s); }
  if (p_struct->bankName==NULL) {  /* preset member "bankName" if empty */
  p_struct->bankName=NULL;
  }

  /* member "location" */
  if (p_struct->location) {
    free(p_struct->location); p_struct->location=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "location", NULL); if (s) p_struct->location=strdup(s); }
  if (p_struct->location==NULL) {  /* preset member "location" if empty */
  p_struct->location=NULL;
  }

  /* member "street" */
  if (p_struct->street) {
    free(p_struct->street); p_struct->street=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "street", NULL); if (s) p_struct->street=strdup(s); }
  if (p_struct->street==NULL) {  /* preset member "street" if empty */
  p_struct->street=NULL;
  }

  /* member "zipcode" */
  if (p_struct->zipcode) {
    free(p_struct->zipcode); p_struct->zipcode=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "zipcode", NULL); if (s) p_struct->zipcode=strdup(s); }
  if (p_struct->zipcode==NULL) {  /* preset member "zipcode" if empty */
  p_struct->zipcode=NULL;
  }

  /* member "city" */
  if (p_struct->city) {
    free(p_struct->city); p_struct->city=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "city", NULL); if (s) p_struct->city=strdup(s); }
  if (p_struct->city==NULL) {  /* preset member "city" if empty */
  p_struct->city=NULL;
  }

  /* member "region" */
  if (p_struct->region) {
    free(p_struct->region); p_struct->region=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "region", NULL); if (s) p_struct->region=strdup(s); }
  if (p_struct->region==NULL) {  /* preset member "region" if empty */
  p_struct->region=NULL;
  }

  /* member "phone" */
  if (p_struct->phone) {
    free(p_struct->phone); p_struct->phone=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "phone", NULL); if (s) p_struct->phone=strdup(s); }
  if (p_struct->phone==NULL) {  /* preset member "phone" if empty */
  p_struct->phone=NULL;
  }

  /* member "fax" */
  if (p_struct->fax) {
    free(p_struct->fax); p_struct->fax=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "fax", NULL); if (s) p_struct->fax=strdup(s); }
  if (p_struct->fax==NULL) {  /* preset member "fax" if empty */
  p_struct->fax=NULL;
  }

  /* member "email" */
  if (p_struct->email) {
    free(p_struct->email); p_struct->email=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "email", NULL); if (s) p_struct->email=strdup(s); }
  if (p_struct->email==NULL) {  /* preset member "email" if empty */
  p_struct->email=NULL;
  }

  /* member "website" */
  if (p_struct->website) {
    free(p_struct->website); p_struct->website=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "website", NULL); if (s) p_struct->website=strdup(s); }
  if (p_struct->website==NULL) {  /* preset member "website" if empty */
  p_struct->website=NULL;
  }

  /* member "services" */
  if (p_struct->services) {
    AB_BankInfoService_List_free(p_struct->services); p_struct->services=NULL;
  }
  { GWEN_XMLNODE *dbSource; dbSource=GWEN_XMLNode_FindFirstTag(p_db, "services", NULL, NULL); if (dbSource) { AB_BANKINFO_SERVICE_LIST *t; GWEN_XMLNODE *dbT; t=AB_BankInfoService_List_new(); dbT=GWEN_XMLNode_FindFirstTag(dbSource, "element", NULL, NULL); while(dbT) { AB_BANKINFO_SERVICE *elem; elem=AB_BankInfoService_fromXml(dbT); if (elem) AB_BankInfoService_List_Add(elem, t); dbT=GWEN_XMLNode_FindNextTag(dbT, "element", NULL, NULL); } p_struct->services=t; } else p_struct->services=AB_BankInfoService_List_new(); }
  if (p_struct->services==NULL) {  /* preset member "services" if empty */
  p_struct->services=AB_BankInfoService_List_new();
  }

}

void AB_BankInfo_WriteXml(const AB_BANKINFO *p_struct, GWEN_XMLNODE *p_db) {
  assert(p_struct);
  /* member "country" */
  GWEN_XMLNode_SetCharValue(p_db, "country", p_struct->country);

  /* member "branchId" */
  GWEN_XMLNode_SetCharValue(p_db, "branchId", p_struct->branchId);

  /* member "bankId" */
  GWEN_XMLNode_SetCharValue(p_db, "bankId", p_struct->bankId);

  /* member "bic" */
  GWEN_XMLNode_SetCharValue(p_db, "bic", p_struct->bic);

  /* member "bankName" */
  GWEN_XMLNode_SetCharValue(p_db, "bankName", p_struct->bankName);

  /* member "location" */
  GWEN_XMLNode_SetCharValue(p_db, "location", p_struct->location);

  /* member "street" */
  GWEN_XMLNode_SetCharValue(p_db, "street", p_struct->street);

  /* member "zipcode" */
  GWEN_XMLNode_SetCharValue(p_db, "zipcode", p_struct->zipcode);

  /* member "city" */
  GWEN_XMLNode_SetCharValue(p_db, "city", p_struct->city);

  /* member "region" */
  GWEN_XMLNode_SetCharValue(p_db, "region", p_struct->region);

  /* member "phone" */
  GWEN_XMLNode_SetCharValue(p_db, "phone", p_struct->phone);

  /* member "fax" */
  GWEN_XMLNode_SetCharValue(p_db, "fax", p_struct->fax);

  /* member "email" */
  GWEN_XMLNode_SetCharValue(p_db, "email", p_struct->email);

  /* member "website" */
  GWEN_XMLNode_SetCharValue(p_db, "website", p_struct->website);

  /* member "services" */
  { if (p_struct->services) { GWEN_XMLNODE *dbDest; AB_BANKINFO_SERVICE *elem; dbDest=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "services"); elem=AB_BankInfoService_List_First(p_struct->services); while(elem) { GWEN_XMLNODE *dbElem; dbElem=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, "element"); assert(dbElem); AB_BankInfoService_toXml(elem, dbElem); GWEN_XMLNode_AddChild(dbDest, dbElem); elem=AB_BankInfoService_List_Next(elem); } GWEN_XMLNode_AddChild(p_db, dbDest); } }

}

void AB_BankInfo_toXml(const AB_BANKINFO *p_struct, GWEN_XMLNODE *p_db) {
  AB_BankInfo_WriteXml(p_struct, p_db);
}

AB_BANKINFO *AB_BankInfo_fromXml(GWEN_XMLNODE *p_db) {
  AB_BANKINFO *p_struct;
  p_struct=AB_BankInfo_new();
  AB_BankInfo_ReadXml(p_struct, p_db);
  return p_struct;
}

static AB_BANKINFO *AB_BankInfo_List2__freeAll_cb(AB_BANKINFO *t, void *user_data) { AB_BankInfo_free(t); return NULL; } int AB_BankInfo_List2_freeAll(AB_BANKINFO_LIST2 *tl) { if (tl) { AB_BankInfo_List2_ForEach(tl, AB_BankInfo_List2__freeAll_cb, NULL); AB_BankInfo_List2_free(tl); } else { DBG_ERROR(AQBANKING_LOGDOMAIN, "List missing"); return GWEN_ERROR_INVALID; } return 0; }

/* code headers */

