Skip to content

TFPHashList

Hash list class for pointer data.

Declaration

Source position: contnrs.pp line 233

type

  TFPHashList = class(TObject)
  public
    constructor Create;
    destructor Destroy;
    function Add : SizeInt;
    procedure Clear;
    function NameOfIndex : RawByteString;
    function HashOfIndex : LongWord;
    function GetNextCollision : SizeInt;
    procedure Delete;
    class procedure Error;
    function Extract : Pointer;
    function IndexOf : SizeInt;
    function Find : Pointer;
    function FindIndexOf : SizeInt;
    function FindWithHash : Pointer;
    function Rename : SizeInt;
    function Remove : SizeInt;
    procedure Pack;
    procedure ForEachCall(proc2call: TListCallback; arg: pointer);
    procedure ForEachCall(proc2call: TListStaticCallback; arg: pointer);
    property Count: int32; {r}
    property Capacity: uint32; {rw}
    property Items[Index : SizeInt]: Pointer; {rw}
    property List: PViHashListItem; {r}
  end;

Description

TFPHashList implements a fast hash class. The class is built for speed, therefore the key values can be shortstrings only, and the data can only be non-nil pointers.

if a base class for an own hash class is wanted, the TFPCustomHashTable class can be used. If a hash class for objects is needed instead of pointers, the TFPHashObjectList class can be used.

Properties

Member Visibility Description
Capacity public Capacity of the list.
Count read only public Current number of elements in the list.
Items public Indexed array with pointers.
List read only public Low-level hash list.
See all Properties

Methods

Member Visibility Description
Add public Add a new key/data pair to the list.
Clear public Clear the list.
Create public Create a new instance of the hashlist.
Delete public Delete an item from the list.
Destroy public Removes an instance of the hashlist from the heap.
Error public Raise an error.
Extract public Extract a pointer from the list.
Find public Find data associated with key.
FindIndexOf public Return index of named item.
FindWithHash public Find first element with given name and hash value.
ForEachCall public Call a procedure for each element in the list.
GetNextCollision public Get next collision number.
HashOfIndex public Return the hash value of an item by index.
IndexOf public Return the index of the data pointer.
NameOfIndex public Returns the key name of an item by index.
Pack public Remove nil pointers from the list.
Remove public Remove first instance of a pointer.
Rename public Rename a key.
See all Methods

See also

Name Description
TFPCustomHashTable Hash class.
TFPHashObjectList
TFPDataHashTable Hash table for data pointers.
TFPStringHashTable Hash table for string data.