Skip to content

TFPSMap

Basic map object, used in generic maps.

Declaration

Source position: fgl.pp line 265

type

  TFPSMap = class(TFPSList)
  public
    constructor Create;
    function Add(AKey: Pointer; AData: Pointer) : Integer;
    function Add(AKey: Pointer) : Integer;
    function Find : Boolean;
    function IndexOf : Integer;
    function IndexOfData : Integer;
    function Insert(Index: Integer) : Pointer;
    procedure Insert(Index: Integer; out AKey: Pointer; out AData: Pointer);
    procedure InsertKey;
    procedure InsertKeyData;
    function Remove : Integer;
    procedure Sort;
    procedure Sort(SortingAlgorithm: PSortingAlgorithm);
    procedure SortRange(aStartIndex: Integer; aEndIndex: Integer);
    procedure SortRange(aStartIndex: Integer; aEndIndex: Integer; 
                   aSortingAlgorithm: PSortingAlgorithm);
    property Duplicates: TDuplicates; {rw}
    property KeySize: Integer; {r}
    property DataSize: Integer; {r}
    property Keys[Index : Integer]: Pointer; {rw}
    property Data[Index : Integer]: Pointer; {rw}
    property KeyData[Key : Pointer]: Pointer; {rw}
    property Sorted: Boolean; {rw}
    property OnPtrCompare: TFPSListCompareFunc; {rw}
    property OnKeyPtrCompare: TFPSListCompareFunc; {rw}
    property OnDataPtrCompare: TFPSListCompareFunc; {rw}
  end;

Description

TFPSMap can be used to create a map for any type T that does not require reference counting (such as interfaced objects). It will specialize to a map which is a generalized list with an arbitrary type as the list index (called the key).

This class should normally not be used directly, instead use one of the generic map objects such as TFPGMap.

Properties

Member Visibility Description
Data public Indexed access to the locations of all data items.
DataSize read only public Size (in bytes) for the data associated with keys.
Duplicates public What to do with duplicate key values.
KeyData public Access to data locations using key.
Keys public Indexed access to the locations of all keys.
KeySize read only public Size (in bytes) for the key.
Sorted public Is the map permanently sorted on key ?
See all Properties

Methods

Member Visibility Description
Add public Add a key, value pair to the map.
Create public Create a new map with given key and data size.
Find public Find data using the associated key.
IndexOf public Index of key pointed to by AKey.
IndexOfData public Index of data item AData.
Insert public Insert a new slot for key and associated data item in the list.
InsertKey public Insert a key in the list.
InsertKeyData public Insert a key and associated in the list.
Remove public Remove a key/value pair from the map.
Sort public Sort the list according to key.
SortRange public
See all Methods

Events

Member Visibility Description
OnDataPtrCompare public Callback to compare 2 data items.
OnKeyPtrCompare public Callback to compare 2 keys.
OnPtrCompare public Alias for OnKeyPtrCompare.
See all Events

See also

Name Description
TFPGMap Generic map.