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

Delta Between Two Patch Sets: src/plugin/PluginIniFile.h

Issue 11013110: Cleanup (Closed)
Left Patch Set: SetPref/GetPref type safety. Comments addressed. Created July 22, 2013, 12:42 a.m.
Right Patch Set: More beautification and addressing comments Created July 29, 2013, 12:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginHttpRequest.cpp ('k') | src/plugin/PluginIniFile.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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_
LEFTRIGHT

Powered by Google App Engine
This is Rietveld