summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h
blob: 0bb2f6225f67fd16e4547cf116ff87763e5db8c2 (plain)
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
#pragma once

#define DB_STR_FROM_ID "FromID"
#define DB_STR_TO_ID "ToID"
#define DB_STR_FROM_DESCRIPTION "FromDesc"
#define DB_STR_TO_DESCRIPTION "ToDesc"


class CCurrencyRatesProviderCurrencyConverter : public CCurrencyRatesProviderBase
{
public:
	typedef CCurrencyRatesProviderBase CSuper;
	using TRateInfo = std::pair<CCurrencyRate, CCurrencyRate>;

public:
	CCurrencyRatesProviderCurrencyConverter();
	~CCurrencyRatesProviderCurrencyConverter();

	double Convert(double dAmount, const CCurrencyRate &from, const CCurrencyRate &to) const;
	size_t GetWatchedRateCount() const;
	bool GetWatchedRateInfo(size_t nIndex, TRateInfo &rRateInfo);
	bool WatchForRate(const TRateInfo &ri, bool bWatch);
	MCONTACT GetContactByID(const CMStringW &rsFromID, const CMStringW &rsToID) const;

private:
	void FillFormat(TFormatSpecificators &) const override;
	void RefreshCurrencyRates(TContacts &anContacts) override;
	void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) override;

	MCONTACT ImportContact(const TiXmlNode*) override;
	CMStringW FormatSymbol(MCONTACT hContact, wchar_t c, int nWidth) const override;
};