Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginIniFile.h

Issue 11013110: Cleanup (Closed)
Patch Set: Minor CallEngine refactoring Created July 26, 2013, 2:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #ifndef _PLUGIN_INI_FILE_H_
2 #define _PLUGIN_INI_FILE_H_
3
4
5 class CPluginChecksum;
6
7
8 class CPluginIniFile
9 {
10
11 public:
12
13 typedef std::map<CStringA, CStringA> TSectionData;
14 typedef std::set<CStringA> TSectionNames;
15
16 CPluginIniFile(const CString& filename, bool hasChecksum=false);
17
18 CString GetFilePath() const;
19
20 void Clear();
21 bool Exists();
22 bool Read();
23 bool ReadString(const CStringA& memFile);
24 bool Write();
25
26 // methods to return the lists of section data and section names
27 CPluginIniFile::TSectionData GetSectionData(const CStringA& section) const;
28
29 const CPluginIniFile::TSectionNames& GetSectionNames() const;
30
31 void SetInitialChecksumString(const CString& str);
32 bool IsValidChecksum() const;
33
34 // check if the section exists in the file
35 bool HasSection(const CStringA& section) const;
36 bool HasKey(const CStringA& section, const CStringA& key) const;
37
38 // updates the key value, if key already exists, else creates a key-value pair
39 bool SetValue(const CStringA& section, const CStringA& key, const CStringA& va lue);
40 bool SetValue(const CStringA& section, const CStringA& key, int value);
41
42 void UpdateSection(const CStringA& section, const CPluginIniFile::TSectionData & data);
43
44 // give the value for the specified key of a section
45 CStringA GetValue(const CStringA& section, const CStringA& key) const;
46
47 unsigned int GetLastError() const;
48
49 private:
50
51 typedef std::map<CStringA, CPluginIniFile::TSectionData> TData;
52
53 CString m_filename;
54 bool m_isDirty;
55 bool m_isValidChecksum;
56 bool m_hasChecksum;
57 unsigned int m_lastError;
58
59 CString m_checksumInit;
60 CPluginIniFile::TData m_data;
61 CPluginIniFile::TSectionNames m_sectionNames;
62
63 std::auto_ptr<CPluginChecksum> m_checksum;
64 };
65
66 #endif // _PLUGIN_INI_FILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld