summaryrefslogtreecommitdiff
path: root/protocols/CurrencyRates/src/ICurrencyRatesProvider.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:44 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-02 12:32:55 +0300
commit931a7dc1ac0dbc7e6c1083583ced915e572f5b47 (patch)
tree9fe9a6448d44030e26aa7107ce16044ed413e0d0 /protocols/CurrencyRates/src/ICurrencyRatesProvider.h
parentdd7d9954042254e66e3bbbec7195c6be8b1a0663 (diff)
all protocols (even virtual ones) moved to the Protocols folder
Diffstat (limited to 'protocols/CurrencyRates/src/ICurrencyRatesProvider.h')
-rw-r--r--protocols/CurrencyRates/src/ICurrencyRatesProvider.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/protocols/CurrencyRates/src/ICurrencyRatesProvider.h b/protocols/CurrencyRates/src/ICurrencyRatesProvider.h
new file mode 100644
index 0000000000..a80cae3088
--- /dev/null
+++ b/protocols/CurrencyRates/src/ICurrencyRatesProvider.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#ifndef __ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__
+#define __ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__
+
+class CCurrencyRatesProviderVisitor;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// CFormatSpecificator - array of variables to replace
+
+using CFormatSpecificator = std::pair<tstring, tstring>;
+typedef std::vector<CFormatSpecificator> TFormatSpecificators;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// ICurrencyRatesProvider - abstract interface
+
+class ICurrencyRatesProvider : private boost::noncopyable
+{
+public:
+ struct CProviderInfo
+ {
+ tstring m_sName;
+ tstring m_sURL;
+ };
+
+public:
+ ICurrencyRatesProvider() {}
+ virtual ~ICurrencyRatesProvider() {}
+
+ virtual bool Init() = 0;
+ virtual const CProviderInfo& GetInfo() const = 0;
+
+ virtual void AddContact(MCONTACT hContact) = 0;
+ virtual void DeleteContact(MCONTACT hContact) = 0;
+ virtual MCONTACT ImportContact(const TiXmlNode*) = 0;
+
+ virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp) = 0;
+
+ virtual void RefreshAllContacts() = 0;
+ virtual void RefreshSettings() = 0;
+ virtual void RefreshContact(MCONTACT hContact) = 0;
+
+ virtual void FillFormat(TFormatSpecificators&) const = 0;
+ virtual bool ParseSymbol(MCONTACT hContact, wchar_t c, double &d) = 0;
+ virtual tstring FormatSymbol(MCONTACT hContact, wchar_t c, int nWidth = 0) const = 0;
+
+ virtual void Run() = 0;
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+typedef std::vector<ICurrencyRatesProvider*> TCurrencyRatesProviders;
+extern TCurrencyRatesProviders g_apProviders;
+
+ICurrencyRatesProvider* FindProvider(const tstring& rsName);
+ICurrencyRatesProvider* GetContactProviderPtr(MCONTACT hContact);
+
+void InitProviders();
+void CreateProviders();
+void ClearProviders();
+
+#endif //__ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__