forked from epsylon3/odbgscript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IniReader.h
65 lines (50 loc) · 1.65 KB
/
IniReader.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// IniReader.h: interface for the CIniReader class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_INIFILE_H__99976B4B_DBA1_4D1E_AA14_CBEB63042FD1__INCLUDED_)
#define AFX_INIFILE_H__99976B4B_DBA1_4D1E_AA14_CBEB63042FD1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <afx.h>
class CIniReader
{
public:
// method to set INI file name, if not already specified
void setINIFileName(CString strINIFile);
// methods to return the lists of section data and section names
CStringList* getSectionData(CString strSection);
CStringList* getSectionNames();
// check if the section exists in the file
BOOL sectionExists(CString strSection);
// updates the key value, if key already exists, else creates a key-value pair
long setKey(CString strValue, CString strKey, CString strSection);
// give the key value for the specified key of a section
CString getKeyValue(CString strKey,CString strSection);
// default constructor
CIniReader()
{
m_sectionList = new CStringList();
m_sectionDataList = new CStringList();
}
CIniReader(CString strFile)
{
m_strFileName = strFile;
m_sectionList = new CStringList();
m_sectionDataList = new CStringList();
}
~CIniReader()
{
delete m_sectionList;
delete m_sectionDataList;
}
private:
// lists to keep sections and section data
CStringList *m_sectionDataList;
CStringList *m_sectionList;
CString m_strSection;
long m_lRetValue;
// ini file name
CString m_strFileName;
};
#endif // !defined(AFX_INIFILE_H__99976B4B_DBA1_4D1E_AA14_CBEB63042FD1__INCLUDED_)