Index: src/ch/TConfig.h =================================================================== diff -u -r9ea1e103b5fa4ddfebf8028f121ce16e917eec04 -r1d7d79169d480a02e335b8b0a4919f9c78d58325 --- src/ch/TConfig.h (.../TConfig.h) (revision 9ea1e103b5fa4ddfebf8028f121ce16e917eec04) +++ src/ch/TConfig.h (.../TConfig.h) (revision 1d7d79169d480a02e335b8b0a4919f9c78d58325) @@ -29,6 +29,7 @@ #include #pragma warning(pop) +// class defines configuration change notification record; not to be used outside class TConfigNotifier { public: @@ -46,18 +47,29 @@ void* m_pParam; }; +// class for handling configuration settings class TConfig { public: TConfig(); + TConfig(const TConfig& rSrc); ~TConfig(); + TConfig& operator=(const TConfig& rSrc); + + void Clear(); + // read/write void Read(const CString& strFile); - void Write(); + void Write(bool bOnlyIfModified = false); - void Clear(); + void SetFilePath(const CString& strPath); + // Modifications management + bool IsModified() const; + void MarkAsModified(); + void MarkAsNotModified(); + // value setting/retrieval bool GetBool(PCTSTR pszPropName, bool bDefault) const; bool GetValue(PCTSTR pszPropName, bool& bValue, bool bDefault) const; @@ -93,6 +105,7 @@ // extraction of subtrees void ExtractSubConfig(PCTSTR pszSubTreeName, TConfig& rSubConfig) const; + void PutSubConfig(PCTSTR pszSubTreeName, const TConfig& rSubConfig); // property change notification void ConnectToNotifier(void (*pfnCallback)(const std::set&, void*), void* pParam); @@ -105,6 +118,8 @@ void SendNotification(const std::set& rsetInfo); void SendNotification(PCTSTR pszInfo); + void ClearNL(); + private: boost::property_tree::wiptree m_propTree; CString m_strFilePath; @@ -113,6 +128,8 @@ std::set m_setDelayedNotifications; bool m_bDelayedEnabled; + bool m_bModified; ///< Modification state - cleared when saving + mutable boost::shared_mutex m_lock; };