summaryrefslogtreecommitdiff
path: root/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp')
-rw-r--r--plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp
new file mode 100644
index 0000000000..b9ed9a9d94
--- /dev/null
+++ b/plugins/CurrencyRates/src/CurrencyRatesProviderVisitorTendency.cpp
@@ -0,0 +1,24 @@
+#include "stdafx.h"
+
+CCurrencyRatesProviderVisitorTendency::CCurrencyRatesProviderVisitorTendency(MCONTACT hContact, wchar_t chr)
+ : m_hContact(hContact), m_chr(chr), m_bValid(false), m_dResult(0.0)
+{
+}
+
+void CCurrencyRatesProviderVisitorTendency::Visit(const CCurrencyRatesProviderBase&)
+{
+ switch (m_chr) {
+ case 'r':
+ case 'R':
+ GetValue(DB_STR_CURRENCYRATE_CURR_VALUE);
+ break;
+ case 'p':
+ GetValue(DB_STR_CURRENCYRATE_PREV_VALUE);
+ break;
+ }
+}
+
+void CCurrencyRatesProviderVisitorTendency::GetValue(LPCSTR pszDbKeyName)
+{
+ m_bValid = CurrencyRates_DBReadDouble(m_hContact, CURRENCYRATES_MODULE_NAME, pszDbKeyName, m_dResult);
+}