github.com/castedo/isomon |
Features
The easiest way to use the isomon::currency
class is to copy this
single unified header:
isomon_currency.hpp.
If you want to edit the files or build unit or performance tests, you should make a clone of the git source code repository
Table 1. Example Values of isomon::currency
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Although most currencies have a number of minor units, some do not
and thus return 0
from method num_minors()
. Notably this is the case
for the special “currency” XXX which stands for “no currency”.
The ISO 4217 standard specifies that “Nil” is the “numeric” code of XFU, a
settlement currency of the International Union of Railways. The isomon library
maps this to the integer 0
.
For C99 programmers or C++ programmers who want to implement their own currency
class, the low-level C function interface provide access to all the ISO 4217
data and almost all the functionality of the isomon::currency
class (which is
a thin type-safe wrapper around these C functions).
Currency low-level C functions.
namespace isomon { typedef int16_t isonum_t; const size_t isonum_count; // Number of possible ISO numeric code values this library will handle. namespace data { bool code2hash(const char *, int16_t *); void hash2code(int16_t, char *); bool hash2isonum(int16_t, isonum_t *); int16_t isonum2hash(isonum_t); bool code2isonum(const char *, isonum_t *); const char * isonum2code(isonum_t); bool is_isonum(int16_t); int8_t num_minor_digits(isonum_t); int16_t num_minors(isonum_t); bool add_currency(int16_t, const char *); bool set_num_minors(int16_t, int16_t, int8_t); } }