ktoblzcheck
1.52.0
|
IBAN bank information database and IBAN verification. More...
#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) |
IBAN bank information database and IBAN verification.
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.
enum Result |
Code returned by check() (and also by bic_position()).
IbanCheck | ( | const std::string & | 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.
filename | If empty, then the compile-time file name will be used. Otherwise the relative or absolute full filename of the data file |
~IbanCheck | ( | ) |
Default destructor
Result bic_position | ( | const std::string & | iban, |
int & | start, | ||
int & | end | ||
) | const |
Returns the position of the BIC inside the IBAN. The iban should be formally correct, if not an error Result might be returned.
iban | [in] IBAN in transmission format |
start | [out] start of BIC (0-based index) |
end | [out] first position after BIC (0-based index) |
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).
iban | Iban instance |
country | 2-character country code (ISO 3166) |
References Iban::transmissionForm().
Result check | ( | const std::string & | iban, |
const std::string & | country = "" |
||
) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
iban | IBAN in transmission format |
country | 2-character country code (ISO 3166) |
|
inline |
|
static |
Convert Result code into an english message string.
res | Result code from check() or bic_position() |
bool selftest | ( | ) |
uses the example data to test the check routines.
|
friend |
|
friend |