KDECore
#include <kcurrencycode.h>
Public Types | |
enum | CurrencyStatus { ActiveCurrency = 0x01, SuspendedCurrency = 0x02, ObsoleteCurrency = 0x04 } |
Public Member Functions | |
KCurrencyCode (const QString &isoCurrencyCode, const QString &language=QString()) | |
KCurrencyCode (const QFileInfo ¤cyCodeFile, const QString &language=QString()) | |
KCurrencyCode (const KCurrencyCode &rhs) | |
virtual | ~KCurrencyCode () |
QStringList | countriesUsingCurrency () const |
QDate | dateIntroduced () const |
QDate | dateSuspended () const |
QDate | dateWithdrawn () const |
int | decimalPlaces () const |
QString | defaultSymbol () const |
bool | hasSubunits () const |
bool | hasSubunitsInCirculation () const |
QString | isoCurrencyCode () const |
QString | isoCurrencyCodeNumeric () const |
QString | isoName () const |
bool | isValid () const |
QString | name () const |
KCurrencyCode & | operator= (const KCurrencyCode &rhs) |
CurrencyStatus | status () const |
int | subunitsPerUnit () const |
QString | subunitSymbol () const |
QStringList | symbolList () const |
QString | unambiguousSymbol () const |
Static Public Member Functions | |
static QStringList | allCurrencyCodesList (CurrencyStatusFlags currencyStatus=CurrencyStatusFlags(ActiveCurrency|SuspendedCurrency|ObsoleteCurrency)) |
static QString | currencyCodeToName (const QString ¤cyCode, const QString &language=QString()) |
static bool | isValid (const QString ¤cyCode, CurrencyStatusFlags currencyStatus=CurrencyStatusFlags(ActiveCurrency|SuspendedCurrency|ObsoleteCurrency)) |
Detailed Description
- Since
- 4.4
This is a class to implement the ISO 4217 Currency Code standard
license GNU-LGPL v.2 or later
- See also
- KLocale
Definition at line 45 of file kcurrencycode.h.
Member Enumeration Documentation
The Status of the Currency.
- See also
- CurrencyStatusFlags
- currencyStatus()
Definition at line 54 of file kcurrencycode.h.
Constructor & Destructor Documentation
|
explicit |
Constructs a KCurrencyCode for a given ISO Currency Code.
If the supplied Currency Code is not known then the KCurrencyCode will return isValid() == false
- Parameters
-
isoCurrencyCode the ISO Currency Code to construct, defaults to USD language the language to use for translations, default to the Locale language
Definition at line 141 of file kcurrencycode.cpp.
|
explicit |
Constructs a KCurrencyCode for a given config file and Language.
Note that any translations must be supplied in the config file, none will be provided.
If the supplied config file is not valid then the KCurrencyCode will return isValid() == false
- Parameters
-
currencyCodeFile the ISO Currency Code to construct, defaults to USD language the language to use for translations, default to the Locale language
Definition at line 146 of file kcurrencycode.cpp.
KCurrencyCode::KCurrencyCode | ( | const KCurrencyCode & | rhs | ) |
Copy Constructor.
- Parameters
-
rhs KCurrencyCode to copy
Definition at line 151 of file kcurrencycode.cpp.
|
virtual |
Destructor.
Definition at line 163 of file kcurrencycode.cpp.
Member Function Documentation
|
static |
Provides list of all known ISO Currency Codes.
Use currencyCodeToName(currencyCode) to get human readable, localized currency names.
By default returns all Active, Suspended and Obsolete currencies, set the currencyStatus flags as appropriate to return required status currencies
- Parameters
-
currencyStatus which status currencies to return
- Returns
- a list of all ISO Currency Codes
- See also
- currencyCodeToName
Definition at line 277 of file kcurrencycode.cpp.
QStringList KCurrencyCode::countriesUsingCurrency | ( | ) | const |
Return a list of countries known to be using the currency.
- Returns
- list of ISO Country Codes using the currency
Definition at line 261 of file kcurrencycode.cpp.
|
static |
Convert a known ISO Currency Code to a human readable, localized form.
If an unknown Currency Code is supplied, empty string is returned; this will never happen if the code has been obtained by one of the KCurrencyCode methods.
- Parameters
-
currencyCode the ISO Currency Code language the language to use for translations, default to the Locale language
- Returns
- the human readable and localized form of the Currency name
- See also
- currencyCode
- allCurrencyCodesList
Definition at line 295 of file kcurrencycode.cpp.
QDate KCurrencyCode::dateIntroduced | ( | ) | const |
Return the date the currency was introduced.
- Returns
- the date the currency was introduced
- See also
- status()
- dateSuspended()
- dateWithdrawn()
Definition at line 198 of file kcurrencycode.cpp.
QDate KCurrencyCode::dateSuspended | ( | ) | const |
Return the date the currency was suspended.
- Returns
- the date the currency was suspended, QDate() if active
- See also
- status()
- dateIntroduced()
- dateWithdrawn()
Definition at line 203 of file kcurrencycode.cpp.
QDate KCurrencyCode::dateWithdrawn | ( | ) | const |
Return the date the currency was withdrawn from circulation.
- Returns
- the date the currency was withdrawn, QDate() if active
- See also
- status()
- dateIntroduced()
- dateSuspended()
Definition at line 208 of file kcurrencycode.cpp.
int KCurrencyCode::decimalPlaces | ( | ) | const |
Return the number of decimal places required to display the currency subunits.
- Returns
- number of decimal places
Definition at line 256 of file kcurrencycode.cpp.
QString KCurrencyCode::defaultSymbol | ( | ) | const |
Return the default Symbol for the Currency, e.g.
$ or £
- Returns
- the default Currency Symbol
- See also
- symbols()
- unambiguousSymbol()
Definition at line 218 of file kcurrencycode.cpp.
bool KCurrencyCode::hasSubunits | ( | ) | const |
Return if the Currency has subunits or not, e.g.
USD has cents, VUV has none
- Returns
- true if the Currency has subunits
- See also
- hasSubunitsInCirculation()
- subunitName()
- subunitSymbol()
- subunitsPerUnit()
Definition at line 232 of file kcurrencycode.cpp.
bool KCurrencyCode::hasSubunitsInCirculation | ( | ) | const |
Return if the Currency has subunits in circulation, e.g.
JPY has sen but these are no longer used due to inflation
- Returns
- true if the Currency has subunits in circulation
- See also
- hasSubunits()
Definition at line 241 of file kcurrencycode.cpp.
QString KCurrencyCode::isoCurrencyCode | ( | ) | const |
Return the ISO 4217 Currency Code in Alpha 3 format, e.g.
USD
- Returns
- the ISO Currency Code
- See also
- isoCurrencyCodeNumeric()
Definition at line 167 of file kcurrencycode.cpp.
QString KCurrencyCode::isoCurrencyCodeNumeric | ( | ) | const |
Return the ISO 4217 Currency Code in Numeric 3 format, e.g.
840
- Returns
- the ISO Currency Code
- See also
- isoCurrencyCode()
Definition at line 172 of file kcurrencycode.cpp.
QString KCurrencyCode::isoName | ( | ) | const |
Return untranslated official ISO Currency Code Name.
This name is not translated and should only be used where appropriate. For displaying the name to a user, use name() instead.
- Returns
- the official ISO Currency Code Name
- See also
- name()
Definition at line 182 of file kcurrencycode.cpp.
bool KCurrencyCode::isValid | ( | ) | const |
Return if the currency object loaded/initialised correctly.
- Returns
- true if valid KCurrencyCode object
Definition at line 266 of file kcurrencycode.cpp.
|
static |
Return if a given Currency Code is supported in KDE.
Optionally validate if an Active, Suspended, or Obsolete currency, default is if any.
- Parameters
-
currencyCode the Currency Code to validate currencyStatus the CurrencyStatus to validate
- Returns
- true if valid currency code
Definition at line 271 of file kcurrencycode.cpp.
QString KCurrencyCode::name | ( | ) | const |
Return translated Currency Code Name in a standard display format e.g.
United States Dollar
- Returns
- the display Currency Code Name
- See also
- isoName()
Definition at line 177 of file kcurrencycode.cpp.
KCurrencyCode & KCurrencyCode::operator= | ( | const KCurrencyCode & | rhs | ) |
Assignment operator.
- Parameters
-
rhs KCurrencyCode to assign
Definition at line 156 of file kcurrencycode.cpp.
KCurrencyCode::CurrencyStatus KCurrencyCode::status | ( | ) | const |
Return Currency Status for the currency, if Active, Suspended or Obsolete.
- Returns
- the Currency Status
- See also
- CurrencyStatus
Definition at line 187 of file kcurrencycode.cpp.
int KCurrencyCode::subunitsPerUnit | ( | ) | const |
Return the number of subunits in every unit, e.g.
100 cents in the dollar
- Returns
- number of subunits per unit, 0 if no subunits
- See also
- hasSubunits()
Definition at line 251 of file kcurrencycode.cpp.
QString KCurrencyCode::subunitSymbol | ( | ) | const |
Return the Currency subunit symbol if it has one e.g.
¢ for USD cent
- Returns
- the currency subunit symbol
- See also
- hasSubunits()
Definition at line 246 of file kcurrencycode.cpp.
QStringList KCurrencyCode::symbolList | ( | ) | const |
Return a list of valid Symbols for the Currency in order of preference.
This list will normally contain the Default and Unambiguous symbols and the ISO Currency Code
- Returns
- list of Currency Symbols
- See also
- defaultSymbol()
- unambiguousSymbol()
Definition at line 213 of file kcurrencycode.cpp.
QString KCurrencyCode::unambiguousSymbol | ( | ) | const |
Return the unambiguous Symbol for the Currency, e.g.
US$ or NZ$
- Returns
- the unambiguous Currency Symbol
- See also
- symbols()
- defaultSymbol()
Definition at line 223 of file kcurrencycode.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.