Class TMutableSet
Unit
Declaration
type generic TMutableSet<TItem,TInfo> = class(specialize TReadOnlySet<TItem,TInfo>)
Description
Generic mutable set
Data in this set can be read (see ancestor TReadOnlySet) and modified.
Example:
type TMutableSetString = specialize TMutableSet<string, THAMTTypeInfo>; var stringSet: TMutableSetString; p: TMutableSetString.PItem; begin stringSet := TMutableSetString.create; stringSet.Insert('hello'); stringSet.insert('foo'); writeln(stringSet['hello']); // true writeln(stringSet.contains('foo')); // true writeln(stringSet.contains('abc')); // false //enumerate all for p in stringSet do writeln(pˆ); stringSet.free; end.
Hierarchy
- TReadOnlyCustomSet
- TReadOnlySet
- TMutableSet
Overview
Methods
constructor Create; |
|
constructor Create(other: specialize TReadOnlyCustomSet<TItem, TInfo>); |
|
function include(const item: TItem; allowOverride: boolean = true): boolean; inline; |
|
function exclude(const item: TItem): boolean; inline; |
|
procedure insert(const item: TItem); inline; |
|
procedure remove(const item: TItem); inline; |
|
procedure clear; |
|
function clone: TMutableSet; |
Properties
property items[item: TItem]: Boolean read contains write toggleItem; |
Description
Methods
constructor Create; |
|
Creates an empty set |
constructor Create(other: specialize TReadOnlyCustomSet<TItem, TInfo>); |
|
Creates a set equal to other. No data is copied, till either set is modified (copy-on-write). |
function exclude(const item: TItem): boolean; inline; |
|
Removes an item, ReturnsIf the set did contain item. |
procedure insert(const item: TItem); inline; |
|
Inserts an item, or raises an exception if the set already contains the item |
procedure remove(const item: TItem); inline; |
|
Removes an item, or raises an exception if the set did not contain the item |
procedure clear; |
|
Removes everything from the set; |
function clone: TMutableSet; |
|
Creates a new set equal to self. No data is copied, till either set is modified (copy-on-write). |
Properties
property items[item: TItem]: Boolean read contains write toggleItem; |
|
Default parameter, so you can test and update the set with |
Generated by PasDoc 0.16.0.