ktoblzcheck 1.59.0
iban.h File Reference

Checking of International Bank Account Numbers (IBAN). More...

#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <ctype.h>

Go to the source code of this file.

Classes

class  Iban
 Stores one IBAN (International Bank Account Number). More...
class  IbanCheck
 IBAN bank information database and IBAN verification. More...

Typedefs

typedef IbanCheck::Result IbanCheck_Result

Functions

IbanCheck methods
IbanCheckIbanCheck_new (const char *filename)
void IbanCheck_free (IbanCheck *p)
IbanCheck_Result IbanCheck_check_str (const IbanCheck *p, const char *iban, const char *country)
IbanCheck_Result IbanCheck_check_iban (const IbanCheck *p, const Iban *iban, const char *country)
IbanCheck_Result IbanCheck_bic_position (const IbanCheck *p, const char *iban, int *start, int *end)
const char * IbanCheck_resultText (IbanCheck_Result res)
int IbanCheck_error (const IbanCheck *p)
int IbanCheck_selftest (IbanCheck *p)
Iban methods
IbanIban_new (const char *iban, int normalize)
void Iban_free (Iban *p)
const char * Iban_transmissionForm (const Iban *iban)
const char * Iban_printableForm (Iban *iban)

Detailed Description

Checking of International Bank Account Numbers (IBAN).

-*-c++-*-****************************************************************

cvs : $Id$ begin : Tue Apr 19 2005 copyright : (C) 2005 by Andreas Degert (some parts Gerhard Gappmeier) email : ad@pa.nosp@m.pyru.nosp@m.s-gmb.nosp@m.h.de

based on the older version from Gerhard Gappmeier (gerha.nosp@m.rd.g.nosp@m.appme.nosp@m.ier@.nosp@m.ascol.nosp@m.ab.c.nosp@m.om)

                                                                    *

This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. *

  • This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. *
  • You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA *

This file contains the classes and C wrappers for IBAN checking.

Typedef Documentation

◆ IbanCheck_Result

Function Documentation

◆ Iban_free()

void Iban_free ( Iban * p)

Default destructor.

References Iban_free().

Referenced by Iban_free().

◆ Iban_new()

Iban * Iban_new ( const char * iban,
int normalize )

Constructor from a string

References Iban_new().

Referenced by Iban_new().

◆ Iban_printableForm()

const char * Iban_printableForm ( Iban * iban)

Returns the printable format for the IBAN

References Iban_printableForm().

Referenced by Iban_printableForm().

◆ Iban_transmissionForm()

const char * Iban_transmissionForm ( const Iban * iban)

Returns the transmission format for the IBAN

References Iban_transmissionForm().

Referenced by Iban_transmissionForm().

◆ IbanCheck_bic_position()

IbanCheck_Result IbanCheck_bic_position ( const IbanCheck * p,
const char * iban,
int * start,
int * end )

Returns the position of the BIC inside the IBAN. The iban should be formally correct, if not an error Result might be returned.

Parameters
pIbanCheck object
iban[in] IBAN in transmission format
start[out] start of BIC (0-based index)
end[out] first position after BIC (0-based index)

References IbanCheck_bic_position().

Referenced by IbanCheck_bic_position().

◆ IbanCheck_check_iban()

IbanCheck_Result IbanCheck_check_iban ( const IbanCheck * p,
const Iban * iban,
const char * country )

Check the formal correctness of a given iban. This function checks if the prefix is known, if the length is correct for the prefix, if the checksum is ok and if the prefix is valid for a given country (if set).

Parameters
pIbanCheck object
ibanIban instance
country2-character country code (ISO 3166)

References IbanCheck_check_iban().

Referenced by IbanCheck_check_iban().

◆ IbanCheck_check_str()

IbanCheck_Result IbanCheck_check_str ( const IbanCheck * p,
const char * iban,
const char * country )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
pIbanCheck object
ibanIBAN in transmission format
country2-character country code (ISO 3166)

References IbanCheck_check_str().

Referenced by IbanCheck_check_str().

◆ IbanCheck_error()

int IbanCheck_error ( const IbanCheck * p)
Returns
false if the data file could not be opened and successfully read.

References IbanCheck_error().

Referenced by IbanCheck_error().

◆ IbanCheck_free()

void IbanCheck_free ( IbanCheck * p)

Default destructor

References IbanCheck_free().

Referenced by IbanCheck_free().

◆ IbanCheck_new()

IbanCheck * IbanCheck_new ( const char * filename)

Constructor that initalizes the mappings from a data file at filename.

If the file name argument is empty, then the compile-time datafile will be used. On Windows, the location of the datafile will be looked up in the registry.

If the file could not be found or is not successfully read, the mappings will be empty. Use error() to check for such an error condition.

Parameters
filenameIf empty, then the compile-time file name will be used. Otherwise the relative or absolute full filename of the data file

References IbanCheck_new().

Referenced by IbanCheck_new().

◆ IbanCheck_resultText()

const char * IbanCheck_resultText ( IbanCheck_Result res)

Convert Result code into an english message string.

Note
if the value of res is an integer not inside the enum range, a special message will be returned.
Parameters
resResult code from check() or bic_position()

References IbanCheck_resultText().

Referenced by IbanCheck_resultText().

◆ IbanCheck_selftest()

int IbanCheck_selftest ( IbanCheck * p)

uses the example data to test the check routines.

Returns
false if not successful

References IbanCheck_selftest().

Referenced by IbanCheck_selftest().