KDECore
kcurrencycode.h
Go to the documentation of this file.
00001 /* 00002 Copyright (c) 2009 John Layt <john@layt.net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KCURRENCYCODE_H 00021 #define KCURRENCYCODE_H 00022 00023 #include <kdecore_export.h> 00024 00025 #include <QtCore/QSharedDataPointer> 00026 #include <QtCore/QString> 00027 00028 class QDate; 00029 class QStringList; 00030 class QFileInfo; 00031 00032 class KCurrencyCodePrivate; 00033 00045 class KDECORE_EXPORT KCurrencyCode 00046 { 00047 public: 00054 enum CurrencyStatus { 00055 ActiveCurrency = 0x01, 00056 SuspendedCurrency = 0x02, 00057 ObsoleteCurrency = 0x04 00058 }; 00059 Q_DECLARE_FLAGS( CurrencyStatusFlags, CurrencyStatus ) 00060 00061 00070 explicit KCurrencyCode( const QString &isoCurrencyCode, const QString &language = QString() ); 00071 00083 explicit KCurrencyCode( const QFileInfo ¤cyCodeFile, const QString &language = QString() ); 00084 00091 KCurrencyCode( const KCurrencyCode &rhs ); 00092 00096 virtual ~KCurrencyCode(); 00097 00104 KCurrencyCode& operator=( const KCurrencyCode &rhs ); 00105 00113 QString isoCurrencyCode() const; 00114 00122 QString isoCurrencyCodeNumeric() const; 00123 00132 QString name() const; 00133 00144 QString isoName() const; 00145 00153 CurrencyStatus status() const; 00154 00164 QDate dateIntroduced() const; 00165 00175 QDate dateSuspended() const; 00176 00186 QDate dateWithdrawn() const; 00187 00198 QStringList symbolList() const; 00199 00208 QString defaultSymbol() const; 00209 00218 QString unambiguousSymbol() const; 00219 00231 bool hasSubunits() const; 00232 00241 bool hasSubunitsInCirculation() const; 00242 00251 QString subunitSymbol() const; 00252 00260 int subunitsPerUnit() const; 00261 00267 int decimalPlaces() const; 00268 00274 QStringList countriesUsingCurrency() const; 00275 00281 bool isValid() const; 00282 00292 static bool isValid( const QString ¤cyCode, CurrencyStatusFlags currencyStatus = 00293 CurrencyStatusFlags( ActiveCurrency | 00294 SuspendedCurrency | 00295 ObsoleteCurrency ) ); 00296 00311 static QStringList allCurrencyCodesList( CurrencyStatusFlags currencyStatus = 00312 CurrencyStatusFlags( ActiveCurrency | 00313 SuspendedCurrency | 00314 ObsoleteCurrency ) ); 00315 00331 static QString currencyCodeToName( const QString ¤cyCode, const QString &language = QString() ); 00332 00333 00334 private: 00335 QSharedDataPointer<KCurrencyCodePrivate> d; 00336 }; 00337 00338 Q_DECLARE_OPERATORS_FOR_FLAGS( KCurrencyCode::CurrencyStatusFlags ) 00339 00340 00341 #endif // KCURRENCYCODE_H
KDE 4.6 API Reference