/**********************************************************
 * This file has been automatically created by "typemaker2"
 * from the file "refaccount.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 "./refaccount_p.h"

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

/* code headers */

/* macro functions */
GWEN_LIST_FUNCTIONS(AB_REFERENCE_ACCOUNT, AB_ReferenceAccount)
GWEN_LIST2_FUNCTIONS(AB_REFERENCE_ACCOUNT, AB_ReferenceAccount)


AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_new(void) {
  AB_REFERENCE_ACCOUNT *p_struct;

  GWEN_NEW_OBJECT(AB_REFERENCE_ACCOUNT, p_struct)
  p_struct->_refCount=1;
  GWEN_LIST_INIT(AB_REFERENCE_ACCOUNT, p_struct)
  /* members */
  p_struct->iban=NULL;
  p_struct->bic=NULL;
  p_struct->accountNumber=NULL;
  p_struct->subAccountNumber=NULL;
  p_struct->country=NULL;
  p_struct->bankCode=NULL;
  p_struct->ownerName=NULL;
  p_struct->ownerName2=NULL;
  p_struct->accountName=NULL;
  p_struct->accountType=0;
  /* virtual functions */

  return p_struct;
}

void AB_ReferenceAccount_free(AB_REFERENCE_ACCOUNT *p_struct) {
  if (p_struct) {
  assert(p_struct->_refCount);
  if (p_struct->_refCount==1) {
    GWEN_LIST_FINI(AB_REFERENCE_ACCOUNT, p_struct)
  /* members */
    free(p_struct->iban); p_struct->iban=NULL;
    free(p_struct->bic); p_struct->bic=NULL;
    free(p_struct->accountNumber); p_struct->accountNumber=NULL;
    free(p_struct->subAccountNumber); p_struct->subAccountNumber=NULL;
    free(p_struct->country); p_struct->country=NULL;
    free(p_struct->bankCode); p_struct->bankCode=NULL;
    free(p_struct->ownerName); p_struct->ownerName=NULL;
    free(p_struct->ownerName2); p_struct->ownerName2=NULL;
    free(p_struct->accountName); p_struct->accountName=NULL;
    
    p_struct->_refCount=0;
    GWEN_FREE_OBJECT(p_struct);
  }
  else
    p_struct->_refCount--;
  }
}

void AB_ReferenceAccount_Attach(AB_REFERENCE_ACCOUNT *p_struct) {
  assert(p_struct);
  assert(p_struct->_refCount);
  p_struct->_refCount++;
}

AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_dup(const AB_REFERENCE_ACCOUNT *p_src) {
  AB_REFERENCE_ACCOUNT *p_struct;

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


  /* 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 "accountNumber" */
  if (p_struct->accountNumber) {
    free(p_struct->accountNumber); p_struct->accountNumber=NULL;
    p_struct->accountNumber=NULL;
  }
  if (p_src->accountNumber) {
    p_struct->accountNumber=strdup(p_src->accountNumber);
  }


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


  /* 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 "bankCode" */
  if (p_struct->bankCode) {
    free(p_struct->bankCode); p_struct->bankCode=NULL;
    p_struct->bankCode=NULL;
  }
  if (p_src->bankCode) {
    p_struct->bankCode=strdup(p_src->bankCode);
  }


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


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


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


  /* member "accountType" */
    
    p_struct->accountType=p_src->accountType;


  return p_struct;
}

AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_copy(AB_REFERENCE_ACCOUNT *p_struct, const AB_REFERENCE_ACCOUNT *p_src) {
  assert(p_struct);
  assert(p_src);
  /* member "iban" */
  if (p_struct->iban) {
    free(p_struct->iban); p_struct->iban=NULL;
    p_struct->iban=NULL;
  }
  if (p_src->iban) {
    p_struct->iban=strdup(p_src->iban);
  }


  /* 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 "accountNumber" */
  if (p_struct->accountNumber) {
    free(p_struct->accountNumber); p_struct->accountNumber=NULL;
    p_struct->accountNumber=NULL;
  }
  if (p_src->accountNumber) {
    p_struct->accountNumber=strdup(p_src->accountNumber);
  }


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


  /* 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 "bankCode" */
  if (p_struct->bankCode) {
    free(p_struct->bankCode); p_struct->bankCode=NULL;
    p_struct->bankCode=NULL;
  }
  if (p_src->bankCode) {
    p_struct->bankCode=strdup(p_src->bankCode);
  }


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


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


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


  /* member "accountType" */
    
    p_struct->accountType=p_src->accountType;


  return p_struct;
}

