KCurrencyCode Class Reference
from PyKDE4.kdecore import *
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
Enumerations | |
CurrencyStatus | { ActiveCurrency, SuspendedCurrency, ObsoleteCurrency } |
Methods | |
__init__ (self, QString isoCurrencyCode, QString language=QString()) | |
__init__ (self, QFileInfo currencyCodeFile, QString language=QString()) | |
__init__ (self, KCurrencyCode rhs) | |
QStringList | countriesUsingCurrency (self) |
QDate | dateIntroduced (self) |
QDate | dateSuspended (self) |
QDate | dateWithdrawn (self) |
int | decimalPlaces (self) |
QString | defaultSymbol (self) |
bool | hasSubunits (self) |
bool | hasSubunitsInCirculation (self) |
bool | isValid (self) |
QString | isoCurrencyCode (self) |
QString | isoCurrencyCodeNumeric (self) |
QString | isoName (self) |
QString | name (self) |
KCurrencyCode.CurrencyStatus | status (self) |
QString | subunitSymbol (self) |
int | subunitsPerUnit (self) |
QStringList | symbolList (self) |
QString | unambiguousSymbol (self) |
Static Methods | |
QStringList | allCurrencyCodesList (KCurrencyCode.CurrencyStatusFlags currencyStatus) |
QString | currencyCodeToName (QString currencyCode, QString language=QString()) |
bool | isValid (QString currencyCode, KCurrencyCode.CurrencyStatusFlags currencyStatus) |
Method Documentation
__init__ | ( | self, | ||
QString | isoCurrencyCode, | |||
QString | language=QString() | |||
) |
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
__init__ | ( | self, | ||
QFileInfo | currencyCodeFile, | |||
QString | language=QString() | |||
) |
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
__init__ | ( | self, | ||
KCurrencyCode | rhs | |||
) |
Copy Constructor
- Parameters:
-
rhs KCurrencyCode to copy
QStringList countriesUsingCurrency | ( | self ) |
Return a list of countries known to be using the currency
- Returns:
- list of ISO Country Codes using the currency
QDate dateIntroduced | ( | self ) |
Return the date the currency was introduced
- Returns:
- the date the currency was introduced
- See also:
- status()
- See also:
- dateSuspended()
- See also:
- dateWithdrawn()
QDate dateSuspended | ( | self ) |
Return the date the currency was suspended
- Returns:
- the date the currency was suspended, QDate() if active
- See also:
- status()
- See also:
- dateIntroduced()
- See also:
- dateWithdrawn()
QDate dateWithdrawn | ( | self ) |
Return the date the currency was withdrawn from circulation
- Returns:
- the date the currency was withdrawn, QDate() if active
- See also:
- status()
- See also:
- dateIntroduced()
- See also:
- dateSuspended()
int decimalPlaces | ( | self ) |
Return the number of decimal places required to display the currency subunits
- Returns:
- number of decimal places
QString defaultSymbol | ( | self ) |
Return the default Symbol for the Currency, e.g. $ or £
- Returns:
- the default Currency Symbol
- See also:
- symbols()
- See also:
- unambiguousSymbol()
bool hasSubunits | ( | self ) |
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()
- See also:
- subunitName()
- See also:
- subunitSymbol()
- See also:
- subunitsPerUnit()
bool hasSubunitsInCirculation | ( | self ) |
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()
bool isValid | ( | self ) |
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
QString isoCurrencyCode | ( | self ) |
Return the ISO 4217 Currency Code in Alpha 3 format, e.g. USD
- Returns:
- the ISO Currency Code
- See also:
- isoCurrencyCodeNumeric()
QString isoCurrencyCodeNumeric | ( | self ) |
Return the ISO 4217 Currency Code in Numeric 3 format, e.g. 840
- Returns:
- the ISO Currency Code
- See also:
- isoCurrencyCode()
QString isoName | ( | self ) |
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()
QString name | ( | self ) |
Return translated Currency Code Name in a standard display format e.g. United States Dollar
- Returns:
- the display Currency Code Name
- See also:
- isoName()
KCurrencyCode.CurrencyStatus status | ( | self ) |
Return Currency Status for the currency, if Active, Suspended or Obsolete
- Returns:
- the Currency Status
- See also:
- CurrencyStatus
QString subunitSymbol | ( | self ) |
Return the Currency subunit symbol if it has one e.g. ¢ for USD cent
- Returns:
- the currency subunit symbol
- See also:
- hasSubunits()
int subunitsPerUnit | ( | self ) |
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()
QStringList symbolList | ( | self ) |
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()
- See also:
- unambiguousSymbol()
QString unambiguousSymbol | ( | self ) |
Return the unambiguous Symbol for the Currency, e.g. US$ or NZ$
- Returns:
- the unambiguous Currency Symbol
- See also:
- symbols()
- See also:
- defaultSymbol()
Static Method Documentation
QStringList allCurrencyCodesList | ( | KCurrencyCode.CurrencyStatusFlags | currencyStatus | |
) |
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
QString currencyCodeToName | ( | QString | currencyCode, | |
QString | language=QString() | |||
) |
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
- See also:
- allCurrencyCodesList
bool isValid | ( | QString | currencyCode, | |
KCurrencyCode.CurrencyStatusFlags | currencyStatus | |||
) |
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
Enumeration Documentation
CurrencyStatus |
The Status of the Currency
- See also:
- CurrencyStatusFlags
- See also:
- currencyStatus()
- Enumerator:
-
ActiveCurrency = 0x01 SuspendedCurrency = 0x02 ObsoleteCurrency = 0x04