Declaration¶
Source position: fgl.pp line 418
type
TFPGMapInterfacedObjectData = class(TFPSMap)
public
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;
Inheritance¶
Description¶
TFPGInterfacedObjectMap is a generic map class. It can be used to specialize a map for any key type, with associated data type that requires manual reference counting: any type which implements IInterface. For non-reference counted objects, TFPGMap should be used.
This map class is entirely equivalent to TFPGMap, but operates on data items that require additional reference counting code on the data.
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. |
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. |
Events¶
| Member | Visibility | Description |
|---|---|---|
| OnCompare | public | Alias for OnKeyCompare. |
| OnDataCompare | public | Compare function for data values. |
| OnKeyCompare | public | Compare function for key values. |