Skip to content

TFPGMapObject

Generic map.

Declaration

Source position: fgl.pp line 368

type

  TFPGMapObject = class(TFPSMap)
  public
    constructor Create(AFreeObjects: Boolean);
    constructor Create;
    function Add(const AKey: TKey; const AData: TData) : Integer;
    function Add(const AKey: TKey) : Integer;
    function Find : Boolean;
    function TryGetData : Boolean;
    procedure AddOrSetData;
    function IndexOf : Integer;
    function IndexOfData : Integer;
    procedure InsertKey;
    procedure InsertKeyData;
    function Remove : Integer;
    property Keys[Index : Integer]: TKey; {rw}
    property Data[Index : Integer]: TData; {rw}
    property KeyData[const  AKey : TKey]: TData; {rw}
    property OnCompare: TKeyCompareFunc; {rw}
    property OnKeyCompare: TKeyCompareFunc; {rw}
    property OnDataCompare: TDataCompareFunc; {rw}
  end;

Description

TFPGMapObject is a generic map class. It can be used to specialize a map for object types, but not objects with automated reference counting: For reference counted interface objects, TFPGMapInterfacedObjectData must be used.

Properties

Member Visibility Description
Data public Indexed access to the data in the list.
KeyData public Access to data based on key.
Keys public Indexed access to the keys in the list.
See all Properties

Methods

Member Visibility Description
Add public Add a key and value to the map.
AddOrSetData public Add data with given or set value if the key already exists.
Create public Create a new instance of the map.
Find public Find item based on key.
IndexOf public Find index of a key in the list.
IndexOfData public Find index of data value in the list.
InsertKey public Insert a new key in the list.
InsertKeyData public Insert a new key with associated data in the list.
Remove public Remove a key from the list.
TryGetData public Find data or return default.
See all Methods

Events

Member Visibility Description
OnCompare public Alias for OnKeyCompare.
OnDataCompare public Compare function for data values.
OnKeyCompare public Compare function for key values.
See all Events

See also

Name Description
TFPGMapInterfacedObjectData Generic map for reference counted objects.