#include <iban.h>
Public Types | |
| enum | Result { OK = 0, TOO_SHORT, PREFIX_NOT_FOUND, WRONG_LENGTH, COUNTRY_NOT_FOUND, WRONG_COUNTRY, BAD_CHECKSUM } |
Public Member Functions | |
| IbanCheck (const std::string &filename="") | |
| ~IbanCheck () | |
| Result | check (const Iban &iban, const std::string &country="") const |
| Result | check (const std::string &iban, const std::string &country="") const |
| Result | bic_position (const std::string &iban, int &start, int &end) const |
| bool | error () const |
| bool | selftest () |
Static Public Member Functions | |
| static const char * | resultText (Result res) |
Friends | |
| std::istream & | operator>> (std::istream &is, Spec &spec) |
| std::istream & | operator>> (std::istream &is, Country &c) |
Classes | |
| struct | Country |
| struct | Spec |
Stores a mapping of IBAN-prefixes to required length of the IBAN and BIC (Bank Identification Code) position inside the IBAN, and a second mapping of the ISO 3166 2-character country code to the list of prefixes for that country (usually one, identically to the country code).
The mappings are read from a file when an instance of the class is created.
|
|
Code returned by check() (and also by bic_position()).
|
|
|
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.
|
|
|
Default destructor |
|
||||||||||||||||
|
Returns the position of the BIC inside the IBAN. The iban should be formally correct, if not an error Result might be returned.
|
|
||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
||||||||||||
|
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).
|
|
|
|
|
|
Convert Result code into an english message string.
|
|
|
uses the example data to test the check routines.
|
|
||||||||||||
|
|
|
||||||||||||
|
|
1.4.1