From a70382b0e8bed265a1d314d9f6aae8f2dd48d20b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 28 Nov 2012 18:45:54 +0000 Subject: ex-protos moved to the Plugins folder git-svn-id: http://svn.miranda-ng.org/main/trunk@2545 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../Quotes/src/QuotesProviderVisitorTendency.cpp | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 plugins/Quotes/src/QuotesProviderVisitorTendency.cpp (limited to 'plugins/Quotes/src/QuotesProviderVisitorTendency.cpp') diff --git a/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp new file mode 100644 index 0000000000..00703521b3 --- /dev/null +++ b/plugins/Quotes/src/QuotesProviderVisitorTendency.cpp @@ -0,0 +1,70 @@ +#include "stdafx.h" +#include "QuotesProviderVisitorTendency.h" +#include "DBUtils.h" +#include "QuotesProviderGoogleFinance.h" +#include "EconomicRateInfo.h" +#include "QuotesProviderYahoo.h" + +CQuotesProviderVisitorTendency::CQuotesProviderVisitorTendency(HANDLE hContact,TCHAR chr) + : m_hContact(hContact),m_chr(chr),m_bValid(false),m_dResult(0.0) +{ +} + +void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderBase& rProvider) +{ + switch(m_chr) + { + case _T('r'): + case _T('R'): + GetValue(DB_STR_QUOTE_CURR_VALUE); + break; + case _T('p'): + GetValue(DB_STR_QUOTE_PREV_VALUE); + break; + } +} + +void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderGoogleFinance& rProvider) +{ + switch(m_chr) + { + case _T('o'): + GetValue(DB_STR_GOOGLE_FINANCE_OPEN_VALUE); + break; + case _T('d'): + GetValue(DB_STR_GOOGLE_FINANCE_DIFF); + break; + case _T('y'): + GetValue(DB_STR_GOOGLE_FINANCE_PERCENT_CHANGE_TO_YERSTERDAY_CLOSE); + break; + } +} + +void CQuotesProviderVisitorTendency::Visit(const CQuotesProviderYahoo& rProvider) +{ + switch(m_chr) + { + case _T('o'): + GetValue(DB_STR_YAHOO_OPEN_VALUE); + break; + case _T('h'): + GetValue(DB_STR_YAHOO_DAY_HIGH); + break; + case _T('P'): + GetValue(DB_STR_YAHOO_PREVIOUS_CLOSE); + break; + case _T('c'): + GetValue(DB_STR_YAHOO_CHANGE); + break; + case _T('g'): + GetValue(DB_STR_YAHOO_DAY_LOW); + break; + } + +} + + +void CQuotesProviderVisitorTendency::GetValue(LPCSTR pszDbKeyName) +{ + m_bValid = Quotes_DBReadDouble(m_hContact,QUOTES_MODULE_NAME,pszDbKeyName,m_dResult); +} -- cgit v1.2.3