Declaration¶
Source position: inifiles.pp line 160
type
TCustomIniFile = class
public
FormatSettings: TFormatSettings;
constructor Create(const AFileName: string;
ADefaultEncoding: TEncoding;
AOptions: TIniFileOptions=[]);
constructor Create(const AFileName: string;
ADefaultEncoding: TEncoding; AOwnsEncoding: Boolean;
AOptions: TIniFileOptions=[]);
constructor Create(const AFileName: string;
AOptions: TIniFileOptions=[]);
constructor Create(const AFileName: string; AEscapeLineFeeds: Boolean);
destructor Destroy;
procedure SetBoolStringValues;
function SectionExists : Boolean;
function ReadString : string;
procedure WriteString;
function ReadInteger : LongInt;
procedure WriteInteger;
function ReadInt64 : Int64;
procedure WriteInt64;
function ReadBool : Boolean;
procedure WriteBool;
function ReadDate : TDateTime;
function ReadDateTime : TDateTime;
function ReadFloat : Double;
function ReadTime : TDateTime;
function ReadBinaryStream : Integer;
procedure WriteDate;
procedure WriteDateTime;
procedure WriteFloat;
procedure WriteTime;
procedure WriteBinaryStream;
procedure ReadSection;
procedure ReadSections;
procedure ReadSectionValues(const Section: string; Strings: TStrings;
Options: TSectionValuesOptions); overload;
procedure ReadSectionValues(const Section: string; Strings: TStrings); overload;
procedure EraseSection;
procedure DeleteKey;
procedure UpdateFile;
function ValueExists : Boolean;
property Encoding: TEncoding; {rw}
property FileName: string; {r}
property Options: TIniFileOptions; {rw}
property EscapeLineFeeds: Boolean; {r}
property CaseSensitive: Boolean; {rw}
property StripQuotes: Boolean; {rw}
property FormatSettingsActive: Boolean; {rw}
property BoolTrueStrings: TStringArray; {rw}
property BoolFalseStrings: TStringArray; {rw}
property OwnsEncoding: Boolean; {r}
end;
Inheritance¶
Description¶
TCustomIniFile implements all calls for manipulating a .ini. It does not implement any of this behaviour, the behaviour must be implemented in a descendent class like TIniFile or TMemIniFile.
Since TCustomIniFile is an abstract class, it should never be created directly. Instead, one of the TIniFile or TMemIniFile classes should be created.
Properties¶
| Member | Visibility | Description |
|---|---|---|
| BoolFalseStrings | public | Strings to recognize as boolean False values. |
| BoolTrueStrings | public | Strings to recognize as boolean True values. |
| CaseSensitive | public | Are key and section names case sensitive. |
| Encoding | public | Encoding of the ini file. |
| EscapeLineFeeds read only | public | Should linefeeds be escaped ? |
| FileName read only | public | Name of the .ini file. |
| FormatSettingsActive | public | Is FormatSettings used or not. |
| Options | public | Options currently in effect. |
| OwnsEncoding read only | public | Does the ini file instance own the encoding ? |
| StripQuotes | public | Should quotes be stripped from string values. |
Methods¶
| Member | Visibility | Description |
|---|---|---|
| Create | public | Instantiate a new instance of TCustomIniFile. |
| DeleteKey | public | Delete a key from a section. |
| Destroy | public | Remove the TCustomIniFile instance from memory. |
| EraseSection | public | Clear a section. |
| ReadBinaryStream | public | Read binary data. |
| ReadBool | public | |
| ReadDate | public | Read a date value. |
| ReadDateTime | public | Read a Date/Time value. |
| ReadFloat | public | Read a floating point value. |
| ReadInt64 | public | Read an Int64 value. |
| ReadInteger | public | Read an integer value from the file. |
| ReadSection | public | Read the key names in a section. |
| ReadSections | public | Read the list of sections. |
| ReadSectionValues | public | Read names and values of a section. |
| ReadString | public | Read a string valued key. |
| ReadTime | public | Read a time value. |
| SectionExists | public | Check if a section exists. |
| SetBoolStringValues | public | Set the boolean string values to use when writing to file. |
| UpdateFile | public | Update the file on disk. |
| ValueExists | public | Check if a value exists. |
| WriteBinaryStream | public | Write binary data. |
| WriteBool | public | Write boolean value. |
| WriteDate | public | Write date value. |
| WriteDateTime | public | Write date/time value. |
| WriteFloat | public | Write a floating-point value. |
| WriteInt64 | public | Write an Int64 value. |
| WriteInteger | public | Write an integer value. |
| WriteString | public | Write a string value. |
| WriteTime | public | Write time value. |
Fieldss¶
| Member | Visibility | Description |
|---|---|---|
| FormatSettings | public | Format settings to use when reading date/time/float values. |
See also¶
| Name | Description |
|---|---|
| TIniFile | Ini file implementation. |
| TMemIniFile | Inifile cached in memory. |