MCPcopy Create free account
hub / github.com/MaxBelkov/visualsyslog / TMYIniFile

Class TMYIniFile

sourcecommon/inif.h:13–75  ·  view source on GitHub ↗

--------------------------------------------------------------------------- �������� ������/������ ��������� ����������, ���������� ������� �������� ������ "\r\n". ��� ����������� ��������� �����������: - ��� ������ ��������: "\r\n" �� "\", � "\" �� "\\" - ��� ������ ��������: "\" �� "\r\n", � "\\" �� "\" ---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

11// - ��� ������ ��������: "\" �� "\r\n", � "\\" �� "\"
12//---------------------------------------------------------------------------
13class TMYIniFile: public TFile
14{
15private:
16 AnsiString FileName;
17 TStringList * list; // ������ ����� ��� �������� .INI ����
18 bool bChange; // ���� ����������� ������ ���� 1-�� ����������
19 String CurSection; // �������� ������� ������
20 int CurSectionIndex; // ������ ������� ������ � ������
21 int CurParamIndex; // ������ �������� ��������� � ������
22 int IniError; // ��� ������:
23 // 0 - OK
24 // 1 - Can't open file
25 bool bAnyError; // true - ����� ������ (� ��� ����� �������� ����� �� ������)
26
27private:
28 // ����� ������
29 int Find(String Section, String Ident="", int from=0);
30 bool IsSectionName(String Section);
31 AnsiString SpecialReplace(AnsiString s);
32 AnsiString SpecialReverseReplace(AnsiString s);
33
34public:
35 // bCreateNewFile - ������� ����� ������ ����. ���������� ������� ������������.
36 TMYIniFile(char * File, bool enableExceptions = false, bool bCreateNewFile = false);
37 ~TMYIniFile();
38 // ������� ��� �� ����
39 bool UpdateFile(void);
40
41 AnsiString ReadString(char * Section, char * Ident, char * def="");
42 String ReadString(String Section, String Ident, char * def="");
43 AnsiString ReadStringNOCR(char * Section, char * Ident, char * def="");
44
45 int ReadInteger(char * Section, char * Ident, int def=0);
46 int ReadInteger(String Section, String Ident, int def=0);
47
48 bool ReadBool(char * Section, char * Ident, bool def=false);
49 bool ReadBool(String Section, String Ident, bool def=false);
50
51 double ReadFloat(char * Section, char * Ident, double def=0.0);
52 double ReadFloat(String Section, String Ident, double def=0.0);
53
54 void WriteString(char * Section, char * Ident, char * Value);
55 void WriteString(String Section, String Ident, String Value);
56
57 void WriteStringNOCR(char * Section, char * Ident, char * Value);
58
59 void WriteInteger(char * Section, char * Ident, int Value);
60 void WriteInteger(String Section, String Ident, int Value);
61
62 void WriteBool(char * Section, char * Ident, bool Value);
63 void WriteBool(String Section, String Ident, bool Value);
64
65 void WriteFloat(char * Section, char * Ident, double Value);
66 void WriteFloat(String Section, String Ident, double Value);
67
68 bool SectionExists(const AnsiString Section);
69 bool ValueExists(const AnsiString Section, const AnsiString Ident);
70

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected