Skip to content

TIniCollection

Collection which can write itself to an .ini file.

Declaration

Source position: inicol.pp line 44

type

  TIniCollection = class(TCollection)
  public
    procedure Load;
    procedure Save;
    procedure SaveToIni;
    procedure SaveToFile;
    procedure LoadFromIni;
    procedure LoadFromFile;
    property Prefix: string; {r}
    property SectionPrefix: string; {r}
    property FileName: string; {rw}
    property GlobalSection: string; {rw}
  end;

Description

TIniCollection is a collection descendent which has the capability to write itself to an .ini file. It introduces some load and save mechanisms, which can be used to write all items in the collection to disk. The items should be descendents of the type TIniCollectionItem.

All methods work using a TCustomInifile class, making it possible to save to alternate file formats, or even databases.

An instance of TIniCollection should never be used directly. Instead, a descendent should be used, which sets the FPrefix and FSectionPrefix protected variables.

Properties

Member Visibility Description
FileName public Filename of the collection.
GlobalSection public Name of the global section.
Prefix read only public Prefix used in global section.
SectionPrefix read only public Prefix string for section names.
See all Properties

Methods

Member Visibility Description
Load public Loads the collection from the default filename.
LoadFromFile public Load collection from file.
LoadFromIni public Load collection from a file in .ini file format.
Save public Save the collection to the default filename.
SaveToFile public Save collection to a file in .ini file format.
SaveToIni public Save the collection to a TCustomIniFile descendent.
See all Methods

See also

Name Description
TIniCollection.LoadFromFile Load collection from file.
TIniCollection.LoadFromIni Load collection from a file in .ini file format.
TIniCollection.SaveToIni Save the collection to a TCustomIniFile descendent.
TIniCollection.SaveToFile Save collection to a file in .ini file format.