const char *AB_ReferenceAccount_GetIban(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->iban;
}

const char *AB_ReferenceAccount_GetBic(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->bic;
}

const char *AB_ReferenceAccount_GetAccountNumber(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->accountNumber;
}

const char *AB_ReferenceAccount_GetSubAccountNumber(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->subAccountNumber;
}

const char *AB_ReferenceAccount_GetCountry(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->country;
}

const char *AB_ReferenceAccount_GetBankCode(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->bankCode;
}

const char *AB_ReferenceAccount_GetOwnerName(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->ownerName;
}

const char *AB_ReferenceAccount_GetOwnerName2(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->ownerName2;
}

const char *AB_ReferenceAccount_GetAccountName(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->accountName;
}

uint8_t AB_ReferenceAccount_GetAccountType(const AB_REFERENCE_ACCOUNT *p_struct){
  assert(p_struct);
  return p_struct->accountType;
}

void AB_ReferenceAccount_SetIban(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->iban) {
    free(p_struct->iban); p_struct->iban=NULL;
    p_struct->iban=NULL;
  }
  if (p_src) {
    p_struct->iban=strdup(p_src);
  }
  else {
    p_struct->iban=NULL;
  }

}

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

}

void AB_ReferenceAccount_SetAccountNumber(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->accountNumber) {
    free(p_struct->accountNumber); p_struct->accountNumber=NULL;
    p_struct->accountNumber=NULL;
  }
  if (p_src) {
    p_struct->accountNumber=strdup(p_src);
  }
  else {
    p_struct->accountNumber=NULL;
  }

}

void AB_ReferenceAccount_SetSubAccountNumber(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->subAccountNumber) {
    free(p_struct->subAccountNumber); p_struct->subAccountNumber=NULL;
    p_struct->subAccountNumber=NULL;
  }
  if (p_src) {
    p_struct->subAccountNumber=strdup(p_src);
  }
  else {
    p_struct->subAccountNumber=NULL;
  }

}

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

}

void AB_ReferenceAccount_SetBankCode(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->bankCode) {
    free(p_struct->bankCode); p_struct->bankCode=NULL;
    p_struct->bankCode=NULL;
  }
  if (p_src) {
    p_struct->bankCode=strdup(p_src);
  }
  else {
    p_struct->bankCode=NULL;
  }

}

void AB_ReferenceAccount_SetOwnerName(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->ownerName) {
    free(p_struct->ownerName); p_struct->ownerName=NULL;
    p_struct->ownerName=NULL;
  }
  if (p_src) {
    p_struct->ownerName=strdup(p_src);
  }
  else {
    p_struct->ownerName=NULL;
  }

}

void AB_ReferenceAccount_SetOwnerName2(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->ownerName2) {
    free(p_struct->ownerName2); p_struct->ownerName2=NULL;
    p_struct->ownerName2=NULL;
  }
  if (p_src) {
    p_struct->ownerName2=strdup(p_src);
  }
  else {
    p_struct->ownerName2=NULL;
  }

}

void AB_ReferenceAccount_SetAccountName(AB_REFERENCE_ACCOUNT *p_struct, const char *p_src){
  assert(p_struct);
  if (p_struct->accountName) {
    free(p_struct->accountName); p_struct->accountName=NULL;
    p_struct->accountName=NULL;
  }
  if (p_src) {
    p_struct->accountName=strdup(p_src);
  }
  else {
    p_struct->accountName=NULL;
  }

}

void AB_ReferenceAccount_SetAccountType(AB_REFERENCE_ACCOUNT *p_struct, uint8_t p_src){
  assert(p_struct);
    
    p_struct->accountType=p_src;

}

