isomon::currency — ISO 4217 currency.


// In header: </home/castedo/src/isomon/currency.hpp>

class currency {
  // construct/copy/destruct
  currency(std::string const &);
  currency(char const *);

  // public member functions
  bool is_currency() const;
  bool is_no_currency() const;
  std::string str() const;
  char const * c_str() const;
  int16_t isonum() const;
  int32_t num_digits() const;
  int32_t num_minors() const;
  bool operator==(currency) const;
  bool operator!=(currency) const;
  bool operator<(currency) const;
  bool operator<=(currency) const;
  bool operator>(currency) const;
  bool operator>=(currency) const;

  // friend functions
  friend std::istream & operator>>(std::istream &, currency &);


currency public construct/copy/destruct

  1. currency();
    Contruct ISO "no currency" code "XXX" (999)
  2. currency(std::string const & code);
    Construct from 3 letter ISO character code.
  3. currency(char const * code);
    Construct from 3 letter ISO character code.
  4. currency(int16_t i);
    Construct from int if ISO numeric code, otherwise default value.

currency public member functions

  1. bool is_currency() const;
    True if this is not special ISO "no currency" value "XXX" (999)
  2. bool is_no_currency() const;
    True if this is special ISO "no currency" value "XXX" (999)
  3. std::string str() const;
    return ISO 3-character code
  4. char const * c_str() const;
    return ISO 3-character code as null-terminated C string
  5. int16_t isonum() const;
    return ISO numeric code
  6. int32_t num_digits() const;

    return number of decimal digits for minor units, or return 0 if not applicable or unknown

  7. int32_t num_minors() const;

    return number of minor units per major unit, or return 0 if not applicable or unknown

  8. bool operator==(currency rhs) const;
  9. bool operator!=(currency rhs) const;
  10. bool operator<(currency rhs) const;
    Ordering is the same as the ordering of ISO alphabetic code.
  11. bool operator<=(currency rhs) const;
  12. bool operator>(currency rhs) const;
  13. bool operator>=(currency rhs) const;

currency friend functions

  1. friend std::istream & operator>>(std::istream & is, currency & rhs);
    Read ISO alphabetic code (3 Latin letters)