summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CurrencyRates/src/Chart.h10
-rw-r--r--plugins/CurrencyRates/src/CurrencyConverter.cpp19
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp65
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderBase.h177
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp39
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h19
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h10
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.cpp62
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h33
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h2
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h4
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviders.cpp6
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviders.h6
-rw-r--r--plugins/CurrencyRates/src/HTMLParserMS.cpp14
-rw-r--r--plugins/CurrencyRates/src/HTMLParserMS.h2
-rw-r--r--plugins/CurrencyRates/src/HTTPSession.cpp6
-rw-r--r--plugins/CurrencyRates/src/HTTPSession.h2
-rw-r--r--plugins/CurrencyRates/src/ICurrencyRatesProvider.h20
-rw-r--r--plugins/CurrencyRates/src/IHTMLEngine.h2
-rw-r--r--plugins/CurrencyRates/src/IHTMLParser.h10
-rw-r--r--plugins/CurrencyRates/src/SettingsDlg.cpp32
-rw-r--r--plugins/CurrencyRates/src/SettingsDlg.h32
-rw-r--r--plugins/CurrencyRates/src/WinCtrlHelper.cpp8
-rw-r--r--plugins/CurrencyRates/src/stdafx.h2
-rw-r--r--plugins/CurrencyRates/src/version.h2
25 files changed, 262 insertions, 322 deletions
diff --git a/plugins/CurrencyRates/src/Chart.h b/plugins/CurrencyRates/src/Chart.h
index d33772b7c8..1247ead065 100644
--- a/plugins/CurrencyRates/src/Chart.h
+++ b/plugins/CurrencyRates/src/Chart.h
@@ -74,7 +74,7 @@ public:
m_rect.bottom = y + cy;
}
- void Draw(HDC hdc)const
+ void Draw(HDC hdc) const
{
RECT rc = m_rect;
DrawBackground(hdc, rc);
@@ -101,14 +101,14 @@ public:
}
private:
- void DrawBackground(HDC hdc, RECT& rc)const
+ void DrawBackground(HDC hdc, RECT& rc) const
{
// HBRUSH hBrush = ::CreateSolidBrush(RGB(255,0,0));//user preferable background color here!
// ::FillRect(hdc,&m_rect,hBrush);
// ::DeleteBrush(hBrush);
}
- void DrawGrid(HDC hdc, RECT& rc)const
+ void DrawGrid(HDC hdc, RECT& rc) const
{
enum{ number_of_lines = 5 };
HPEN hPen = ::CreatePen(PS_SOLID, 1, RGB(125, 125, 125));
@@ -204,7 +204,7 @@ private:
assert(TRUE == bResult);
}
- void DrawAxis(HDC hdc, RECT& rc)const
+ void DrawAxis(HDC hdc, RECT& rc) const
{
HPEN hPen = ::CreatePen(PS_SOLID, 2, RGB(0, 0, 0));
HPEN hPenOld = static_cast<HPEN>(::SelectObject(hdc, hPen));
@@ -226,7 +226,7 @@ private:
assert(TRUE == bResult);
}
- void DrawPoints(HDC hdc, RECT& rc)const
+ void DrawPoints(HDC hdc, RECT& rc) const
{
TXValue xMin(m_aValues[0].first);
double dx = TXConverter::Convert(m_aValues[m_aValues.size() - 1].first - xMin);
diff --git a/plugins/CurrencyRates/src/CurrencyConverter.cpp b/plugins/CurrencyRates/src/CurrencyConverter.cpp
index ceb7dc1511..2dcb69ea8b 100644
--- a/plugins/CurrencyRates/src/CurrencyConverter.cpp
+++ b/plugins/CurrencyRates/src/CurrencyConverter.cpp
@@ -7,23 +7,18 @@
#define DB_STR_CC_CURRENCYRATE_TO_ID "CurrencyConverter_ToID"
#define DB_STR_CC_AMOUNT "CurrencyConverter_Amount"
-static CCurrencyRatesProviderCurrencyConverter* get_currency_converter_provider()
+static CCurrencyRatesProviderCurrencyConverter *get_currency_converter_provider()
{
CModuleInfo::TCurrencyRatesProvidersPtr pProviders = CModuleInfo::GetCurrencyRateProvidersPtr();
- const CCurrencyRatesProviders::TCurrencyRatesProviders& rapCurrencyRatesProviders = pProviders->GetProviders();
- for (CCurrencyRatesProviders::TCurrencyRatesProviders::const_iterator i = rapCurrencyRatesProviders.begin(); i != rapCurrencyRatesProviders.end(); ++i) {
- const CCurrencyRatesProviders::TCurrencyRatesProviderPtr& pProvider = *i;
- if (auto p = dynamic_cast<CCurrencyRatesProviderCurrencyConverter*>(pProvider.get()))
- {
+ for (auto &it : pProviders->GetProviders())
+ if (auto p = dynamic_cast<CCurrencyRatesProviderCurrencyConverter*>(it.get()))
return p;
- }
- }
assert(!"We should never get here!");
return nullptr;
}
-CCurrencyRatesProviderBase::CCurrencyRateSection get_currencyrates(const CCurrencyRatesProviderCurrencyConverter* pProvider = nullptr)
+CCurrencyRateSection get_currencyrates(const CCurrencyRatesProviderCurrencyConverter* pProvider = nullptr)
{
if (nullptr == pProvider)
pProvider = get_currency_converter_provider();
@@ -34,12 +29,12 @@ CCurrencyRatesProviderBase::CCurrencyRateSection get_currencyrates(const CCurren
return rCurrencyRates.GetSection(0);
}
- return CCurrencyRatesProviderBase::CCurrencyRateSection();
+ return CCurrencyRateSection();
}
-inline tstring make_currencyrate_name(const CCurrencyRatesProviderBase::CCurrencyRate& rCurrencyRate)
+inline tstring make_currencyrate_name(const CCurrencyRate &rCurrencyRate)
{
- const tstring& rsDesc = rCurrencyRate.GetName();
+ const tstring &rsDesc = rCurrencyRate.GetName();
return((false == rsDesc.empty()) ? rsDesc : rCurrencyRate.GetSymbol());
}
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp
index 42a8942ccd..2247f547d5 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.cpp
@@ -3,11 +3,11 @@
extern bool g_bAutoUpdate;
extern HANDLE g_hEventWorkThreadStop;
-struct CCurrencyRatesProviderBase::CXMLFileInfo
+struct CXMLFileInfo
{
CXMLFileInfo() : m_qs(L"Unknown") {}
ICurrencyRatesProvider::CProviderInfo m_pi;
- CCurrencyRatesProviderBase::CCurrencyRateSection m_qs;
+ CCurrencyRateSection m_qs;
tstring m_sURL;
};
@@ -16,7 +16,7 @@ inline tstring get_ini_file_name(LPCTSTR pszFileName)
return CreateFilePath(pszFileName);
}
-bool parse_currencyrate(const TiXmlNode *pTop, CCurrencyRatesProviderBase::CCurrencyRate &q)
+bool parse_currencyrate(const TiXmlNode *pTop, CCurrencyRate &q)
{
tstring sSymbol, sDescription, sID;
@@ -37,25 +37,25 @@ bool parse_currencyrate(const TiXmlNode *pTop, CCurrencyRatesProviderBase::CCurr
}
}
- q = CCurrencyRatesProviderBase::CCurrencyRate(sID, TranslateW(sSymbol.c_str()), TranslateW(sDescription.c_str()));
+ q = CCurrencyRate(sID, TranslateW(sSymbol.c_str()), TranslateW(sDescription.c_str()));
return true;
}
-bool parse_section(const TiXmlNode *pTop, CCurrencyRatesProviderBase::CCurrencyRateSection &qs)
+bool parse_section(const TiXmlNode *pTop, CCurrencyRateSection &qs)
{
- CCurrencyRatesProviderBase::CCurrencyRateSection::TSections aSections;
- CCurrencyRatesProviderBase::CCurrencyRateSection::TCurrencyRates aCurrencyRates;
+ CCurrencyRateSection::TSections aSections;
+ CCurrencyRateSection::TCurrencyRates aCurrencyRates;
tstring sSectionName;
for (auto *pNode : TiXmlEnum(pTop)) {
const char *sName = pNode->Value();
if (!mir_strcmpi(sName, "section")) {
- CCurrencyRatesProviderBase::CCurrencyRateSection qs1;
+ CCurrencyRateSection qs1;
if (true == parse_section(pNode, qs1))
aSections.push_back(qs1);
}
else if (!mir_strcmpi(sName, "currencyrate")) {
- CCurrencyRatesProviderBase::CCurrencyRate q;
+ CCurrencyRate q;
if (true == parse_currencyrate(pNode, q))
aCurrencyRates.push_back(q);
}
@@ -66,7 +66,7 @@ bool parse_section(const TiXmlNode *pTop, CCurrencyRatesProviderBase::CCurrencyR
}
}
- qs = CCurrencyRatesProviderBase::CCurrencyRateSection(TranslateW(sSectionName.c_str()), aSections, aCurrencyRates);
+ qs = CCurrencyRateSection(TranslateW(sSectionName.c_str()), aSections, aCurrencyRates);
return true;
}
@@ -84,10 +84,10 @@ const TiXmlNode* find_provider(const TiXmlNode *pRoot)
return nullptr;
}
-CCurrencyRatesProviderBase::CXMLFileInfo parse_ini_file(const tstring &rsXMLFile, bool &rbSucceded)
+CXMLFileInfo parse_ini_file(const tstring &rsXMLFile, bool &rbSucceded)
{
- CCurrencyRatesProviderBase::CXMLFileInfo res;
- CCurrencyRatesProviderBase::CCurrencyRateSection::TSections aSections;
+ CXMLFileInfo res;
+ CCurrencyRateSection::TSections aSections;
TiXmlDocument doc;
if (doc.LoadFile(_T2A(rsXMLFile.c_str())) == tinyxml2::XML_SUCCESS) {
@@ -97,7 +97,7 @@ CCurrencyRatesProviderBase::CXMLFileInfo parse_ini_file(const tstring &rsXMLFile
for (auto *pNode : TiXmlEnum(pProvider)) {
const char *sName = pNode->Value();
if (!mir_strcmpi(sName, "section")) {
- CCurrencyRatesProviderBase::CCurrencyRateSection qs;
+ CCurrencyRateSection qs;
if (parse_section(pNode, qs))
aSections.push_back(qs);
}
@@ -111,11 +111,11 @@ CCurrencyRatesProviderBase::CXMLFileInfo parse_ini_file(const tstring &rsXMLFile
}
}
- res.m_qs = CCurrencyRatesProviderBase::CCurrencyRateSection(res.m_pi.m_sName, aSections);
+ res.m_qs = CCurrencyRateSection(res.m_pi.m_sName, aSections);
return res;
}
-CCurrencyRatesProviderBase::CXMLFileInfo init_xml_info(LPCTSTR pszFileName, bool& rbSucceded)
+CXMLFileInfo init_xml_info(LPCTSTR pszFileName, bool& rbSucceded)
{
rbSucceded = false;
tstring sIniFile = get_ini_file_name(pszFileName);
@@ -144,22 +144,22 @@ bool CCurrencyRatesProviderBase::Init()
return bSucceded;
}
-CCurrencyRatesProviderBase::CXMLFileInfo* CCurrencyRatesProviderBase::GetXMLFileInfo()const
+CXMLFileInfo* CCurrencyRatesProviderBase::GetXMLFileInfo() const
{
return m_pXMLInfo.get();
}
-const CCurrencyRatesProviderBase::CProviderInfo& CCurrencyRatesProviderBase::GetInfo()const
+const CCurrencyRatesProviderBase::CProviderInfo& CCurrencyRatesProviderBase::GetInfo() const
{
return GetXMLFileInfo()->m_pi;
}
-const CCurrencyRatesProviderBase::CCurrencyRateSection& CCurrencyRatesProviderBase::GetCurrencyRates()const
+const CCurrencyRateSection& CCurrencyRatesProviderBase::GetCurrencyRates() const
{
return GetXMLFileInfo()->m_qs;
}
-const tstring& CCurrencyRatesProviderBase::GetURL()const
+const tstring& CCurrencyRatesProviderBase::GetURL() const
{
return GetXMLFileInfo()->m_sURL;
}
@@ -181,7 +181,7 @@ void CCurrencyRatesProviderBase::DeleteContact(MCONTACT hContact)
{
mir_cslock lck(m_cs);
- TContracts::iterator i = std::find(m_aContacts.begin(), m_aContacts.end(), hContact);
+ TContacts::iterator i = std::find(m_aContacts.begin(), m_aContacts.end(), hContact);
if (i != m_aContacts.end())
m_aContacts.erase(i);
}
@@ -294,9 +294,9 @@ public:
return (bValid && IsValid());
}
- bool IsValid()const { return (m_abValueFlags[0] && m_abValueFlags[1] && (m_nComparison != NonValid)); }
+ bool IsValid() const { return (m_abValueFlags[0] && m_abValueFlags[1] && (m_nComparison != NonValid)); }
- EResult Compare()const
+ EResult Compare() const
{
switch (m_nComparison) {
case Greater:
@@ -716,7 +716,7 @@ void CCurrencyRatesProviderBase::Run()
anEvents[SETTINGS_CHANGED] = m_hEventSettingsChanged;
anEvents[REFRESH_CONTACT] = m_hEventRefreshContact;
- TContracts anContacts;
+ TContacts anContacts;
{
mir_cslock lck(m_cs);
anContacts = m_aContacts;
@@ -801,7 +801,7 @@ void CCurrencyRatesProviderBase::Run()
void CCurrencyRatesProviderBase::OnEndRun()
{
- TContracts anContacts;
+ TContacts anContacts;
{
mir_cslock lck(m_cs);
anContacts = m_aContacts;
@@ -813,7 +813,7 @@ void CCurrencyRatesProviderBase::OnEndRun()
SetContactStatus(it, ID_STATUS_OFFLINE);
}
-void CCurrencyRatesProviderBase::Accept(CCurrencyRatesProviderVisitor &visitor)const
+void CCurrencyRatesProviderBase::Accept(CCurrencyRatesProviderVisitor &visitor) const
{
visitor.Visit(*this);
}
@@ -842,3 +842,16 @@ void CCurrencyRatesProviderBase::RefreshContact(MCONTACT hContact)
::SetEvent(m_hEventRefreshContact);
}
+
+void CCurrencyRatesProviderBase::FillFormat(TFormatSpecificators &array) const
+{
+ array.push_back(CFormatSpecificator(L"%S", TranslateT("Source of Information")));
+ array.push_back(CFormatSpecificator(L"%r", TranslateT("Rate Value")));
+ array.push_back(CFormatSpecificator(L"%p", TranslateT("Previous Rate Value")));
+ array.push_back(CFormatSpecificator(L"%X", TranslateT("Fetch Time")));
+ array.push_back(CFormatSpecificator(L"%x", TranslateT("Fetch Date")));
+ array.push_back(CFormatSpecificator(L"%t", TranslateT("Fetch Time and Date")));
+ array.push_back(CFormatSpecificator(L"\\%", TranslateT("Percentage Character (%)")));
+ array.push_back(CFormatSpecificator(L"\\t", TranslateT("Tabulation")));
+ array.push_back(CFormatSpecificator(L"\\\\", TranslateT("Left slash (\\)")));
+}
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h
index 0203675edf..cfaab4236d 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderBase.h
@@ -1,110 +1,80 @@
#ifndef __3e6cb4ec_fc47_468f_a2c8_a77941176bc9_CurrencyRatesProviderBase_h__
#define __3e6cb4ec_fc47_468f_a2c8_a77941176bc9_CurrencyRatesProviderBase_h__
-class CCurrencyRatesProviderBase : public ICurrencyRatesProvider
+/////////////////////////////////////////////////////////////////////////////////////////
+// CCurrencyRate - one currency
+
+class CCurrencyRate
{
public:
- class CCurrencyRate
- {
- public:
- CCurrencyRate(const tstring& rsID = L"", const tstring& rsSymbol = L"", const tstring& rsName = L"")
- : m_sSymbol(rsSymbol), m_sName(rsName), m_sID(rsID){}
+ CCurrencyRate(const tstring& rsID = L"", const tstring& rsSymbol = L"", const tstring& rsName = L"")
+ : m_sSymbol(rsSymbol), m_sName(rsName), m_sID(rsID){}
- const tstring& GetSymbol()const{ return m_sSymbol; }
- const tstring& GetName()const{ return m_sName; }
- const tstring& GetID()const{ return m_sID; }
+ const tstring& GetSymbol() const{ return m_sSymbol; }
+ const tstring& GetName() const{ return m_sName; }
+ const tstring& GetID() const{ return m_sID; }
- private:
- tstring m_sSymbol;
- tstring m_sName;
- tstring m_sID;
- };
-
- class CCurrencyRateSection
- {
- public:
- typedef std::vector<CCurrencyRateSection> TSections;
- typedef std::vector<CCurrencyRate> TCurrencyRates;
-
- public:
- CCurrencyRateSection(const tstring& rsName = L"", const TSections& raSections = TSections(), const TCurrencyRates& raCurrencyRates = TCurrencyRates())
- : m_sName(rsName), m_aSections(raSections), m_aCurrencyRates(raCurrencyRates){}
-
- const tstring& GetName()const
- {
- return m_sName;
- }
-
- size_t GetSectionCount()const
- {
- return m_aSections.size();
- }
- CCurrencyRateSection GetSection(size_t nIndex)const
- {
- return ((nIndex < m_aSections.size()) ? m_aSections[nIndex] : CCurrencyRateSection());
- }
-
- size_t GetCurrencyRateCount()const
- {
- return m_aCurrencyRates.size();
- }
- CCurrencyRate GetCurrencyRate(size_t nIndex)const
- {
- return ((nIndex < m_aCurrencyRates.size()) ? m_aCurrencyRates[nIndex] : CCurrencyRate());
- }
-
- private:
- tstring m_sName;
- TSections m_aSections;
- TCurrencyRates m_aCurrencyRates;
- };
+private:
+ tstring m_sSymbol;
+ tstring m_sName;
+ tstring m_sID;
+};
-protected:
- typedef std::vector<MCONTACT> TContracts;
+/////////////////////////////////////////////////////////////////////////////////////////
+// CCurrencyRateSection - block of currency settings
+class CCurrencyRateSection
+{
public:
- struct CXMLFileInfo;
+ typedef std::vector<CCurrencyRateSection> TSections;
+ typedef std::vector<CCurrencyRate> TCurrencyRates;
public:
- CCurrencyRatesProviderBase();
- ~CCurrencyRatesProviderBase();
+ CCurrencyRateSection(const tstring& rsName = L"", const TSections& raSections = TSections(), const TCurrencyRates& raCurrencyRates = TCurrencyRates())
+ : m_sName(rsName), m_aSections(raSections), m_aCurrencyRates(raCurrencyRates){}
+ const tstring& GetName() const
+ {
+ return m_sName;
+ }
- const CCurrencyRateSection& GetCurrencyRates()const;
- // void SetSettingsEvent();
+ size_t GetSectionCount() const
+ {
+ return m_aSections.size();
+ }
- virtual bool Init();
- virtual const CProviderInfo& GetInfo()const;
- virtual void AddContact(MCONTACT hContact);
- virtual void DeleteContact(MCONTACT hContact);
- virtual void Run();
- virtual void Accept(CCurrencyRatesProviderVisitor& visitor) const;
- virtual void RefreshAllContacts();
- virtual void RefreshSettings();
- virtual void RefreshContact(MCONTACT hContact);
- // virtual void SetContactExtraIcon(MCONTACT hContact)const;
+ CCurrencyRateSection GetSection(size_t nIndex) const
+ {
+ return ((nIndex < m_aSections.size()) ? m_aSections[nIndex] : CCurrencyRateSection());
+ }
-protected:
- const tstring& GetURL()const;
- MCONTACT CreateNewContact(const tstring& rsName);
- static bool IsOnline();
- static void SetContactStatus(MCONTACT hContact, int nNewStatus);
- void WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol = L"");
+ size_t GetCurrencyRateCount() const
+ {
+ return m_aCurrencyRates.size();
+ }
-private:
- virtual void RefreshCurrencyRates(TContracts& anContacts) = 0;
+ CCurrencyRate GetCurrencyRate(size_t nIndex) const
+ {
+ return ((nIndex < m_aCurrencyRates.size()) ? m_aCurrencyRates[nIndex] : CCurrencyRate());
+ }
private:
- virtual void OnEndRun();
+ tstring m_sName;
+ TSections m_aSections;
+ TCurrencyRates m_aCurrencyRates;
+};
-private:
- CXMLFileInfo* GetXMLFileInfo()const;
+/////////////////////////////////////////////////////////////////////////////////////////
+// CCurrencyRatesProviderBase - basic set of methods for retrieving currencies
-protected:
- TContracts m_aContacts;
- mutable mir_cs m_cs;
+typedef std::vector<MCONTACT> TContacts;
+
+class CCurrencyRatesProviderBase : public ICurrencyRatesProvider
+{
+ void OnEndRun();
+
+ struct CXMLFileInfo* GetXMLFileInfo() const;
-private:
typedef boost::scoped_ptr<CXMLFileInfo> TXMLFileInfoPtr;
mutable TXMLFileInfoPtr m_pXMLInfo;
HANDLE m_hEventSettingsChanged;
@@ -112,8 +82,43 @@ private:
tstring m_sContactListFormat;
tstring m_sStatusMsgFormat;
tstring m_sTendencyFormat;
- TContracts m_aRefreshingContacts;
+ TContacts m_aRefreshingContacts;
bool m_bRefreshInProgress;
+
+public:
+ CCurrencyRatesProviderBase();
+ ~CCurrencyRatesProviderBase();
+
+ const CCurrencyRateSection& GetCurrencyRates() const;
+
+ bool Init() override;
+ const CProviderInfo& GetInfo() const override;
+
+ void AddContact(MCONTACT hContact) override;
+ void DeleteContact(MCONTACT hContact) override;
+
+ void Run() override;
+
+ void Accept(CCurrencyRatesProviderVisitor &visitor) const override;
+
+ void RefreshAllContacts() override;
+ void RefreshSettings() override;
+ void RefreshContact(MCONTACT hContact) override;
+
+ void FillFormat(TFormatSpecificators&) const override;
+
+protected:
+ const tstring& GetURL() const;
+ MCONTACT CreateNewContact(const tstring& rsName);
+ static bool IsOnline();
+ static void SetContactStatus(MCONTACT hContact, int nNewStatus);
+ void WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol = L"");
+
+ virtual void RefreshCurrencyRates(TContacts &anContacts) = 0;
+
+protected:
+ TContacts m_aContacts;
+ mutable mir_cs m_cs;
};
#endif //__3e6cb4ec_fc47_468f_a2c8_a77941176bc9_CurrencyRatesProviderBase_h__
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp
index 050006fb7c..669812a0ee 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.cpp
@@ -61,13 +61,13 @@ INT_PTR CALLBACK OptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
return nullptr;
};
- auto make_currencyrate_name = [](const CCurrencyRatesProviderBase::CCurrencyRate& rCurrencyRate)->tstring
+ auto make_currencyrate_name = [](const CCurrencyRate &rCurrencyRate)->tstring
{
const tstring& rsDesc = rCurrencyRate.GetName();
return((false == rsDesc.empty()) ? rsDesc : rCurrencyRate.GetSymbol());
};
- auto make_contact_name = [](const tstring& rsSymbolFrom, const tstring& rsSymbolTo)->tstring
+ auto make_contact_name = [](const tstring &rsSymbolFrom, const tstring &rsSymbolTo)->tstring
{
tostringstream o;
o << rsSymbolFrom << L"/" << rsSymbolTo;
@@ -75,7 +75,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
};
- auto make_rate_name = [make_contact_name](const CCurrencyRatesProviderCurrencyConverter::TRateInfo& ri)->tstring
+ auto make_rate_name = [make_contact_name](const CCurrencyRatesProviderCurrencyConverter::TRateInfo &ri)->tstring
{
if ((false == ri.first.GetName().empty()) && (false == ri.second.GetName().empty()))
return make_contact_name(ri.first.GetName(), ri.second.GetName());
@@ -135,7 +135,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
HWND hcbxFrom = ::GetDlgItem(hdlg, IDC_COMBO_CONVERT_FROM);
HWND hcbxTo = ::GetDlgItem(hdlg, IDC_COMBO_CONVERT_INTO);
- CCurrencyRatesProviderBase::CCurrencyRateSection rSection;
+ CCurrencyRateSection rSection;
const auto& rCurrencyRates = pProvider->GetCurrencyRates();
if (rCurrencyRates.GetSectionCount() > 0) {
rSection = rCurrencyRates.GetSection(0);
@@ -197,7 +197,7 @@ INT_PTR CALLBACK OptDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPara
size_t nFrom = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_FROM, CB_GETCURSEL, 0, 0));
size_t nTo = static_cast<size_t>(::SendDlgItemMessage(hdlg, IDC_COMBO_CONVERT_INTO, CB_GETCURSEL, 0, 0));
if ((CB_ERR != nFrom) && (CB_ERR != nTo) && (nFrom != nTo)) {
- CCurrencyRatesProviderBase::CCurrencyRateSection rSection;
+ CCurrencyRateSection rSection;
const auto& rCurrencyRates = pProvider->GetCurrencyRates();
if (rCurrencyRates.GetSectionCount() > 0) {
rSection = rCurrencyRates.GetSection(0);
@@ -254,13 +254,13 @@ CCurrencyRatesProviderCurrencyConverter::~CCurrencyRatesProviderCurrencyConverte
{
}
-void CCurrencyRatesProviderCurrencyConverter::Accept(CCurrencyRatesProviderVisitor& visitor)const
+void CCurrencyRatesProviderCurrencyConverter::Accept(CCurrencyRatesProviderVisitor &visitor) const
{
CCurrencyRatesProviderBase::Accept(visitor);
visitor.Visit(*this);
}
-void CCurrencyRatesProviderCurrencyConverter::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp)
+void CCurrencyRatesProviderCurrencyConverter::ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp)
{
odp.pszTemplate = MAKEINTRESOURCEA(IDD_DIALOG_OPT_GOOGLE);
odp.pfnDlgProc = OptDlgProc;
@@ -268,12 +268,12 @@ void CCurrencyRatesProviderCurrencyConverter::ShowPropertyPage(WPARAM wp, OPTION
g_plugin.addOptions(wp, &odp);
}
-void CCurrencyRatesProviderCurrencyConverter::RefreshCurrencyRates(TContracts& anContacts)
+void CCurrencyRatesProviderCurrencyConverter::RefreshCurrencyRates(TContacts &anContacts)
{
CHTTPSession http;
tstring sURL = GetURL();
- for (TContracts::const_iterator i = anContacts.begin(); i != anContacts.end() && IsOnline(); ++i) {
+ for (TContacts::const_iterator i = anContacts.begin(); i != anContacts.end() && IsOnline(); ++i) {
MCONTACT hContact = *i;
tstring sFullURL = build_url(hContact, sURL);
@@ -292,7 +292,7 @@ void CCurrencyRatesProviderCurrencyConverter::RefreshCurrencyRates(TContracts& a
}
}
-double CCurrencyRatesProviderCurrencyConverter::Convert(double dAmount, const CCurrencyRate& from, const CCurrencyRate& to)const
+double CCurrencyRatesProviderCurrencyConverter::Convert(double dAmount, const CCurrencyRate &from, const CCurrencyRate &to) const
{
tstring sFullURL = build_url(GetURL(), from.GetID(), to.GetID());
@@ -313,12 +313,12 @@ double CCurrencyRatesProviderCurrencyConverter::Convert(double dAmount, const CC
return 0.0;
}
-size_t CCurrencyRatesProviderCurrencyConverter::GetWatchedRateCount()const
+size_t CCurrencyRatesProviderCurrencyConverter::GetWatchedRateCount() const
{
return m_aContacts.size();
}
-bool CCurrencyRatesProviderCurrencyConverter::GetWatchedRateInfo(size_t nIndex, TRateInfo& rRateInfo)
+bool CCurrencyRatesProviderCurrencyConverter::GetWatchedRateInfo(size_t nIndex, TRateInfo &rRateInfo)
{
if (nIndex >= m_aContacts.size())
return false;
@@ -344,7 +344,7 @@ bool CCurrencyRatesProviderCurrencyConverter::WatchForRate(const TRateInfo &ri,
&& (0 == mir_wstrcmpi(ri.second.GetID().c_str(), sTo.c_str())));
});
- auto make_contact_name = [](const tstring& rsSymbolFrom, const tstring& rsSymbolTo)->tstring
+ auto make_contact_name = [](const tstring &rsSymbolFrom, const tstring &rsSymbolTo)->tstring
{
tostringstream o;
o << rsSymbolFrom << L"/" << rsSymbolTo;
@@ -382,7 +382,7 @@ bool CCurrencyRatesProviderCurrencyConverter::WatchForRate(const TRateInfo &ri,
return false;
}
-MCONTACT CCurrencyRatesProviderCurrencyConverter::GetContactByID(const tstring& rsFromID, const tstring& rsToID)const
+MCONTACT CCurrencyRatesProviderCurrencyConverter::GetContactByID(const tstring& rsFromID, const tstring& rsToID) const
{
mir_cslock lck(m_cs);
@@ -398,3 +398,14 @@ MCONTACT CCurrencyRatesProviderCurrencyConverter::GetContactByID(const tstring&
return NULL;
}
+
+void CCurrencyRatesProviderCurrencyConverter::FillFormat(TFormatSpecificators &array) const
+{
+ CSuper::FillFormat(array);
+
+ array.push_back(CFormatSpecificator(L"%F", TranslateT("From Currency Full Name")));
+ array.push_back(CFormatSpecificator(L"%f", TranslateT("From Currency Short Name")));
+ array.push_back(CFormatSpecificator(L"%I", TranslateT("Into Currency Full Name")));
+ array.push_back(CFormatSpecificator(L"%i", TranslateT("Into Currency Short Name")));
+ array.push_back(CFormatSpecificator(L"%s", TranslateT("Short notation for \"%f/%i\"")));
+}
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h
index 66658c5c99..3a59c7f97a 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderCurrencyConverter.h
@@ -9,21 +9,22 @@
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 tstring& rsFromID, const tstring& rsToID)const;
+ 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 tstring &rsFromID, const tstring &rsToID) const;
private:
- virtual void Accept(CCurrencyRatesProviderVisitor& visitor)const override;
- virtual void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE& odp)override;
- virtual void RefreshCurrencyRates(TContracts& anContacts)override;
+ void Accept(CCurrencyRatesProviderVisitor &visitor) const override;
+ void FillFormat(TFormatSpecificators &) const override;
+ void RefreshCurrencyRates(TContacts &anContacts) override;
+ void ShowPropertyPage(WPARAM wp, OPTIONSDIALOGPAGE &odp) override;
};
-
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h
index 270ff00108..7cccbb802d 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitor.h
@@ -14,11 +14,11 @@ public:
CCurrencyRatesProviderVisitor() {}
virtual ~CCurrencyRatesProviderVisitor() {}
- virtual void Visit(const CCurrencyRatesProviderBase&){}
- virtual void Visit(const CCurrencyRatesProviderFinance&){}
- virtual void Visit(const CCurrencyRatesProviderDukasCopy&){}
- virtual void Visit(const CCurrencyRatesProviderGoogleFinance&){}
- virtual void Visit(const CCurrencyRatesProviderYahoo&){}
+ virtual void Visit(const CCurrencyRatesProviderBase&) {}
+ virtual void Visit(const CCurrencyRatesProviderFinance&) {}
+ virtual void Visit(const CCurrencyRatesProviderDukasCopy& ){}
+ virtual void Visit(const CCurrencyRatesProviderGoogleFinance&) {}
+ virtual void Visit(const CCurrencyRatesProviderYahoo&) {}
virtual void Visit(const CCurrencyRatesProviderCurrencyConverter&) {}
};
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.cpp
deleted file mode 100644
index 056a558702..0000000000
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "StdAfx.h"
-
-CCurrencyRatesProviderVisitorFormatSpecificator::CCurrencyRatesProviderVisitorFormatSpecificator()
-{
-}
-
-CCurrencyRatesProviderVisitorFormatSpecificator::~CCurrencyRatesProviderVisitorFormatSpecificator()
-{
-}
-
-void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderDukasCopy&/* rProvider*/)
-{
- m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Currency Symbol")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%d", TranslateT("Currency Name")));
-}
-
-void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderBase&/* rProvider*/)
-{
- m_aSpecificators.push_back(CFormatSpecificator(L"%S", TranslateT("Source of Information")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%r", TranslateT("Rate Value")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%p", TranslateT("Previous Rate Value")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%X", TranslateT("Fetch Time")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%x", TranslateT("Fetch Date")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%t", TranslateT("Fetch Time and Date")));
- m_aSpecificators.push_back(CFormatSpecificator(L"\\%", TranslateT("Percentage Character (%)")));
- m_aSpecificators.push_back(CFormatSpecificator(L"\\t", TranslateT("Tabulation")));
- m_aSpecificators.push_back(CFormatSpecificator(L"\\\\", TranslateT("Left slash (\\)")));
-}
-
-void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderGoogleFinance&/* rProvider*/)
-{
- m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Currency Symbol")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%n", TranslateT("Currency Name")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%o", TranslateT("Open Price")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%d", TranslateT("Percent Change to After Hours")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%y", TranslateT("Percent Change to Yesterday Close")));
-}
-
-const CCurrencyRatesProviderVisitorFormatSpecificator::TFormatSpecificators& CCurrencyRatesProviderVisitorFormatSpecificator::GetSpecificators()const
-{
- return m_aSpecificators;
-}
-
-void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderYahoo&)
-{
- m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Currency Symbol")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%n", TranslateT("Currency Name")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%o", TranslateT("Open Price")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%h", TranslateT("Day's High")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%g", TranslateT("Day's Low")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%P", TranslateT("Previous Close")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%c", TranslateT("Change")));
-}
-
-void CCurrencyRatesProviderVisitorFormatSpecificator::Visit(const CCurrencyRatesProviderCurrencyConverter&)
-{
- m_aSpecificators.push_back(CFormatSpecificator(L"%F", TranslateT("From Currency Full Name")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%f", TranslateT("From Currency Short Name")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%I", TranslateT("Into Currency Full Name")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%i", TranslateT("Into Currency Short Name")));
- m_aSpecificators.push_back(CFormatSpecificator(L"%s", TranslateT("Short notation for \"%f/%i\"")));
-}
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h
deleted file mode 100644
index f2e11b7f44..0000000000
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormatSpecificator.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __00c159f3_525a_41e9_8fc5_00464b6fafa3_CurrencyRatesProviderVisitorFormatSpecificator_h__
-#define __00c159f3_525a_41e9_8fc5_00464b6fafa3_CurrencyRatesProviderVisitorFormatSpecificator_h__
-
-class CCurrencyRatesProviderVisitorFormatSpecificator : public CCurrencyRatesProviderVisitor
-{
-public:
- struct CFormatSpecificator
- {
- CFormatSpecificator(const tstring& rsSymbol = L"", const tstring& rsDec = L"")
- : m_sSymbol(rsSymbol), m_sDesc(rsDec){}
-
- tstring m_sSymbol;
- tstring m_sDesc;
- };
- typedef std::vector<CFormatSpecificator> TFormatSpecificators;
-
-public:
- CCurrencyRatesProviderVisitorFormatSpecificator();
- ~CCurrencyRatesProviderVisitorFormatSpecificator();
-
- const TFormatSpecificators& GetSpecificators()const;
-
-private:
- virtual void Visit(const CCurrencyRatesProviderDukasCopy& rProvider)override;
- virtual void Visit(const CCurrencyRatesProviderBase& rProvider)override;
- virtual void Visit(const CCurrencyRatesProviderGoogleFinance& rProvider)override;
- virtual void Visit(const CCurrencyRatesProviderYahoo& rProvider)override;
- virtual void Visit(const CCurrencyRatesProviderCurrencyConverter& rProvider)override;
-private:
- TFormatSpecificators m_aSpecificators;
-};
-
-#endif//__00c159f3_525a_41e9_8fc5_00464b6fafa3_CurrencyRatesProviderVisitorFormatSpecificator_h__
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h
index ca2f03a255..2453ce9219 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorFormater.h
@@ -7,7 +7,7 @@ public:
CCurrencyRatesProviderVisitorFormater(MCONTACT hContact, wchar_t chr, int nWidth);
~CCurrencyRatesProviderVisitorFormater();
- const tstring& GetResult()const;
+ const tstring& GetResult() const;
private:
virtual void Visit(const CCurrencyRatesProviderBase& rProvider) override;
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h
index e1bf320423..0ec92d4ee4 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.h
@@ -6,8 +6,8 @@ class CCurrencyRatesProviderVisitorTendency : public CCurrencyRatesProviderVisit
public:
CCurrencyRatesProviderVisitorTendency(MCONTACT hContact, wchar_t chr);
- bool IsValid()const{ return m_bValid; }
- double GetResult()const{ return m_dResult; }
+ bool IsValid() const{ return m_bValid; }
+ double GetResult() const{ return m_dResult; }
private:
virtual void Visit(const CCurrencyRatesProviderBase& rProvider);
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp
index 1d07bc32a2..cc327aa22d 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviders.cpp
@@ -13,7 +13,7 @@ CCurrencyRatesProviders::~CCurrencyRatesProviders()
ClearProviders();
}
-const CCurrencyRatesProviders::TCurrencyRatesProviders& CCurrencyRatesProviders::GetProviders()const
+const CCurrencyRatesProviders::TCurrencyRatesProviders& CCurrencyRatesProviders::GetProviders() const
{
return m_apProviders;
}
@@ -61,7 +61,7 @@ void CCurrencyRatesProviders::InitProviders()
db_set_w(0, CURRENCYRATES_MODULE_NAME, LAST_RUN_VERSION, nCurrentVersion);
}
-CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::GetContactProviderPtr(MCONTACT hContact)const
+CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::GetContactProviderPtr(MCONTACT hContact) const
{
char* szProto = GetContactProto(hContact);
if (nullptr == szProto || 0 != ::_stricmp(szProto, CURRENCYRATES_PROTOCOL_NAME))
@@ -74,7 +74,7 @@ CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::GetC
return FindProvider(sProvider);
}
-CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::FindProvider(const tstring& rsName)const
+CCurrencyRatesProviders::TCurrencyRatesProviderPtr CCurrencyRatesProviders::FindProvider(const tstring& rsName) const
{
TCurrencyRatesProviderPtr pResult;
for (TCurrencyRatesProviders::const_iterator i = m_apProviders.begin(); i != m_apProviders.end(); ++i) {
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviders.h b/plugins/CurrencyRates/src/CurrencyRatesProviders.h
index da30a2522b..e4d762d99d 100644
--- a/plugins/CurrencyRates/src/CurrencyRatesProviders.h
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviders.h
@@ -13,9 +13,9 @@ public:
CCurrencyRatesProviders();
~CCurrencyRatesProviders();
- TCurrencyRatesProviderPtr FindProvider(const tstring& rsName)const;
- TCurrencyRatesProviderPtr GetContactProviderPtr(MCONTACT hContact)const;
- const TCurrencyRatesProviders& GetProviders()const;
+ TCurrencyRatesProviderPtr FindProvider(const tstring& rsName) const;
+ TCurrencyRatesProviderPtr GetContactProviderPtr(MCONTACT hContact) const;
+ const TCurrencyRatesProviders& GetProviders() const;
private:
void InitProviders();
diff --git a/plugins/CurrencyRates/src/HTMLParserMS.cpp b/plugins/CurrencyRates/src/HTMLParserMS.cpp
index 7fa5449444..a712d7589f 100644
--- a/plugins/CurrencyRates/src/HTMLParserMS.cpp
+++ b/plugins/CurrencyRates/src/HTMLParserMS.cpp
@@ -17,7 +17,7 @@ public:
{
}
- virtual THTMLNodePtr GetElementByID(const tstring& rsID)const
+ virtual THTMLNodePtr GetElementByID(const tstring& rsID) const
{
if (m_pDocument) {
CComPtr<IHTMLElement> pElement;
@@ -31,7 +31,7 @@ public:
return THTMLNodePtr();
}
- virtual size_t GetChildCount()const
+ virtual size_t GetChildCount() const
{
TElementCollectionPtr pColl = GetElementCollectionPtr();
if (pColl) {
@@ -62,7 +62,7 @@ public:
return THTMLNodePtr();
}
- virtual bool Is(EType nType)const
+ virtual bool Is(EType nType) const
{
switch (nType) {
case Table:
@@ -85,7 +85,7 @@ public:
return false;
}
- virtual tstring GetAttribute(const tstring& rsAttrName)const
+ virtual tstring GetAttribute(const tstring& rsAttrName) const
{
tstring sAttr;
CComPtr<IHTMLElement> pElement;
@@ -108,7 +108,7 @@ public:
return sAttr;
}
- virtual tstring GetText()const
+ virtual tstring GetText() const
{
tstring sText;
CComPtr<IHTMLElement> pElement;
@@ -129,7 +129,7 @@ public:
}
protected:
- virtual TElementCollectionPtr GetElementCollectionPtr()const
+ virtual TElementCollectionPtr GetElementCollectionPtr() const
{
TElementCollectionPtr pColl;
HRESULT hr = m_pElement->QueryInterface(IID_IHTMLElementCollection, reinterpret_cast<void**>(&pColl));
@@ -248,7 +248,7 @@ CHTMLEngineMS::~CHTMLEngineMS()
{
}
-CHTMLEngineMS::THTMLParserPtr CHTMLEngineMS::GetParserPtr()const
+CHTMLEngineMS::THTMLParserPtr CHTMLEngineMS::GetParserPtr() const
{
return THTMLParserPtr(new CHTMLParserMS);
}
diff --git a/plugins/CurrencyRates/src/HTMLParserMS.h b/plugins/CurrencyRates/src/HTMLParserMS.h
index 4580482dc5..6b2ceb26d8 100644
--- a/plugins/CurrencyRates/src/HTMLParserMS.h
+++ b/plugins/CurrencyRates/src/HTMLParserMS.h
@@ -26,7 +26,7 @@ public:
CHTMLEngineMS();
~CHTMLEngineMS();
- virtual THTMLParserPtr GetParserPtr()const;
+ virtual THTMLParserPtr GetParserPtr() const;
};
#endif //__3c99e3f7_ecd9_4d9b_8f86_fe293c5fc8e6_HTMLParserMS_h__
diff --git a/plugins/CurrencyRates/src/HTTPSession.cpp b/plugins/CurrencyRates/src/HTTPSession.cpp
index e32aac7eab..2b07d4527e 100644
--- a/plugins/CurrencyRates/src/HTTPSession.cpp
+++ b/plugins/CurrencyRates/src/HTTPSession.cpp
@@ -15,7 +15,7 @@ public:
virtual ~CImpl() {}
virtual bool OpenURL(const tstring &rsURL) = 0;
- virtual bool ReadResponce(tstring &rsResponce)const = 0;
+ virtual bool ReadResponce(tstring &rsResponce) const = 0;
};
int find_header(const NETLIBHTTPREQUEST* pRequest, const char* hdr)
@@ -64,7 +64,7 @@ public:
return true;
}
- virtual bool ReadResponce(tstring &rsResponce)const
+ virtual bool ReadResponce(tstring &rsResponce) const
{
if (true == m_aURL.empty())
return false;
@@ -138,7 +138,7 @@ bool CHTTPSession::OpenURL(const tstring& rsURL)
return m_pImpl->OpenURL(rsURL);
}
-bool CHTTPSession::ReadResponce(tstring& rsResponce)const
+bool CHTTPSession::ReadResponce(tstring& rsResponce) const
{
return m_pImpl->ReadResponce(rsResponce);
}
diff --git a/plugins/CurrencyRates/src/HTTPSession.h b/plugins/CurrencyRates/src/HTTPSession.h
index ba28a1493c..e4b434eaec 100644
--- a/plugins/CurrencyRates/src/HTTPSession.h
+++ b/plugins/CurrencyRates/src/HTTPSession.h
@@ -10,7 +10,7 @@ public:
static bool Init();
bool OpenURL(const tstring& rsURL);
- bool ReadResponce(tstring& rsResponce)const;
+ bool ReadResponce(tstring& rsResponce) const;
public:
diff --git a/plugins/CurrencyRates/src/ICurrencyRatesProvider.h b/plugins/CurrencyRates/src/ICurrencyRatesProvider.h
index cbdb467bf5..174cef1148 100644
--- a/plugins/CurrencyRates/src/ICurrencyRatesProvider.h
+++ b/plugins/CurrencyRates/src/ICurrencyRatesProvider.h
@@ -5,6 +5,15 @@
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:
@@ -12,7 +21,6 @@ public:
{
tstring m_sName;
tstring m_sURL;
-
};
public:
@@ -20,20 +28,22 @@ public:
virtual ~ICurrencyRatesProvider() {}
virtual bool Init() = 0;
- virtual const CProviderInfo& GetInfo()const = 0;
+ virtual const CProviderInfo& GetInfo() const = 0;
virtual void AddContact(MCONTACT hContact) = 0;
virtual void DeleteContact(MCONTACT hContact) = 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 SetContactExtraIcon(MCONTACT hContact)const = 0;
- virtual void Run() = 0;
+ virtual void FillFormat(TFormatSpecificators&) const = 0;
- virtual void Accept(CCurrencyRatesProviderVisitor& visitor)const = 0;
+ virtual void Run() = 0;
+
+ virtual void Accept(CCurrencyRatesProviderVisitor &visitor) const = 0;
};
#endif //__ac71e133_786c_41a7_ab07_625b76ff2a8c_CurrencyRatesProvider_h__
diff --git a/plugins/CurrencyRates/src/IHTMLEngine.h b/plugins/CurrencyRates/src/IHTMLEngine.h
index 48a35b0255..6cc9defce7 100644
--- a/plugins/CurrencyRates/src/IHTMLEngine.h
+++ b/plugins/CurrencyRates/src/IHTMLEngine.h
@@ -12,7 +12,7 @@ public:
IHTMLEngine(void){}
virtual ~IHTMLEngine() {}
- virtual THTMLParserPtr GetParserPtr()const = 0;
+ virtual THTMLParserPtr GetParserPtr() const = 0;
};
#endif //__85dbfa97_919b_4776_919c_7410a1c3d787_HTMLEngine_h__
diff --git a/plugins/CurrencyRates/src/IHTMLParser.h b/plugins/CurrencyRates/src/IHTMLParser.h
index 5756079eed..c0b97a7277 100644
--- a/plugins/CurrencyRates/src/IHTMLParser.h
+++ b/plugins/CurrencyRates/src/IHTMLParser.h
@@ -17,14 +17,14 @@ public:
IHTMLNode() {}
virtual ~IHTMLNode() {}
- virtual size_t GetChildCount()const = 0;
+ virtual size_t GetChildCount() const = 0;
virtual THTMLNodePtr GetChildPtr(size_t nIndex) = 0;
- virtual bool Is(EType nType)const = 0;
+ virtual bool Is(EType nType) const = 0;
- virtual THTMLNodePtr GetElementByID(const tstring& rsID)const = 0;
+ virtual THTMLNodePtr GetElementByID(const tstring& rsID) const = 0;
- virtual tstring GetAttribute(const tstring& rsAttrName)const = 0;
- virtual tstring GetText()const = 0;
+ virtual tstring GetAttribute(const tstring& rsAttrName) const = 0;
+ virtual tstring GetText() const = 0;
};
class IHTMLParser
diff --git a/plugins/CurrencyRates/src/SettingsDlg.cpp b/plugins/CurrencyRates/src/SettingsDlg.cpp
index fe4a3102bc..93f8b72e7a 100644
--- a/plugins/CurrencyRates/src/SettingsDlg.cpp
+++ b/plugins/CurrencyRates/src/SettingsDlg.cpp
@@ -666,12 +666,12 @@ CAdvProviderSettings::~CAdvProviderSettings()
delete m_pPopupSettings;
}
-const ICurrencyRatesProvider* CAdvProviderSettings::GetProviderPtr()const
+const ICurrencyRatesProvider* CAdvProviderSettings::GetProviderPtr() const
{
return m_pCurrencyRatesProvider;
}
-void CAdvProviderSettings::SaveToDb()const
+void CAdvProviderSettings::SaveToDb() const
{
db_set_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_LogMode, m_wLogMode);
db_set_ws(0, CURRENCYRATES_MODULE_NAME, DB_KEY_HistoryFormat, m_sFormatHistory.c_str());
@@ -692,7 +692,7 @@ void CAdvProviderSettings::SaveToDb()const
}
}
-WORD CAdvProviderSettings::GetLogMode()const
+WORD CAdvProviderSettings::GetLogMode() const
{
return m_wLogMode;
}
@@ -702,7 +702,7 @@ void CAdvProviderSettings::SetLogMode(WORD wMode)
m_wLogMode = wMode;
}
-tstring CAdvProviderSettings::GetHistoryFormat()const
+tstring CAdvProviderSettings::GetHistoryFormat() const
{
return m_sFormatHistory;
}
@@ -712,7 +712,7 @@ void CAdvProviderSettings::SetHistoryFormat(const tstring& rsFormat)
m_sFormatHistory = rsFormat;
}
-bool CAdvProviderSettings::GetHistoryOnlyChangedFlag()const
+bool CAdvProviderSettings::GetHistoryOnlyChangedFlag() const
{
return m_bIsOnlyChangedHistory;
}
@@ -722,7 +722,7 @@ void CAdvProviderSettings::SetHistoryOnlyChangedFlag(bool bMode)
m_bIsOnlyChangedHistory = bMode;
}
-tstring CAdvProviderSettings::GetLogFileName()const
+tstring CAdvProviderSettings::GetLogFileName() const
{
return m_sLogFileName;
}
@@ -732,7 +732,7 @@ void CAdvProviderSettings::SetLogFileName(const tstring& rsFile)
m_sLogFileName = rsFile;
}
-tstring CAdvProviderSettings::GetLogFormat()const
+tstring CAdvProviderSettings::GetLogFormat() const
{
return m_sFormatLogFile;
}
@@ -742,7 +742,7 @@ void CAdvProviderSettings::SetLogFormat(const tstring& rsFormat)
m_sFormatLogFile = rsFormat;
}
-bool CAdvProviderSettings::GetLogOnlyChangedFlag()const
+bool CAdvProviderSettings::GetLogOnlyChangedFlag() const
{
return m_bIsOnlyChangedLogFile;
}
@@ -772,7 +772,7 @@ void CAdvProviderSettings::SetShowPopupIfValueChangedFlag(bool val)
m_bShowPopupIfValueChanged = val;
}
-CPopupSettings* CAdvProviderSettings::GetPopupSettingsPtr()const
+CPopupSettings* CAdvProviderSettings::GetPopupSettingsPtr() const
{
if (nullptr == m_pPopupSettings)
m_pPopupSettings = new CPopupSettings();
@@ -837,7 +837,7 @@ void CPopupSettings::InitForContact(MCONTACT hContact)
m_bUseHistory = 1 == db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_HISTORY_FLAG, m_bUseHistory);
}
-void CPopupSettings::SaveForContact(MCONTACT hContact)const
+void CPopupSettings::SaveForContact(MCONTACT hContact) const
{
db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour));
db_set_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_BK, m_rgbBkg);
@@ -847,7 +847,7 @@ void CPopupSettings::SaveForContact(MCONTACT hContact)const
db_set_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_HISTORY_FLAG, m_bUseHistory);
}
-CPopupSettings::EColourMode CPopupSettings::GetColourMode()const
+CPopupSettings::EColourMode CPopupSettings::GetColourMode() const
{
return m_modeColour;
}
@@ -857,7 +857,7 @@ void CPopupSettings::SetColourMode(EColourMode nMode)
m_modeColour = nMode;
}
-COLORREF CPopupSettings::GetColourBk()const
+COLORREF CPopupSettings::GetColourBk() const
{
return m_rgbBkg;
}
@@ -867,7 +867,7 @@ void CPopupSettings::SetColourBk(COLORREF rgb)
m_rgbBkg = rgb;
}
-COLORREF CPopupSettings::GetColourText()const
+COLORREF CPopupSettings::GetColourText() const
{
return m_rgbText;
}
@@ -877,7 +877,7 @@ void CPopupSettings::SetColourText(COLORREF rgb)
m_rgbText = rgb;
}
-CPopupSettings::EDelayMode CPopupSettings::GetDelayMode()const
+CPopupSettings::EDelayMode CPopupSettings::GetDelayMode() const
{
return m_modeDelay;
}
@@ -887,7 +887,7 @@ void CPopupSettings::SetDelayMode(EDelayMode nMode)
m_modeDelay = nMode;
}
-WORD CPopupSettings::GetDelayTimeout()const
+WORD CPopupSettings::GetDelayTimeout() const
{
return m_wDelay;
}
@@ -897,7 +897,7 @@ void CPopupSettings::SetDelayTimeout(WORD delay)
m_wDelay = delay;
}
-bool CPopupSettings::GetHistoryFlag()const
+bool CPopupSettings::GetHistoryFlag() const
{
return m_bUseHistory;
}
diff --git a/plugins/CurrencyRates/src/SettingsDlg.h b/plugins/CurrencyRates/src/SettingsDlg.h
index 95667c8434..1a02474e9c 100644
--- a/plugins/CurrencyRates/src/SettingsDlg.h
+++ b/plugins/CurrencyRates/src/SettingsDlg.h
@@ -24,24 +24,24 @@ public:
static COLORREF GetDefColourText();
void InitForContact(MCONTACT hContact);
- void SaveForContact(MCONTACT hContact)const;
+ void SaveForContact(MCONTACT hContact) const;
- EColourMode GetColourMode()const;
+ EColourMode GetColourMode() const;
void SetColourMode(EColourMode nMode);
- COLORREF GetColourBk()const;
+ COLORREF GetColourBk() const;
void SetColourBk(COLORREF rgb);
- COLORREF GetColourText()const;
+ COLORREF GetColourText() const;
void SetColourText(COLORREF rgb);
- EDelayMode GetDelayMode()const;
+ EDelayMode GetDelayMode() const;
void SetDelayMode(EDelayMode nMode);
- WORD GetDelayTimeout()const;
+ WORD GetDelayTimeout() const;
void SetDelayTimeout(WORD delay);
- bool GetHistoryFlag()const;
+ bool GetHistoryFlag() const;
void SetHistoryFlag(bool flag);
private:
@@ -60,22 +60,22 @@ public:
CAdvProviderSettings(const ICurrencyRatesProvider* pCurrencyRatesProvider);
~CAdvProviderSettings();
- void SaveToDb()const;
+ void SaveToDb() const;
- const ICurrencyRatesProvider* GetProviderPtr()const;
+ const ICurrencyRatesProvider* GetProviderPtr() const;
- WORD GetLogMode()const;
+ WORD GetLogMode() const;
void SetLogMode(WORD wMode);
- tstring GetHistoryFormat()const;
+ tstring GetHistoryFormat() const;
void SetHistoryFormat(const tstring& rsFormat);
- bool GetHistoryOnlyChangedFlag()const;
+ bool GetHistoryOnlyChangedFlag() const;
void SetHistoryOnlyChangedFlag(bool bMode);
- tstring GetLogFileName()const;
+ tstring GetLogFileName() const;
void SetLogFileName(const tstring& rsFile);
- tstring GetLogFormat()const;
+ tstring GetLogFormat() const;
void SetLogFormat(const tstring& rsFormat);
- bool GetLogOnlyChangedFlag()const;
+ bool GetLogOnlyChangedFlag() const;
void SetLogOnlyChangedFlag(bool bMode);
const tstring& GetPopupFormat() const;
@@ -84,7 +84,7 @@ public:
bool GetShowPopupIfValueChangedFlag() const;
void SetShowPopupIfValueChangedFlag(bool val);
- CPopupSettings* GetPopupSettingsPtr()const;
+ CPopupSettings* GetPopupSettingsPtr() const;
private:
const ICurrencyRatesProvider* m_pCurrencyRatesProvider;
diff --git a/plugins/CurrencyRates/src/WinCtrlHelper.cpp b/plugins/CurrencyRates/src/WinCtrlHelper.cpp
index 1b2daf3cb7..0d00422146 100644
--- a/plugins/CurrencyRates/src/WinCtrlHelper.cpp
+++ b/plugins/CurrencyRates/src/WinCtrlHelper.cpp
@@ -14,12 +14,12 @@ public:
bool OnInitDialog() override
{
- CCurrencyRatesProviderVisitorFormatSpecificator visitor;
- m_pProvider->Accept(visitor);
+ TFormatSpecificators aSpecificators;
+ m_pProvider->FillFormat(aSpecificators);
tostringstream o;
- for (auto &spec : visitor.GetSpecificators())
- o << spec.m_sSymbol << '\t' << spec.m_sDesc << L"\r\n";
+ for (auto &spec : aSpecificators)
+ o << spec.first << '\t' << spec.second << L"\r\n";
::SetDlgItemText(m_hwnd, IDC_EDIT_VARIABLE, o.str().c_str());
return true;
}
diff --git a/plugins/CurrencyRates/src/stdafx.h b/plugins/CurrencyRates/src/stdafx.h
index 9efc929760..6aa8daef76 100644
--- a/plugins/CurrencyRates/src/stdafx.h
+++ b/plugins/CurrencyRates/src/stdafx.h
@@ -100,7 +100,7 @@ inline tstring currencyrates_a2t(const char* s)
#include "CurrencyRatesProviderVisitor.h"
#include "CurrencyRatesProviderVisitorFormater.h"
#include "CurrencyRatesProviderVisitorTendency.h"
-#include "CurrencyRatesProviderVisitorFormatSpecificator.h"
+
#define CHART_IMPLEMENT
#ifdef CHART_IMPLEMENT
#include "CurrencyRateChart.h"
diff --git a/plugins/CurrencyRates/src/version.h b/plugins/CurrencyRates/src/version.h
index c0cc293fb1..cd73fb3f68 100644
--- a/plugins/CurrencyRates/src/version.h
+++ b/plugins/CurrencyRates/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>