Class TBrookStringMap

Unit

Declaration

type TBrookStringMap = class(TBrookHandledPersistent)

Description

String map class and its related methods.

Hierarchy

Overview

Methods

Public constructor Create(AHandle: Pointer); virtual;
Public destructor Destroy; override;
Public procedure Assign(ASource: TPersistent); override;
Public function IsEmpty: Boolean; virtual;
Public function GetEnumerator: TBrookStringMapEnumerator;
Public procedure Add(const AName, AValue: string); virtual;
Public procedure AddOrSet(const AName, AValue: string); virtual;
Public procedure Remove(const AName: string); virtual;
Public procedure Clear; virtual;
Public function Find(const AName: string; out APair: TBrookStringPair): Boolean; virtual;
Public function Contains(const AName: string): Boolean; virtual;
Public function Get(const AName: string): string; virtual;
Public function TryValue(const AName: string; out AValue: string): Boolean; virtual;
Public function First(out APair: TBrookStringPair): Boolean; virtual;
Public function Next(out APair: TBrookStringPair): Boolean; virtual;
Public procedure Iterate(AIterator: TBrookStringMapIterator; AData: Pointer); virtual;
Public procedure Sort(AComparator: TBrookStringMapComparator; AData: Pointer); virtual;
Public procedure Fetch(AObject: TObject; const AAllowed, AIgnored: array of string); overload; virtual;
Public procedure Fetch(AObject: TObject); overload; virtual;
Public function ToString: string; override;

Properties

Public property Count: Integer read GetCount;
Public property Values[constAName:string]: string read GetValue write SetValue;
Public property EOF: Boolean read IsEOF;
Public property Empty: Boolean read IsEmpty;
Public property ClearOnDestroy: Boolean read FClearOnDestroy write FClearOnDestroy;
Public property OnChange: TBrookStringMapChangeEvent read FOnChange write FOnChange;

Description

Methods

Public constructor Create(AHandle: Pointer); virtual;

Creates an instance of TBrookStringMap.

Parameters
AHandle[in]
Pointer to store the string map handle.
Public destructor Destroy; override;

Frees an instance of TBrookStringMap.

Public procedure Assign(ASource: TPersistent); override;

Copies the properties of the source string map.

Parameters
ASource[in]
String map source to be copied.
Public function IsEmpty: Boolean; virtual;

Checks if the map is empty.

Returns

True when map is empty, False otherwise.

Public function GetEnumerator: TBrookStringMapEnumerator;

Gets an instance of TBrookStringMapEnumerator.

Public procedure Add(const AName, AValue: string); virtual;

Adds a pair of strings to the map.

Parameters
AName[in]
Name of the pair.
AValue[in]
Value of the pair.
Public procedure AddOrSet(const AName, AValue: string); virtual;

Adds or sets a pair of strings to the map.

Parameters
AName[in]
Name of the pair.
AValue[in]
Value of the pair.
Public procedure Remove(const AName: string); virtual;

Removes a pair by its name.

Parameters
AName[in]
Name of the pair.
Public procedure Clear; virtual;

Clears the entire map.

Public function Find(const AName: string; out APair: TBrookStringPair): Boolean; virtual;

Finds a pair by its name.

Parameters
AName[in]
Name of the pair.
APair[out]
Reference to store found pair.
Returns

True when pair is found, False otherwise.

Public function Contains(const AName: string): Boolean; virtual;

Checks if map contains a pair by its name.

Parameters
AName[in]
Name of the pair.
Returns

True when map contains the pair, False otherwise.

Public function Get(const AName: string): string; virtual;

Gets a pair by name and returns its value.

Parameters
AName[in]
Name of the pair.
Returns

Pair value.

Public function TryValue(const AName: string; out AValue: string): Boolean; virtual;

Tries to find a pair value by its name.

Parameters
AName[in]
Name of the pair.
AValue[out]
Reference to store found value.
Returns

True when pair is found, False otherwise.

Public function First(out APair: TBrookStringPair): Boolean; virtual;

Retrieves the first pair in the map.

Parameters
APair[out]
First pair returned.
Returns

True when pair is found, False otherwise.

Public function Next(out APair: TBrookStringPair): Boolean; virtual;

Retrieves the next pair in the map.

Parameters
APair[out]
Next pair returned.
Public procedure Iterate(AIterator: TBrookStringMapIterator; AData: Pointer); virtual;

Iterates over pairs map.

Parameters
AIterator[in]
Function to iterate the pairs.
AData[in,out]
User-specified value.
Public procedure Sort(AComparator: TBrookStringMapComparator; AData: Pointer); virtual;

Sorts the pairs map.

Parameters
AComparator[in]
Function to sort the pairs.
AData[in,out]
User-specified value.
Public procedure Fetch(AObject: TObject; const AAllowed, AIgnored: array of string); overload; virtual;

Fetches a string map as an object.

Parameters
AObject[in]
Object with properties that correspond to the fetched string map.
AAllowed[in]
Array of properties to be allowed when fetching.
AIgnored[in]
Array of properties to be ignored when fetching.
Public procedure Fetch(AObject: TObject); overload; virtual;

Fetches a string map as an object.

Public function ToString: string; override;

Gets the map as big string using equal sign to separate each pair and ending lines using line break.

Properties

Public property Count: Integer read GetCount;

Counts the total pairs present in the map.

Public property Values[constAName:string]: string read GetValue write SetValue;

Adds or gets the pair value.

Public property EOF: Boolean read IsEOF;

Indicates the end of map.

Public property Empty: Boolean read IsEmpty;

Indicates if the map is empty.

Public property ClearOnDestroy: Boolean read FClearOnDestroy write FClearOnDestroy;

Clears the list on destroy.

Public property OnChange: TBrookStringMapChangeEvent read FOnChange write FOnChange;

Notifies a change in the map.


Generated by PasDoc 0.16.0.