/usr/include/kcurrencycode.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | /*
Copyright (c) 2009 John Layt <john@layt.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KCURRENCYCODE_H
#define KCURRENCYCODE_H
#include <kdecore_export.h>
#include <QtCore/QSharedDataPointer>
#include <QtCore/QString>
class QDate;
class QStringList;
class QFileInfo;
class KCurrencyCodePrivate;
/**
* @since 4.4
*
* This is a class to implement the ISO 4217 Currency Code standard
*
* @b license GNU-LGPL v.2 or later
*
* @see KLocale
*
* @author John Layt <john@layt.net>
*/
class KDECORE_EXPORT KCurrencyCode
{
public:
/**
* The Status of the Currency
*
* @see CurrencyStatusFlags
* @see currencyStatus()
*/
enum CurrencyStatus {
ActiveCurrency = 0x01, /**< Currency is currently in use */
SuspendedCurrency = 0x02, /**< Currency is not currently in use but has not been replaced */
ObsoleteCurrency = 0x04 /**< Currency is no longer in use and has been replaced */
};
Q_DECLARE_FLAGS( CurrencyStatusFlags, CurrencyStatus )
/**
* Constructs a KCurrencyCode for a given ISO Currency Code.
*
* If the supplied Currency Code is not known then the KCurrencyCode will return isValid() == false
*
* @param isoCurrencyCode the ISO Currency Code to construct, defaults to USD
* @param language the language to use for translations, default to the Locale language
*
*/
explicit KCurrencyCode( const QString &isoCurrencyCode, const 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
*
* @param currencyCodeFile the ISO Currency Code to construct, defaults to USD
* @param language the language to use for translations, default to the Locale language
*
*/
explicit KCurrencyCode( const QFileInfo ¤cyCodeFile, const QString &language = QString() );
/**
* Copy Constructor
*
* @param rhs KCurrencyCode to copy
*
*/
KCurrencyCode( const KCurrencyCode &rhs );
/**
* Destructor.
*/
virtual ~KCurrencyCode();
/**
* Assignment operator
*
* @param rhs KCurrencyCode to assign
*
*/
KCurrencyCode& operator=( const KCurrencyCode &rhs );
/**
* Return the ISO 4217 Currency Code in Alpha 3 format, e.g. USD
*
* @return the ISO Currency Code
*
* @see isoCurrencyCodeNumeric()
*/
QString isoCurrencyCode() const;
/**
* Return the ISO 4217 Currency Code in Numeric 3 format, e.g. 840
*
* @return the ISO Currency Code
*
* @see isoCurrencyCode()
*/
QString isoCurrencyCodeNumeric() const;
/**
* Return translated Currency Code Name in a standard display format
* e.g. United States Dollar
*
* @return the display Currency Code Name
*
* @see isoName()
*/
QString name() 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.
*
* @return the official ISO Currency Code Name
*
* @see name()
*/
QString isoName() const;
/**
* Return Currency Status for the currency, if Active, Suspended or Obsolete
*
* @return the Currency Status
*
* @see CurrencyStatus
*/
CurrencyStatus status() const;
/**
* Return the date the currency was introduced
*
* @return the date the currency was introduced
*
* @see status()
* @see dateSuspended()
* @see dateWithdrawn()
*/
QDate dateIntroduced() const;
/**
* Return the date the currency was suspended
*
* @return the date the currency was suspended, QDate() if active
*
* @see status()
* @see dateIntroduced()
* @see dateWithdrawn()
*/
QDate dateSuspended() const;
/**
* Return the date the currency was withdrawn from circulation
*
* @return the date the currency was withdrawn, QDate() if active
*
* @see status()
* @see dateIntroduced()
* @see dateSuspended()
*/
QDate dateWithdrawn() 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
*
* @return list of Currency Symbols
*
* @see defaultSymbol()
* @see unambiguousSymbol()
*/
QStringList symbolList() const;
/**
* Return the default Symbol for the Currency, e.g. $ or £
*
* @return the default Currency Symbol
*
* @see symbols()
* @see unambiguousSymbol()
*/
QString defaultSymbol() const;
/**
* Return the unambiguous Symbol for the Currency, e.g. US$ or NZ$
*
* @return the unambiguous Currency Symbol
*
* @see symbols()
* @see defaultSymbol()
*/
QString unambiguousSymbol() const;
/**
* Return if the Currency has subunits or not,
* e.g. USD has cents, VUV has none
*
* @return true if the Currency has subunits
*
* @see hasSubunitsInCirculation()
* @see subunitName()
* @see subunitSymbol()
* @see subunitsPerUnit()
*/
bool hasSubunits() const;
/**
* Return if the Currency has subunits in circulation,
* e.g. JPY has sen but these are no longer used due to inflation
*
* @return true if the Currency has subunits in circulation
*
* @see hasSubunits()
*/
bool hasSubunitsInCirculation() const;
/**
* Return the Currency subunit symbol if it has one
* e.g. ¢ for USD cent
*
* @return the currency subunit symbol
*
* @see hasSubunits()
*/
QString subunitSymbol() const;
/**
* Return the number of subunits in every unit, e.g. 100 cents in the dollar
*
* @return number of subunits per unit, 0 if no subunits
*
* @see hasSubunits()
*/
int subunitsPerUnit() const;
/**
* Return the number of decimal places required to display the currency subunits
*
* @return number of decimal places
*/
int decimalPlaces() const;
/**
* Return a list of countries known to be using the currency
*
* @return list of ISO Country Codes using the currency
*/
QStringList countriesUsingCurrency() const;
/**
* Return if the currency object loaded/initialised correctly
*
* @return true if valid KCurrencyCode object
*/
bool isValid() const;
/**
* Return if a given Currency Code is supported in KDE.
* Optionally validate if an Active, Suspended, or Obsolete currency, default is if any.
*
* @param currencyCode the Currency Code to validate
* @param currencyStatus the CurrencyStatus to validate
*
* @return true if valid currency code
*/
static bool isValid( const QString ¤cyCode, CurrencyStatusFlags currencyStatus =
CurrencyStatusFlags( ActiveCurrency |
SuspendedCurrency |
ObsoleteCurrency ) );
/**
* 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
*
* @param currencyStatus which status currencies to return
*
* @return a list of all ISO Currency Codes
*
* @see currencyCodeToName
*/
static QStringList allCurrencyCodesList( CurrencyStatusFlags currencyStatus =
CurrencyStatusFlags( ActiveCurrency |
SuspendedCurrency |
ObsoleteCurrency ) );
/**
* 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.
*
* @param currencyCode the ISO Currency Code
* @param language the language to use for translations, default to the Locale language
*
* @return the human readable and localized form of the Currency name
*
* @see currencyCode
* @see allCurrencyCodesList
*/
static QString currencyCodeToName( const QString ¤cyCode, const QString &language = QString() );
private:
QSharedDataPointer<KCurrencyCodePrivate> d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( KCurrencyCode::CurrencyStatusFlags )
#endif // KCURRENCYCODE_H
|