File indexing completed on 2024-04-28 09:45:44

0001 /***************************************************************************
0002                           table.h  -  conversion table
0003                              -------------------
0004     begin                : jeu nov 23 21:03:27 CET 2006
0005     copyright            : (C) 2006-2022 by Éric Bischoff
0006     email                : bischoff@kde.org
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CURRENCYTABLE_H
0019 #define CURRENCYTABLE_H
0020 
0021 #include "../currencies/currencies.h"
0022 
0023 class CurrencyTable : public QObject
0024 {
0025     Q_OBJECT 
0026 
0027 public:
0028     explicit CurrencyTable(const QString &tablePath);
0029     virtual ~CurrencyTable();
0030     void loadSource(const QString &dataSource, const QString &roundingMethod);
0031 
0032 public slots:
0033     Q_SCRIPTABLE QStringList AvailableCurrencies();
0034     Q_SCRIPTABLE QString Symbol(const QString &currencyCode);
0035     Q_SCRIPTABLE QString Name(const QString &currencyCode);
0036     Q_SCRIPTABLE double ConvertFromReference(const QString &currencyCode, double referenceValue);
0037     Q_SCRIPTABLE double ConvertToReference(const QString &currencyCode, double currencyValue);
0038     Q_SCRIPTABLE void Unload();
0039 
0040     void endDownload(int defaultCurrency, const QString &date);
0041 
0042 private:
0043     QString path;           // Object path
0044     Currencies currencies;              // Currencies list
0045     int rounding;           // Rounding method
0046 };
0047 
0048 #endif