AB_REFERENCE_ACCOUNT_LIST *AB_ReferenceAccount_List_dup(const AB_REFERENCE_ACCOUNT_LIST *p_src) {
  AB_REFERENCE_ACCOUNT_LIST *p_dest;
  AB_REFERENCE_ACCOUNT *p_elem;

  assert(p_src);
  p_dest=AB_ReferenceAccount_List_new();
  p_elem=AB_ReferenceAccount_List_First(p_src);
  while(p_elem) {
    AB_REFERENCE_ACCOUNT *p_cpy;

    p_cpy=AB_ReferenceAccount_dup(p_elem);
    AB_ReferenceAccount_List_Add(p_cpy, p_dest);
    p_elem=AB_ReferenceAccount_List_Next(p_elem);
  }

  return p_dest;
}

void AB_ReferenceAccount_ReadDb(AB_REFERENCE_ACCOUNT *p_struct, GWEN_DB_NODE *p_db){
  assert(p_struct);
  /* member "iban" */
  if (p_struct->iban) {
    free(p_struct->iban); p_struct->iban=NULL;
    p_struct->iban=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "iban", 0, NULL); if (s) p_struct->iban=strdup(s); }
  /* member "bic" */
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
    p_struct->bic=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "bic", 0, NULL); if (s) p_struct->bic=strdup(s); }
  /* member "accountNumber" */
  if (p_struct->accountNumber) {
    free(p_struct->accountNumber); p_struct->accountNumber=NULL;
    p_struct->accountNumber=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "accountNumber", 0, NULL); if (s) p_struct->accountNumber=strdup(s); }
  /* member "subAccountNumber" */
  if (p_struct->subAccountNumber) {
    free(p_struct->subAccountNumber); p_struct->subAccountNumber=NULL;
    p_struct->subAccountNumber=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "subAccountNumber", 0, NULL); if (s) p_struct->subAccountNumber=strdup(s); }
  /* member "country" */
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
    p_struct->country=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "country", 0, NULL); if (s) p_struct->country=strdup(s); }
  /* member "bankCode" */
  if (p_struct->bankCode) {
    free(p_struct->bankCode); p_struct->bankCode=NULL;
    p_struct->bankCode=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "bankCode", 0, NULL); if (s) p_struct->bankCode=strdup(s); }
  /* member "ownerName" */
  if (p_struct->ownerName) {
    free(p_struct->ownerName); p_struct->ownerName=NULL;
    p_struct->ownerName=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "ownerName", 0, NULL); if (s) p_struct->ownerName=strdup(s); }
  /* member "ownerName2" */
  if (p_struct->ownerName2) {
    free(p_struct->ownerName2); p_struct->ownerName2=NULL;
    p_struct->ownerName2=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "ownerName2", 0, NULL); if (s) p_struct->ownerName2=strdup(s); }
  /* member "accountName" */
  if (p_struct->accountName) {
    free(p_struct->accountName); p_struct->accountName=NULL;
    p_struct->accountName=NULL;
  }
  { const char *s; s=GWEN_DB_GetCharValue(p_db, "accountName", 0, NULL); if (s) p_struct->accountName=strdup(s); }
  /* member "accountType" */
    
  p_struct->accountType=GWEN_DB_GetIntValue(p_db, "accountType", 0, 0);
}

int AB_ReferenceAccount_WriteDb(const AB_REFERENCE_ACCOUNT *p_struct, GWEN_DB_NODE *p_db) {
  int p_rv;

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


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


  /* 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 "bankCode" */
  if (p_struct->bankCode) p_rv=GWEN_DB_SetCharValue(p_db, GWEN_DB_FLAGS_OVERWRITE_VARS, "bankCode", p_struct->bankCode); else { GWEN_DB_DeleteVar(p_db, "bankCode"); p_rv=0; }
  if (p_rv<0) {
    DBG_INFO(GWEN_LOGDOMAIN, "here (%d)\n", p_rv);
    return p_rv;
  }


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


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


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


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


  return 0;
}

AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_fromDb(GWEN_DB_NODE *p_db) {
  AB_REFERENCE_ACCOUNT *p_struct;
  p_struct=AB_ReferenceAccount_new();
  AB_ReferenceAccount_ReadDb(p_struct, p_db);
  return p_struct;
}

