Class TReadOnlyMap

Unit

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

Overview

Nested Types

Public PKey = ˆTKey;
Public PPair = THAMTNode.PItem;
Public PValue = ˆTValue;
Public TKeySizeEquivalent = packed array[1..sizeof(TKey)] of byte;
Public TValueSizeEquivalent = packed array[1..sizeof(TValue)] of byte;

Methods

Public constructor Create;
Public constructor Create(other: specialize TReadOnlyCustomSet<THAMTNode.TItem, THAMTNode.TInfo>);
Public function contains(const key:TKey): boolean; inline;
Public function get(const key: TKey; const def: TValue): TValue; inline;
Public function getOrDefault(const key: TKey): TValue; inline;
Public function get(const key: TKey): TValue; inline;

Properties

Public property items[key: TKey]: TValue read get;

Description

Nested Types

Public PKey = ˆTKey;
 
Public PPair = THAMTNode.PItem;
 
Public PValue = ˆTValue;
 
Public TKeySizeEquivalent = packed array[1..sizeof(TKey)] of byte;
 
Public TValueSizeEquivalent = packed array[1..sizeof(TValue)] of byte;
 

Methods

Public constructor Create;

Creates an empty map

Public 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).

Public function contains(const key:TKey): boolean; inline;

Returns if the map contains a certain key

Public 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

Public 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

Public 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

Public property items[key: TKey]: TValue read get;

Default parameter, so you can read elements with map[key]


Generated by PasDoc 0.16.0.