-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.h
53 lines (40 loc) · 1.23 KB
/
settings.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
#ifndef _SETTINGS_H_
#define _SETTINGS_H_
class SettingsFile
{
public:
SettingsFile();
SettingsFile(char *filename);
~SettingsFile();
bool OpenForRead(char *filename);
bool OpenForWrite(char *filename);
void Close();
bool IsOpen() { return m_file!=NULL; }
bool IsOpenForWrite() { return IsOpen() && m_bWrite; }
bool IsOpenForRead() { return IsOpen() && !m_bWrite; }
bool ReadSetting(char *section, int sectionSize,
char *param, int paramSize,
char *subparam, int subparamSize,
char *value, int valueSize);
bool ReadSetting();
bool WriteSetting(const char* section,
const char* param,
const char* subparam,
const char* value);
bool WriteComment(const char* comment);
static const int m_nSectionSize=256;
static const int m_nParamSize=256;
static const int m_nSubParamSize=256;
static const int m_nValueSize=1024;
char m_strSection[m_nSectionSize];
char m_strParam[m_nParamSize];
char m_strSubParam[m_nSubParamSize];
char m_strValue[m_nValueSize];
bool m_bSectionChanged;
protected:
FILE *m_file;
bool m_bWrite;
bool m_bLastLineComment;
char m_strLastSection[m_nSectionSize];
};
#endif // _SETTINGS_H_