Main Page | Class List | Directories | File List | Class Members | File Members

AccountNumberCheck Class Reference

German bank information database and account code verification. More...

#include <ktoblzcheck.h>

List of all members.

Public Types

typedef enum AccountNumberCheck::Result Result
enum  Result { OK = 0, UNKNOWN = 1, ERROR = 2, BANK_NOT_KNOWN = 3 }

Public Member Functions

 AccountNumberCheck ()
 AccountNumberCheck (const std::string &filename)
 ~AccountNumberCheck ()
Result check (const std::string &bankId, const std::string &accountId, const std::string &method="") const
const RecordfindBank (const std::string &bankId) const
unsigned int bankCount () const
void createIndex ()

Static Public Member Functions

static std::string resultToString (Result r)
Ktoblzcheck library information
static const char * stringEncoding ()
static const char * libraryVersion ()

Classes

class  Record
 Available information about one bank. More...


Detailed Description

German bank information database and account code verification.

Class that stores a list of known German banks, returns banks with given bank codes, and validates account numbers accordings to the bank's known validation/checking algorithms.

The list of known banks is read from the configuration file when this object is constructed.


Member Typedef Documentation

typedef enum AccountNumberCheck::Result Result
 

Gives information about the success of the check

  • OK: everything is ok, account and bank match

  • UNKNOWN: Could not be validated because the validation algorithm is unknown/unimplemented in ktoblzcheck

  • ERROR: The result of the validation algorithm is that the account and bank probably do not match

  • BANK_NOT_KNOWN: No bank with the specified bankid could be found


Member Enumeration Documentation

enum Result
 

Gives information about the success of the check

  • OK: everything is ok, account and bank match

  • UNKNOWN: Could not be validated because the validation algorithm is unknown/unimplemented in ktoblzcheck

  • ERROR: The result of the validation algorithm is that the account and bank probably do not match

  • BANK_NOT_KNOWN: No bank with the specified bankid could be found

Enumeration values:
OK  Everything is ok: account and bank match
UNKNOWN  Could not be validated because the validation algorithm is unknown/unimplemented in ktoblzcheck
ERROR  The result of the validation algorithm is that the account and bank probably do not match
BANK_NOT_KNOWN  No bank with the specified bankid could be found


Constructor & Destructor Documentation

AccountNumberCheck  ) 
 

Default Constructor.

This constructor also initializes the bank-database. The bank data is obtained from the location specified at compiler time. Default is $prefix/share/ktoblzcheck/bankdata.txt (set in configure.in) where default for $prefix is /usr/local.

On Windows, this constructor also looks up the location of the bank data in the registry in the key HKEY_LOCAL_MACHINE/Software/Ktoblzcheck/Paths, key "datadir".

AccountNumberCheck const std::string &  filename  ) 
 

Constructor that initialize the bank-database from a data file at filename.

If the file could not be found, then the resulting AccountNumberCheck object simply has an empty bank database and a message is printed to stderr.

Parameters:
filename The absolute location of the KTOBLZCheck-database

~AccountNumberCheck  ) 
 

Destructor. All entries of the bank database are deleted as well.

Note:
This destructor also destroys any references that have been returned by findBank()! You have to make sure not to use these references any longer after this destructor has been called.


Member Function Documentation

unsigned int bankCount  )  const
 

Returns the number of bank-records currently loaded

Result check const std::string &  bankId,
const std::string &  accountId,
const std::string &  method = ""
const
 

Check if bankId and accountId form a valid combination.

Parameters:
bankId The bank code (BLZ) of the bank to test
accountId The account id to check
method If set, force the use of specified check-method

void createIndex  ) 
 

Generates an index over the bankIds. This is supposed to speed up the checking if you want to check 100s of combination (batch-processing)

Currently this does nothing. The bank list structure (std::map) does not need this anyway.

const Record& findBank const std::string &  bankId  )  const
 

Find the info-record for a bank specified by bankId or otherwise throw an exception.

Note:
The returned objects are still owned by this object! You have to make sure not to use the returned references after the destructor ~AccountNumberCheck() has been called.
Exceptions:
int if a bank with bank code bankId (german BLZ) could not be found in the database
Returns:
A reference to the resulting bank object. The returned reference is still owned by this AccountNumberObject and it becomes invalid if the AcccountNumberObject is being deleted.

static const char* libraryVersion  )  [static]
 

Returns the value of ktoblzcheck's configuration variable VERSION, which can be "1.6" or something similar.

This function was introduced in ktoblzcheck-1.7.

static std::string resultToString Result  r  )  [static]
 

Returns a meaningful english string explaining the result value

static const char* stringEncoding  )  [static]
 

Returns the character encoding that is used when strings are returned. So far this has been "ISO-8859-15" (up to and including version ktoblzcheck-1.11) but at some point in the future it might change into "UTF-8".

To obtain the encoding string in your application in a form that is backward-compatible to all ktoblzcheck-versions, do the following:

    const char *ktoblzcheck_encoding = 
#ifdef KTOBLZCHECK_VERSION_MAJOR
      AccountNumberCheck_stringEncoding()
#else
      "ISO-8859-15"
#endif
      ;

This function was introduced in ktoblzcheck-1.7.


The documentation for this class was generated from the following file:
Generated on Thu Nov 23 13:33:27 2006 for ktoblzcheck by  doxygen 1.4.1