[Overview][Constants][Types][Classes][Index] | Reference for unit 'fgl' (#rtl)

# TFPSMap

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Basic map object, used in generic maps

## Declaration

Source position: fgl.pp line 244

`type TFPSMap = class(TFPSList)`
`public`
`constructor Create();` |  | Create a new map with given key and data size.
`function Add();` |  | Add a key, value pair to the map.
`function Find();` |  | Find data using the associated key
`function IndexOf();` |  | Index of key pointed to by AKey
`function IndexOfData();` |  | Index of data item AData
`function Insert();` |  | Insert a new slot for key and associated data item in the list
`procedure InsertKey();` |  | Insert a key in the list
`procedure InsertKeyData();` |  | Insert a key and associated in the list
`function Remove();` |  | Remove a key/value pair from the map.
`procedure Sort;` |  | Sort the list according to key
`property Duplicates: TDuplicates; [rw]` |  | What to do with duplicate key values
`property KeySize: Integer; [r]` |  | Size (in bytes) for the key
`property DataSize: Integer; [r]` |  | Size (in bytes) for the data associated with keys
`property Keys []: Pointer; [rw]` |  | Indexed access to the locations of all keys
`property Data []: Pointer; [rw]` |  | Indexed access to the locations of all data items
`property KeyData []: Pointer; default; [rw]` |  | Access to data locations using key
`property Sorted: Boolean; [rw]` |  | Is the map permanently sorted on key ?
`property OnPtrCompare: TFPSListCompareFunc; [rw]` |  | Alias for OnKeyPtrCompare
`property OnKeyPtrCompare: TFPSListCompareFunc; [rw]` |  | Callback to compare 2 keys
`property OnDataPtrCompare: TFPSListCompareFunc; [rw]` |  | Callback to compare 2 data items
`end;`

## Inheritance

`TFPSMap` |  | Basic map object, used in generic maps
`TFPSList` |  | Basic list of memory blocks
`TObject` |  | Base class of all classes.

## 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.

## See also

TFPGMap |  | Generic map

Documentation generated on: May 14 2021