Separatista
iban.h
1 /***************************************************************************
2  * Copyright (C) 2013 by Okkel Klaver *
3  * info@vanhetland.nl *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
21 #ifndef SEPARATISTA_IBAN_H
22 #define SEPARATISTA_IBAN_H
23 
24 #include <string>
25 
26 // Disable Visual c++ warning C4251
27 #ifdef _MSC_VER
28 #pragma warning(disable: 4251)
29 #endif
30 
31 #ifdef SEPARATISTA_IBAN_BUILDINGDLL
32 # define IBAN_EXTERN __declspec(dllexport)
33 #elif defined SEPARATISTA_IBAN_USINGDLL
34 # define IBAN_EXTERN __declspec(dllimport)
35 #else
36 # define IBAN_EXTERN
37 #endif
38 
40 #define SEPARATISTA_IBAN_MAX_ACCOUNT 30
41 
42 namespace Separatista
43 {
44 
45 typedef wchar_t IBANCC[2];
46 
47 class IBAN_EXTERN IBAN
48 {
49 public:
53  IBAN();
54 
58  IBAN& operator = (const char *iban);
59 
63  IBAN& operator = (const wchar_t *pIBAN);
64 
68  void set(const char *iban);
69 
73  void set(const wchar_t *pIBAN);
74 
80  const char* getIBAN();
81 
85  operator const char* ();
86 
90  const IBANCC& getCountryCode() const;
91 
95  const IBANCC& getControlSum() const;
96 
100  bool Check() const;
101 
105  void Clear();
106 
107 protected:
112  void format(bool seperator = true);
113 
118  void mbformat(bool separator = true);
119 
120 private:
121  IBANCC m_countryCode;
122  IBANCC m_controlSum;
123  wchar_t m_accountNumber[SEPARATISTA_IBAN_MAX_ACCOUNT];
124  size_t m_accountNumberLength;
125 
126  std::string m_mbformatted;
127  std::wstring m_formatted;
128 };
129 
130 }
131 
132 #endif // !defined SAPARATISTA_IBAN_H
Definition: iban.h:47
Definition: mt940s.h:39