KCurrencyCode

Search for usage in LXR

#include <kcurrencycode.h>

Public Types

enum  CurrencyStatus { ActiveCurrency = 0x01, SuspendedCurrency = 0x02, ObsoleteCurrency = 0x04 }
 
typedef QFlags< CurrencyStatusCurrencyStatusFlags
 

Public Member Functions

 KCurrencyCode (const QString &isoCurrencyCode, const QString &language=QString())
 
 KCurrencyCode (const QFileInfo &currencyCodeFile, 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
 
KCurrencyCodeoperator= (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 &currencyCode, const QString &language=QString())
 
static bool isValid (const QString &currencyCode, 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
Author
John Layt [email protected][email protected]layt[email protected].net
Deprecated:
since 5.0, a replacement will be provided by the KStandards framework (not available in KDE Frameworks 5.0)

Definition at line 48 of file kcurrencycode.h.

Member Enumeration Documentation

The Status of the Currency.

See also
CurrencyStatusFlags
currencyStatus()
Enumerator
ActiveCurrency 

Currency is currently in use.

SuspendedCurrency 

Currency is not currently in use but has not been replaced.

ObsoleteCurrency 

Currency is no longer in use and has been replaced.

Definition at line 57 of file kcurrencycode.h.

Constructor & Destructor Documentation

KCurrencyCode::KCurrencyCode ( const QString isoCurrencyCode,
const QString language = QString() 
)
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
isoCurrencyCodethe ISO Currency Code to construct, defaults to USD
languagethe language to use for translations, default to the Locale language

Definition at line 139 of file kcurrencycode.cpp.

KCurrencyCode::KCurrencyCode ( const QFileInfo currencyCodeFile,
const QString language = QString() 
)
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
currencyCodeFilethe ISO Currency Code to construct, defaults to USD
languagethe language to use for translations, default to the Locale language

Definition at line 144 of file kcurrencycode.cpp.

KCurrencyCode::KCurrencyCode ( const KCurrencyCode rhs)

Copy Constructor.

Parameters
rhsKCurrencyCode to copy

Definition at line 149 of file kcurrencycode.cpp.

KCurrencyCode::~KCurrencyCode ( )
virtual

Destructor.

Definition at line 162 of file kcurrencycode.cpp.

Member Function Documentation

QStringList KCurrencyCode::allCurrencyCodesList ( CurrencyStatusFlags  currencyStatus = CurrencyStatusFlags(ActiveCurrency |                                SuspendedCurrency |                                ObsoleteCurrency))
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
currencyStatuswhich status currencies to return
Returns
a list of all ISO Currency Codes
See also
currencyCodeToName

Definition at line 276 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 260 of file kcurrencycode.cpp.

QString KCurrencyCode::currencyCodeToName ( const QString currencyCode,
const QString language = QString() 
)
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
currencyCodethe ISO Currency Code
languagethe 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 293 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 197 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 202 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 207 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 255 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 217 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 231 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 240 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 166 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 171 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 181 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 265 of file kcurrencycode.cpp.

bool KCurrencyCode::isValid ( const QString currencyCode,
CurrencyStatusFlags  currencyStatus = CurrencyStatusFlags(ActiveCurrency |                                    SuspendedCurrency |                                    ObsoleteCurrency) 
)
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
currencyCodethe Currency Code to validate
currencyStatusthe CurrencyStatus to validate
Returns
true if valid currency code

Definition at line 270 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 176 of file kcurrencycode.cpp.

KCurrencyCode & KCurrencyCode::operator= ( const KCurrencyCode rhs)

Assignment operator.

Parameters
rhsKCurrencyCode to assign

Definition at line 154 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 186 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 250 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 245 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 212 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 222 of file kcurrencycode.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Jul 29 2021 22:58:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.