• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

Public Types | Public Member Functions | Static Public Member Functions | List of all members
KCurrencyCode Class Reference

#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 &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
 
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 &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 john@.nosp@m.layt.nosp@m..net

Definition at line 45 of file kcurrencycode.h.

Member Enumeration Documentation

enum KCurrencyCode::CurrencyStatus

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 54 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 141 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 146 of file kcurrencycode.cpp.

KCurrencyCode::KCurrencyCode ( const KCurrencyCode &  rhs)

Copy Constructor.

Parameters
rhsKCurrencyCode to copy

Definition at line 151 of file kcurrencycode.cpp.

KCurrencyCode::~KCurrencyCode ( )
virtual

Destructor.

Definition at line 163 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 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.

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 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.

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 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
rhsKCurrencyCode 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:
  • kcurrencycode.h
  • kcurrencycode.cpp
This file is part of the KDE documentation.
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.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal