diff options
Diffstat (limited to 'plugins/CurrencyRates/src/ModuleInfo.cpp')
-rw-r--r-- | plugins/CurrencyRates/src/ModuleInfo.cpp | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/plugins/CurrencyRates/src/ModuleInfo.cpp b/plugins/CurrencyRates/src/ModuleInfo.cpp index a44eda3d78..069f902238 100644 --- a/plugins/CurrencyRates/src/ModuleInfo.cpp +++ b/plugins/CurrencyRates/src/ModuleInfo.cpp @@ -1,34 +1,23 @@ #include "StdAfx.h" -static CModuleInfo::TXMLEnginePtr g_pXMLEngine; +static CModuleInfo mi; static CModuleInfo::THTMLEnginePtr g_pHTMLEngine; static mir_cs g_lmParsers; -CModuleInfo::CModuleInfo() -{ -} - -CModuleInfo::~CModuleInfo() -{ -} - -CModuleInfo& CModuleInfo::GetInstance() -{ - static CModuleInfo mi; - return mi; -} +typedef std::map<std::string, MWindowList> THandles; +static THandles g_ahWindowLists; MWindowList CModuleInfo::GetWindowList(const std::string& rsKey, bool bAllocateIfNonExist /*= true*/) { MWindowList hResult = nullptr; - THandles::const_iterator i = m_ahWindowLists.find(rsKey); - if (i != m_ahWindowLists.end()) { + THandles::const_iterator i = g_ahWindowLists.find(rsKey); + if (i != g_ahWindowLists.end()) { hResult = i->second; } else if (bAllocateIfNonExist) { hResult = WindowList_Create(); if (hResult) - m_ahWindowLists.insert(std::make_pair(rsKey, hResult)); + g_ahWindowLists.insert(std::make_pair(rsKey, hResult)); } return hResult; @@ -36,7 +25,7 @@ MWindowList CModuleInfo::GetWindowList(const std::string& rsKey, bool bAllocateI void CModuleInfo::OnMirandaShutdown() { - BOOST_FOREACH(THandles::value_type p, m_ahWindowLists) + BOOST_FOREACH(THandles::value_type p, g_ahWindowLists) { WindowList_Broadcast(p.second, WM_CLOSE, 0, 0); } @@ -48,17 +37,6 @@ CModuleInfo::TCurrencyRatesProvidersPtr CModuleInfo::GetCurrencyRateProvidersPtr return pProviders; } -CModuleInfo::TXMLEnginePtr CModuleInfo::GetXMLEnginePtr() -{ - if (!g_pXMLEngine) { - mir_cslock lck(g_lmParsers); - if (!g_pXMLEngine) - g_pXMLEngine = TXMLEnginePtr(new CXMLEngineMI); - } - - return g_pXMLEngine; -} - CModuleInfo::THTMLEnginePtr CModuleInfo::GetHTMLEngine() { if (!g_pHTMLEngine) { @@ -83,11 +61,6 @@ bool CModuleInfo::Verify() if (FALSE == ::InitCommonControlsEx(&icc)) return false; - if (!GetXMLEnginePtr()) { - CurrencyRates_MessageBox(nullptr, TranslateT("Miranda could not load CurrencyRates plugin. XML parser is missing."), MB_OK | MB_ICONERROR); - return false; - } - if (!g_pHTMLEngine && (false == CHTMLParserMS::IsInstalled())) { CurrencyRates_MessageBox(nullptr, TranslateT("Miranda could not load CurrencyRates plugin. Microsoft HTML parser is missing."), @@ -96,4 +69,4 @@ bool CModuleInfo::Verify() } return true; -}
\ No newline at end of file +} |