int AB_ReferenceAccount_toDb(const AB_REFERENCE_ACCOUNT *p_struct, GWEN_DB_NODE *p_db) {
  return AB_ReferenceAccount_WriteDb(p_struct, p_db);
}

void AB_ReferenceAccount_ReadXml(AB_REFERENCE_ACCOUNT *p_struct, GWEN_XMLNODE *p_db){
  assert(p_struct);
  /* member "iban" */
  if (p_struct->iban) {
    free(p_struct->iban); p_struct->iban=NULL;
    p_struct->iban=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "iban", NULL); if (s) p_struct->iban=strdup(s); }
  /* member "bic" */
  if (p_struct->bic) {
    free(p_struct->bic); p_struct->bic=NULL;
    p_struct->bic=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "bic", NULL); if (s) p_struct->bic=strdup(s); }
  /* member "accountNumber" */
  if (p_struct->accountNumber) {
    free(p_struct->accountNumber); p_struct->accountNumber=NULL;
    p_struct->accountNumber=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "accountNumber", NULL); if (s) p_struct->accountNumber=strdup(s); }
  /* member "subAccountNumber" */
  if (p_struct->subAccountNumber) {
    free(p_struct->subAccountNumber); p_struct->subAccountNumber=NULL;
    p_struct->subAccountNumber=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "subAccountNumber", NULL); if (s) p_struct->subAccountNumber=strdup(s); }
  /* member "country" */
  if (p_struct->country) {
    free(p_struct->country); p_struct->country=NULL;
    p_struct->country=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "country", NULL); if (s) p_struct->country=strdup(s); }
  /* member "bankCode" */
  if (p_struct->bankCode) {
    free(p_struct->bankCode); p_struct->bankCode=NULL;
    p_struct->bankCode=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "bankCode", NULL); if (s) p_struct->bankCode=strdup(s); }
  /* member "ownerName" */
  if (p_struct->ownerName) {
    free(p_struct->ownerName); p_struct->ownerName=NULL;
    p_struct->ownerName=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "ownerName", NULL); if (s) p_struct->ownerName=strdup(s); }
  /* member "ownerName2" */
  if (p_struct->ownerName2) {
    free(p_struct->ownerName2); p_struct->ownerName2=NULL;
    p_struct->ownerName2=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "ownerName2", NULL); if (s) p_struct->ownerName2=strdup(s); }
  /* member "accountName" */
  if (p_struct->accountName) {
    free(p_struct->accountName); p_struct->accountName=NULL;
    p_struct->accountName=NULL;
  }
  { const char *s; s=GWEN_XMLNode_GetCharValue(p_db, "accountName", NULL); if (s) p_struct->accountName=strdup(s); }
  /* member "accountType" */
    
  p_struct->accountType=GWEN_XMLNode_GetIntValue(p_db, "accountType", 0);
}

void AB_ReferenceAccount_WriteXml(const AB_REFERENCE_ACCOUNT *p_struct, GWEN_XMLNODE *p_db) {
  assert(p_struct);
  /* member "iban" */
  GWEN_XMLNode_SetCharValue(p_db, "iban", p_struct->iban);


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


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


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


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


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


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


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


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


  /* member "accountType" */
  GWEN_XMLNode_SetIntValue(p_db, "accountType", p_struct->accountType);


}

void AB_ReferenceAccount_toXml(const AB_REFERENCE_ACCOUNT *p_struct, GWEN_XMLNODE *p_db) {
  AB_ReferenceAccount_WriteXml(p_struct, p_db);
}

AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_fromXml(GWEN_XMLNODE *p_db) {
  AB_REFERENCE_ACCOUNT *p_struct;
  p_struct=AB_ReferenceAccount_new();
  AB_ReferenceAccount_ReadXml(p_struct, p_db);
  return p_struct;
}

