[Overview][Types][Classes][Index] |
Adds a hash item and optional data to the container.
Source position: stringhashlist.pas line 60
public function TStringHashList.Add( |
const S: string |
):Integer; |
const S: string; |
ItemData: Pointer |
):Integer; |
S |
|
Key value for the hash item. |
Ordinal position in List where the new hash item was stored.
S |
|
Key value for the hash item. |
ItemData |
|
Untyped pointer to the optional data for the specified key. |
Add is an overloaded Integer function used to store a hash item (and optional data associated with item) in the List for the container. The return value contains the ordinal position in List where the hash item was stored.
S is a String with the key used to construct the hash value.
ItemData is an untyped pointer to the optional data associated with the key.
Add allocates a new PStringHashItem instance used to represent the hash item in ItemData. Values in S and itemData are stored in the instance. HashOf is called to get the 32-bit hash value stored in the instance.
Hash items in List are stored in hash value order. When Count has a non-zero value, the hash value for the new entry is used to locate the position in List where the new entry is stored. When Count is 0, the item is always stored at position 0 in List.
Use Remove to delete a hash item in List with a given key value.
Use Find to get the position in List for a hash item with a given key value.
Use the Data property to get an untyped pointer to the arbitrary data associated with the given key value. The pointer must be cast to the type needed in the application.
Use List to access the PStringHashItemList using an ordinal position in the storage.
Version 4.0 | Generated 2025-05-03 | Home |