Class TReadOnlyMap
Unit
hamt.maps
Declaration
type generic TReadOnlyMap<TKey,TValue,TInfo> = class(specialize TReadOnlyCustomSet<specializeTHAMTPairInfo<TKey,TValue,TInfo>.TPair,specializeTHAMTPairInfo<TKey,TValue,TInfo>>)
Description
Generic read-only map
The data in this map can be read, but there are no public methods to modify it.
Hierarchy
- TReadOnlyCustomSet
- TReadOnlyMap
Overview
Nested Types
Methods
|
constructor Create; |
|
constructor Create(other: specialize TReadOnlyCustomSet<THAMTNode.TItem, THAMTNode.TInfo>); |
|
function contains(const key:TKey): boolean; inline; |
|
function get(const key: TKey; const def: TValue): TValue; inline; |
|
function getOrDefault(const key: TKey): TValue; inline; |
|
function get(const key: TKey): TValue; inline; |
Properties
|
property items[key: TKey]: TValue read get; |
Description
Nested Types
|
PKey = ˆTKey; |
|
|
PPair = THAMTNode.PItem; |
|
|
PValue = ˆTValue; |
|
|
TKeySizeEquivalent = packed array[1..sizeof(TKey)] of byte; |
|
|
TValueSizeEquivalent = packed array[1..sizeof(TValue)] of byte; |
|
Methods
|
constructor Create; |
Creates an empty map
|
|
constructor Create(other: specialize TReadOnlyCustomSet<THAMTNode.TItem, THAMTNode.TInfo>); |
Creates a map equal to other. No data is copied, till either map is modified (copy-on-write).
|
|
function contains(const key:TKey): boolean; inline; |
Returns if the map contains a certain key
|
|
function get(const key: TKey; const def: TValue): TValue; inline; |
Returns the value for a certain key, or default value def if the map does not contain the key
|
|
function getOrDefault(const key: TKey): TValue; inline; |
Returns the value for a certain key, or default(TValue) if the map does not contain the key
|
|
function get(const key: TKey): TValue; inline; |
Returns the value for a certain key, or raises an exception if the map does not contain the key
|
Properties
|
property items[key: TKey]: TValue read get; |
Default parameter, so you can read elements with map[key]
|
Generated by PasDoc 0.16.0.