Class TBigIniFile (unit BigIni)

Inherits from

TObject

Constructors


constructor Create(const FileName: String);

........................................................................... } { class TBigIniFile } {........................................................................... } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { create new instance } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Functions

procedure AppendFromFile(const aName : String);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { Append from File } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure DeleteKey(const aSection, aKey: string);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { remove a single key } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

destructor Destroy;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { destructor } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure EraseSection(const aSection: string);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { erase specified section } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure FlushFile;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { flush (save) data to disk } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure ReadAll(aStrings:TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { copy all 'lines' to TStrings-object } { Note [2]: under Delphi 1, ReadAll may cause errors when a TMemo.Lines } { array is destination and source is greater than 64 KB } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

function ReadBool(const aSection, aKey: string; aDefault: Boolean): Boolean;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read boolean value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

function ReadInteger(const aSection, aKey: string; aDefault: Longint): Longint;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read integer value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure ReadSection(const aSection: string; aStrings: TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read entire section (hoho, only the item names) } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure ReadSections(Strings: TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { copy all section names to TStrings object } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure ReadSectionValues(const aSection: string; aStrings: TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read entire section } { this was one of the hardest tasks... :)) } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

function ReadString(const aSection, aKey, aDefault: string): string;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { the basic function: return single string } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure WriteBool(const aSection, aKey: string; aValue: Boolean);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { write boolean value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure WriteInteger(const aSection, aKey: string; aValue: Longint);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { Yes, you gessed right: this procedure writes an integer value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure WriteString(const aSection, aKey, aValue: String);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { here is the one to write the string } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

procedure ClearSectionList;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { clean up } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

function FindItemIndex(const aSection, aKey :String; CreateNew:Boolean; var FoundStringList:TStringList):integer;

set false to keep white space at end of line

.


procedure SetFileName(const aName : String);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { Set or change FileName } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Properties

property EraseSectionCallback : TEraseSectionCallback


property FileName : string


property FlagDropApostrophes : Boolean


property FlagDropCommentLines : Boolean


property FlagDropWhiteSpace : Boolean


property FlagFilterOutInvalid : Boolean


property FlagTrimRight : Boolean


property SectionNames : TSectionList


Events

Variables

FEraseSectionCallback : TEraseSectionCallback;


FFileName : String;


FFlagDropApostrophes : Boolean;

set false to keep white space around '='

FFlagDropCommentLines : Boolean;


FFlagDropWhiteSpace : Boolean;

set false to keep lines without '='

FFlagFilterOutInvalid : Boolean;

set false to keep lines starting with ';'

FFlagTrimRight : Boolean;

set false to keep apostrophes around key

FHasChanged : Boolean;


FPrevSectionIndex : Integer;


FSectionList : TSectionList;


FTextBufferSize : Integer;



Constructors


constructor Create(const FileName: String);

........................................................................... } { class TBigIniFile } {........................................................................... } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { create new instance } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Functions


procedure AppendFromFile(const aName : String);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { Append from File } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure DeleteKey(const aSection, aKey: string);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { remove a single key } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


destructor Destroy;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { destructor } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure EraseSection(const aSection: string);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { erase specified section } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure FlushFile;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { flush (save) data to disk } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure ReadAll(aStrings:TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { copy all 'lines' to TStrings-object } { Note [2]: under Delphi 1, ReadAll may cause errors when a TMemo.Lines } { array is destination and source is greater than 64 KB } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


function ReadBool(const aSection, aKey: string; aDefault: Boolean): Boolean;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read boolean value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


function ReadInteger(const aSection, aKey: string; aDefault: Longint): Longint;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read integer value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure ReadSection(const aSection: string; aStrings: TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read entire section (hoho, only the item names) } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure ReadSections(Strings: TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { copy all section names to TStrings object } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure ReadSectionValues(const aSection: string; aStrings: TStrings);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { read entire section } { this was one of the hardest tasks... :)) } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


function ReadString(const aSection, aKey, aDefault: string): string;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { the basic function: return single string } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure WriteBool(const aSection, aKey: string; aValue: Boolean);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { write boolean value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure WriteInteger(const aSection, aKey: string; aValue: Longint);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { Yes, you gessed right: this procedure writes an integer value } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure WriteString(const aSection, aKey, aValue: String);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { here is the one to write the string } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure ClearSectionList;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { clean up } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


function FindItemIndex(const aSection, aKey :String; CreateNew:Boolean; var FoundStringList:TStringList):integer;

set false to keep white space at end of line

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { find item in specified section } { depending on CreateNew-flag, the section is created, if not existing } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


procedure SetFileName(const aName : String);

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . } { Set or change FileName } {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Properties


property EraseSectionCallback : TEraseSectionCallback


property FileName : string


property FlagDropApostrophes : Boolean


property FlagDropCommentLines : Boolean


property FlagDropWhiteSpace : Boolean


property FlagFilterOutInvalid : Boolean


property FlagTrimRight : Boolean


property SectionNames : TSectionList


Events


Variables


FEraseSectionCallback : TEraseSectionCallback;


FFileName : String;


FFlagDropApostrophes : Boolean;

set false to keep white space around '='


FFlagDropCommentLines : Boolean;


FFlagDropWhiteSpace : Boolean;

set false to keep lines without '='


FFlagFilterOutInvalid : Boolean;

set false to keep lines starting with ';'


FFlagTrimRight : Boolean;

set false to keep apostrophes around key


FHasChanged : Boolean;


FPrevSectionIndex : Integer;


FSectionList : TSectionList;


FTextBufferSize : Integer;