-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathINIFile.h
77 lines (60 loc) · 2.21 KB
/
INIFile.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
66
67
68
69
70
71
72
73
74
75
76
// INIFile.h
// Configuration File Management Class
// Copyright (c) 1989-2019 InterSafe, Inc.
// Written by Michael A. Hotz
/*--------------------------------------------------------------------------*/
class INIFile;
class INIGroup;
class INIEntry;
/*--------------------------------------------------------------------------*/
class INIFile
{
public:
INIFile(const char *aFileName);
~INIFile(void);
int GetItem(const char *group,const char *field,signed char& dest,signed char init);
int GetItem(const char *group,const char *field,signed short& dest,signed short init);
int GetItem(const char *group,const char *field,signed int& dest,signed int init);
int GetItem(const char *group,const char *field,signed long& dest,signed long init);
int GetItem(const char *group,const char *field,unsigned char& dest,unsigned char init);
int GetItem(const char *group,const char *field,unsigned short& dest,unsigned short init);
int GetItem(const char *group,const char *field,unsigned int& dest,unsigned int init);
int GetItem(const char *group,const char *field,unsigned long& dest,unsigned long init);
int GetItem(const char *group,const char *field,char *dest,const char *init);
int GetItem(const char *group,const char *field,void *dest,int size,void *init);
protected:
char *FindString(const char *aGroupName,const char *aEntryName);
private:
INIGroup *FindGroup(const char *aGroupName);
INIGroup *MakeGroup(const char *aGroupName);
INIGroup *basegroup;
char *filename;
};
/*--------------------------------------------------------------------------*/
class INIGroup
{
friend class INIFile;
public:
INIGroup(INIGroup *aLast,const char *aGroupName);
~INIGroup(void);
INIEntry *FindEntry(const char *aEntryName);
INIEntry *MakeEntry(const char *aEntryName);
private:
INIEntry *baseentry;
INIGroup *last,*next;
char *GroupName;
};
/*--------------------------------------------------------------------------*/
class INIEntry
{
friend class INIFile;
public:
INIEntry(INIEntry *aLast,const char *aEntryName);
~INIEntry(void);
int SetEntryText(const char *aEntryText);
public:
INIEntry *last,*next;
char *EntryName;
char *EntryText;
};
/*--------------------------------------------------------------------------*/