root/trunk/ElSettings/IniEx.h

Revision 5, 2.1 kB (checked in by qbert, 3 years ago)

Initial ( and last :( ) commit

Line 
1 // IniEx.h: interface for the CIniEx class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #if !defined(AFX_INIEX_H__36888C4C_12D3_4F65_A78B_2F3C3576B5B8__INCLUDED_F)
6 #define AFX_INIEX_H__36888C4C_12D3_4F65_A78B_2F3C3576B5B8__INCLUDED_F
7
8 #if _MSC_VER > 1000
9 #pragma once
10 #endif // _MSC_VER > 1000
11
12
13 #define MAX_SECTION_COUNT   256
14 class CIniEx 
15 {
16 private:
17     //Functions
18     int     LookupKey       (int nSectionIndex,CString *Key);
19     int     LookupSection   (CString *Section);
20     int     CompareStrings  (CString *str1,CString *str2);
21     void    GrowIfNecessary (void);
22     void    FindBackupFile  (void);
23 private:
24     //Variables
25     CMapStringToString  *m_tmpLines;
26     CString             m_ErrStr;
27     CStringArray        **m_Keys;
28     CStringArray        **m_Values;
29     CStringArray        m_Sections;
30
31     int     m_SectionNo;
32     int     m_GrowSize;
33     BOOL    m_NoCaseSensitive;
34     BOOL    m_writeWhenChange;
35     CString m_BackupFileName;
36     CString m_FileName;
37     BOOL    m_makeBackup;
38     BOOL    m_Changed; 
39
40 public:
41     void GetKeysInSection(CString section,CStringArray &keys);
42     void GetSections(CStringArray &sections);
43
44     CIniEx(int GrowSize=4);
45     virtual ~CIniEx();
46
47     BOOL Open(LPCSTR pFileName,
48               BOOL writeWhenChange=TRUE,
49               BOOL createIfNotExist=TRUE,
50               BOOL noCaseSensitive=TRUE,
51               BOOL makeBackup=FALSE);
52     BOOL OpenAtExeDirectory(LPCSTR pFileName,
53               BOOL writeWhenChange=TRUE,
54               BOOL createIfNotExist=TRUE,
55               BOOL noCaseSensitive=TRUE,
56               BOOL makeBackup=FALSE);
57     void ResetContent();
58
59     CString WriteFile(BOOL makeBackup=FALSE);
60
61     CString GetValue(CString Section,CString Key,CString DefaultValue="");
62     CString GetValue(CString Key);
63
64     void SetValue(CString Key,CString Value);
65     void SetValue(CString Section,CString Key,CString Value);
66
67     BOOL RemoveKey(CString Key);
68     BOOL RemoveKey(CString Section,CString Key);
69
70     BOOL RemoveSection(CString Section);
71
72     BOOL GetWriteWhenChange();
73     void SetWriteWhenChange(BOOL WriteWhenChange);
74
75     void SetBackupFileName(CString &backupFile);
76
77
78 };
79
80 #endif // !defined(AFX_INIEX_H__36888C4C_12D3_4F65_A78B_2F3C3576B5B8__INCLUDED_)
Note: See TracBrowser for help on using the browser.