| LEFT | RIGHT |
| (no file at all) | |
| 1 #ifndef _PLUGIN_INI_FILE_W_H_ | |
| 2 #define _PLUGIN_INI_FILE_W_H_ | |
| 3 | |
| 4 #if _MSC_VER > 1000 | |
| 5 #pragma once | |
| 6 #endif // _MSC_VER > 1000 | |
| 7 | |
| 8 | |
| 9 class CPluginChecksum; | |
| 10 | |
| 11 | |
| 12 class CPluginIniFileW | |
| 13 { | |
| 14 | |
| 15 public: | |
| 16 | |
| 17 typedef std::map<CStringW, CStringW> TSectionData; | |
| 18 typedef std::set<CStringW> TSectionNames; | |
| 19 | |
| 20 CPluginIniFileW(const CString& filename, bool hasChecksum=false); | |
| 21 | |
| 22 CString GetFilePath() const; | |
| 23 | |
| 24 void Clear(); | |
| 25 bool Read(); | |
| 26 bool ReadString(const CStringW& memFile); | |
| 27 bool Write(); | |
| 28 bool Exists(); | |
| 29 | |
| 30 // methods to return the lists of section data and section names | |
| 31 CPluginIniFileW::TSectionData GetSectionData(const CStringW& section) const; | |
| 32 | |
| 33 const CPluginIniFileW::TSectionNames& GetSectionNames() const; | |
| 34 | |
| 35 void SetInitialChecksumString(const CString& str); | |
| 36 bool IsValidChecksum() const; | |
| 37 | |
| 38 // check if the section exists in the file | |
| 39 bool HasSection(const CStringW& section) const; | |
| 40 bool HasKey(const CStringW& section, const CStringW& key) const; | |
| 41 | |
| 42 // updates the key value, if key already exists, else creates a key-value pair | |
| 43 bool SetValue(const CStringW& section, const CStringW& key, const CStringW& va
lue); | |
| 44 bool SetValue(const CStringW& section, const CStringW& key, int value); | |
| 45 | |
| 46 void UpdateSection(const CStringW& section, const CPluginIniFileW::TSectionDat
a& data); | |
| 47 | |
| 48 // give the value for the specified key of a section | |
| 49 CStringW GetValue(const CStringW& section, const CStringW& key) const; | |
| 50 | |
| 51 unsigned int GetLastError() const; | |
| 52 | |
| 53 private: | |
| 54 | |
| 55 typedef std::map<CStringW, CPluginIniFileW::TSectionData> TData; | |
| 56 | |
| 57 CString m_filename; | |
| 58 bool m_isDirty; | |
| 59 bool m_isValidChecksum; | |
| 60 bool m_hasChecksum; | |
| 61 unsigned int m_lastError; | |
| 62 | |
| 63 CString m_checksumInit; | |
| 64 CPluginIniFileW::TData m_data; | |
| 65 CPluginIniFileW::TSectionNames m_sectionNames; | |
| 66 | |
| 67 std::auto_ptr<CPluginChecksum> m_checksum; | |
| 68 }; | |
| 69 | |
| 70 | |
| 71 #endif // _PLUGIN_INI_FILE_W_H_ | |
| LEFT | RIGHT |