Home Units Hierarchy Routines All identifiers

Class unaIdList

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaIdList = class(unaList)

Description

This list is usefull when you wish to access items by their IDs rather than by indexes.

It uses internal array to store the ID of every item, so item could be located much faster.

Hierarchy

Overview

Methods

Public function indexOfId(id: int64; startingIndex: int = 0): int;
Public function itemById(id: int64; startingIndex: int = 0): pointer;
Public function removeById(id: int64; doFree: unsigned = 2): bool;
Public function updateId(index: int): bool;
Public function updateIds(): unsigned;
Protected function doAdd(item: pointer): int; override;
Protected function doCopyFrom(list: pointer; listSize: int = -1; copyOperation: unaListCopyOpEnum = unaco_add; startIndex: int = 0): int; override;
Protected function doInsert(index: int; item: pointer; brokeSorted: bool = true): int; override;
Protected function getId(item: pointer): int64; virtual; abstract;
Public procedure AfterConstruction(); override;
Public procedure BeforeDestruction(); override;
Protected procedure doReverse(); override;
Protected procedure doSetCapacity(value: unsigned; force: bool); override;
Protected procedure doSetItem(index: int; item: pointer; brokeSorted: bool = true; doFree: unsigned = 2); override;
Protected procedure notifyBeforeRemove(index: int); override;

Properties

Public property allowDuplicateId: bool read f_allowDI write f_allowDI;

Description

Methods

Public function indexOfId(id: int64; startingIndex: int = 0): int;

Returns index of first item with given ID.

Public function itemById(id: int64; startingIndex: int = 0): pointer;

Returns first item with given ID.

Public function removeById(id: int64; doFree: unsigned = 2): bool;

Removes item with specified ID.

Public function updateId(index: int): bool;

Assigns new Id for item with specified index.

Public function updateIds(): unsigned;

Assigns new Ids for each item in the list. Returns number of items updated.

Protected function doAdd(item: pointer): int; override;
 
Protected function doCopyFrom(list: pointer; listSize: int = -1; copyOperation: unaListCopyOpEnum = unaco_add; startIndex: int = 0): int; override;
 
Protected function doInsert(index: int; item: pointer; brokeSorted: bool = true): int; override;
 
Protected function getId(item: pointer): int64; virtual; abstract;

Override this method to provide some implementation of returning the ID of the item.

Public procedure AfterConstruction(); override;
 
Public procedure BeforeDestruction(); override;
 
Protected procedure doReverse(); override;
 
Protected procedure doSetCapacity(value: unsigned; force: bool); override;
 
Protected procedure doSetItem(index: int; item: pointer; brokeSorted: bool = true; doFree: unsigned = 2); override;
 
Protected procedure notifyBeforeRemove(index: int); override;
 

Properties

Public property allowDuplicateId: bool read f_allowDI write f_allowDI;
 

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09