Index: src/ch/ClipboardMonitor.cpp =================================================================== diff -u -N -r2b67cda63fcaa69c7838641d33198e10f37af9e1 -rbeeac49d2e0888993bd231a4e5863c7f0741e154 --- src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision 2b67cda63fcaa69c7838641d33198e10f37af9e1) +++ src/ch/ClipboardMonitor.cpp (.../ClipboardMonitor.cpp) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) @@ -105,7 +105,7 @@ LONG lFinished=0; bool bEnd=false; - chcore::TCoreConfig& rConfig = chcore::TCoreConfig::Acquire(); + icpf::config& rConfig = GetConfig(); for(;;) { if (uiCounter == 0 && rConfig.get_bool(PP_PCLIPBOARDMONITORING) && IsClipboardFormatAvailable(CF_HDROP)) Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -r2b67cda63fcaa69c7838641d33198e10f37af9e1 -rbeeac49d2e0888993bd231a4e5863c7f0741e154 --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 2b67cda63fcaa69c7838641d33198e10f37af9e1) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) @@ -222,7 +222,7 @@ pDlg->m_bAutoDelete = true; pDlg->Create(); - chcore::TCoreConfig& rConfig = GetConfig(); + icpf::config& rConfig = GetConfig(); try { rConfig.set_unsigned_num(PP_LAST_UPDATE_TIMESTAMP, _time64(NULL)); Index: src/ch/ch.cpp =================================================================== diff -u -N -r2457755b4084e3d1c80a8e7c77c9f0996312941b -rbeeac49d2e0888993bd231a4e5863c7f0741e154 --- src/ch/ch.cpp (.../ch.cpp) (revision 2457755b4084e3d1c80a8e7c77c9f0996312941b) +++ src/ch/ch.cpp (.../ch.cpp) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) @@ -36,6 +36,8 @@ static char THIS_FILE[] = __FILE__; #endif +icpf::config CCopyHandlerApp::m_config = icpf::config::eIni; + ///////////////////////////////////////////////////////////////////////////// // CCopyHandlerApp @@ -123,9 +125,9 @@ return ictranslate::CResourceManager::Acquire(); } -chcore::TCoreConfig& GetConfig() +icpf::config& GetConfig() { - return chcore::TCoreConfig::Acquire(); + return CCopyHandlerApp::m_config; } int MsgBox(UINT uiID, UINT nType, UINT nIDHelp) @@ -228,20 +230,21 @@ strCfgPath = strPath + _T("\\ch.ini"); // initialize configuration file - chcore::TCoreConfig& rConfig = chcore::TCoreConfig::Acquire(); - rConfig.set_callback(ConfigPropertyChangedCallback, NULL); + m_config.set_callback(ConfigPropertyChangedCallback, NULL); // read the configuration try { - rConfig.read(strCfgPath); + m_config.read(strCfgPath); } catch(...) { } // set working dir for the engine - rConfig.SetBasePath(strPath); + icpf::config& rConfig = GetConfig(); + +// rConfig.SetBasePath(strPath); // register all properties RegisterProperties(&rConfig); @@ -252,8 +255,8 @@ chcore::TLogger& rLogger = chcore::TLogger::Acquire(); try { - rLogger.init(strLogPath, (int_t)rConfig.get_signed_num(PP_LOGMAXSIZE), (int_t)rConfig.get_unsigned_num(PP_LOGLEVEL), false, false); - rLogger.Enable(rConfig.get_bool(PP_LOGENABLELOGGING)); + rLogger.init(strLogPath, (int_t)m_config.get_signed_num(PP_LOGMAXSIZE), (int_t)rConfig.get_unsigned_num(PP_LOGLEVEL), false, false); + rLogger.Enable(m_config.get_bool(PP_LOGENABLELOGGING)); } catch(...) { Index: src/ch/ch.h =================================================================== diff -u -N -r2457755b4084e3d1c80a8e7c77c9f0996312941b -rbeeac49d2e0888993bd231a4e5863c7f0741e154 --- src/ch/ch.h (.../ch.h) (revision 2457755b4084e3d1c80a8e7c77c9f0996312941b) +++ src/ch/ch.h (.../ch.h) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) @@ -56,7 +56,7 @@ friend LRESULT MainRouter(ULONGLONG ullDst, UINT uiMsg, WPARAM wParam, LPARAM lParam); friend CCopyHandlerApp& GetApp(); friend ictranslate::CResourceManager& GetResManager(); - friend chcore::TCoreConfig& GetConfig(); + friend icpf::config& GetConfig(); bool IsShellExtEnabled() const; @@ -70,6 +70,7 @@ protected: HANDLE m_hMapObject; IShellExtControl* m_piShellExtControl; + static icpf::config m_config; CWnd *m_pMainWindow; Index: src/libchcore/TCoreConfig.cpp =================================================================== diff -u -N -r2457755b4084e3d1c80a8e7c77c9f0996312941b -rbeeac49d2e0888993bd231a4e5863c7f0741e154 --- src/libchcore/TCoreConfig.cpp (.../TCoreConfig.cpp) (revision 2457755b4084e3d1c80a8e7c77c9f0996312941b) +++ src/libchcore/TCoreConfig.cpp (.../TCoreConfig.cpp) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) @@ -23,25 +23,36 @@ BEGIN_CHCORE_NAMESPACE -TCoreConfig TCoreConfig::S_Config = icpf::config::eIni; +TCoreConfig TCoreConfig::S_Config; -TCoreConfig::TCoreConfig(icpf::config::config_base_types eType) : - icpf::config(eType) +// ============================================================================ +/// chcore::TCoreConfig::TCoreConfig +/// @date 2009/11/30 +/// +/// @brief Constructs the core configuration object. +// ============================================================================ +TCoreConfig::TCoreConfig() : + m_config(icpf::config::eIni) { } +// ============================================================================ +/// chcore::TCoreConfig::~TCoreConfig +/// @date 2009/11/30 +/// +/// @brief Destructs the core configuration object. +// ============================================================================ TCoreConfig::~TCoreConfig() { } -void TCoreConfig::SetBasePath(const tchar_t* pszPath) -{ - if(!pszPath) - THROW(_T("Invalid argument"), 0, 0, 0); - m_strBasePath = pszPath; - m_strTasksPath = m_strBasePath + _T("\\tasks\\"); -} - +// ============================================================================ +/// chcore::TCoreConfig::Acquire +/// @date 2009/11/30 +/// +/// @brief Acquires reference to core config. +/// @return Reference to core config. +// ============================================================================ TCoreConfig& TCoreConfig::Acquire() { return S_Config; Index: src/libchcore/TCoreConfig.h =================================================================== diff -u -N -r2457755b4084e3d1c80a8e7c77c9f0996312941b -rbeeac49d2e0888993bd231a4e5863c7f0741e154 --- src/libchcore/TCoreConfig.h (.../TCoreConfig.h) (revision 2457755b4084e3d1c80a8e7c77c9f0996312941b) +++ src/libchcore/TCoreConfig.h (.../TCoreConfig.h) (revision beeac49d2e0888993bd231a4e5863c7f0741e154) @@ -27,23 +27,17 @@ // contains everything that could be configured inside the engine. // supports both the informations contained in the ini file and // ones related to current instance of CH core -class LIBCHCORE_API TCoreConfig : public icpf::config +class LIBCHCORE_API TCoreConfig { protected: - TCoreConfig(icpf::config::config_base_types eType); + TCoreConfig(); virtual ~TCoreConfig(); public: static TCoreConfig& Acquire(); - // paths handling - void SetBasePath(const tchar_t* pszPath); - const tchar_t* GetBasePath() { return m_strBasePath.c_str(); } - const tchar_t* GetTasksPath() { return m_strTasksPath.c_str(); } - private: - tstring_t m_strBasePath; - tstring_t m_strTasksPath; + icpf::config m_config; static TCoreConfig S_Config; };