int AB_ReferenceAccount_Matches(const AB_REFERENCE_ACCOUNT *a, const char *iban, const char *bic, const char *accountNumber, const char *subAccountNumber, const char *country, const char *bankCode, const char *ownerName, const char *accountName) { const char *liban; const char *lbic; const char *laccountNumber; const char *lsubAccountNumber; const char *lcountry; const char *lbankCode; const char *lownerName; const char *laccountName; if (!iban) iban="*"; if (!bic) bic="*"; if (!accountNumber) accountNumber="*"; if (!subAccountNumber) subAccountNumber="*"; if (!country) country="*"; if (!bankCode) bankCode="*"; if (!ownerName) ownerName="*"; if (!accountName) accountName="*"; liban=AB_ReferenceAccount_GetIban(a); lbic=AB_ReferenceAccount_GetBic(a); laccountNumber=AB_ReferenceAccount_GetAccountNumber(a); lsubAccountNumber=AB_ReferenceAccount_GetSubAccountNumber(a); lcountry=AB_ReferenceAccount_GetCountry(a); lbankCode=AB_ReferenceAccount_GetBankCode(a); lownerName=AB_ReferenceAccount_GetOwnerName(a); laccountName=AB_ReferenceAccount_GetAccountName(a); if (!liban) liban=""; if (!lbic) lbic=""; if (!laccountNumber) laccountNumber=""; if (!lsubAccountNumber) lsubAccountNumber=""; if (!lcountry) lcountry=""; if (!lbankCode) lbankCode=""; if (!lownerName) lownerName=""; if (!laccountName) laccountName=""; if ((-1!=GWEN_Text_ComparePattern(liban, iban, 0)) && (-1!=GWEN_Text_ComparePattern(lbic, bic, 0)) && (-1!=GWEN_Text_ComparePattern(laccountNumber, accountNumber, 0)) && (-1!=GWEN_Text_ComparePattern(lsubAccountNumber, subAccountNumber, 0)) && (-1!=GWEN_Text_ComparePattern(lcountry, country, 0)) && (-1!=GWEN_Text_ComparePattern(lbankCode, bankCode, 0)) && (-1!=GWEN_Text_ComparePattern(lownerName, ownerName, 0)) && (-1!=GWEN_Text_ComparePattern(laccountName, accountName, 0))) return 1; return 0; }
AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_List__FindInternal(AB_REFERENCE_ACCOUNT *a, const char *iban, const char *bic, const char *accountNumber, const char *subAccountNumber, const char *country, const char *bankCode, const char *ownerName, const char *accountName) { int rv; if (!iban) iban="*"; if (!bic) bic="*"; if (!accountNumber) accountNumber="*"; if (!subAccountNumber) subAccountNumber="*"; if (!country) country="*"; if (!bankCode) bankCode="*"; if (!ownerName) ownerName="*"; if (!accountName) accountName="*"; while(a) { rv=AB_ReferenceAccount_Matches(a, iban, bic, accountNumber, subAccountNumber, country, bankCode, ownerName, accountName); if (rv==1) break; a=AB_ReferenceAccount_List_Next(a); } /* while */ return a; }
AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_List_FindFirst(const AB_REFERENCE_ACCOUNT_LIST *al, const char *iban, const char *bic, const char *accountNumber, const char *subAccountNumber, const char *country, const char *bankCode, const char *ownerName, const char *accountName) { AB_REFERENCE_ACCOUNT *a; if (AB_ReferenceAccount_List_GetCount(al)==0) { DBG_INFO(AQBANKING_LOGDOMAIN, "No reference accounts"); return NULL; } a=AB_ReferenceAccount_List_First(al); assert(a); return AB_ReferenceAccount_List__FindInternal(a, iban, bic, accountNumber, subAccountNumber, country, bankCode, ownerName, accountName); }
AB_REFERENCE_ACCOUNT *AB_ReferenceAccount_List_FindNext(AB_REFERENCE_ACCOUNT *a, const char *iban, const char *bic, const char *accountNumber, const char *subAccountNumber, const char *country, const char *bankCode, const char *ownerName, const char *accountName) { assert(a); a=AB_ReferenceAccount_List_Next(a); if (a==NULL) { DBG_INFO(AQBANKING_LOGDOMAIN, "No more reference accounts"); return NULL; } return AB_ReferenceAccount_List__FindInternal(a, iban, bic, accountNumber, subAccountNumber, country, bankCode, ownerName, accountName); }

/* code headers */

