Sign in Join
FPDoc Onlineexperiment

TCustomIniFile.Create constructor

Member of TCustomIniFilepublicIn unit IniFiles

Instantiate a new instance of TCustomIniFile.

Declaration

pascal
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=[]); virtual
constructor Create(const AFileName: string; AEscapeLineFeeds: Boolean)
 ; virtual

Arguments

AFileName

Filename to read.

ADefaultEncoding

Default encoding to use when writing strings.

AOptions

Options to use when processing the ini file.

AOwnsEncoding

Does the ini file own the encoding (ie. free it when destroyed).

AEscapeLineFeeds

Should escaping of linefeeds be enabled ?

Description

Create creates a new instance of TCustomIniFile and loads it with the data from AFileName, if this file exists. If the ifoEscapeLineFeeds option is present in AOptions or AEscapeLineFeeds parameter is True, then lines which have their end-of-line markers escaped with a backslash, will be concatenated. This means that the following 2 lines

Description=This is a \
line with a long text

is equivalent to

Description=This is a line with a long text

By default, not escaping of linefeeds is performed (for Delphi compatibility)

Default options for the Options property can be specified in AOptions.

A Default string encoding can be specified in aEncoding. If aOwnsEncoding is True the encoding will be freed when the ini file instance is destroyed.

Errors

If the file cannot be read, an exception may be raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.