Class DSequence (unit SDL)

Inherits from

DContainer

DSequence is an abstract base class for containers that hold their items in a defined order.

Constructors



Functions

function at(pos : Integer) : DObject; virtual;

Return the item at the given position.

function atAsBoolean(pos : Integer) : Boolean;

Retrieves at an index as a Boolean.

function atAsChar(pos : Integer) : Char;

Retrieves at an index as a Char.

function atAsClass(pos : Integer) : TClass;

Retrieves at an index as a class reference (TClass).

function atAsCurrency(pos : Integer) : Currency;

Retrieves at an index as a currency value.

function atAsExtended(pos : Integer) : Extended;

Retrieves at an index as an extended floating point value.

function atAsInteger(pos : Integer) : Integer;

Retrieves at an index as an integer.

function atAsInterface(pos : Integer) : Pointer;

Retrieves at an index as an interface pointer.

function atAsObject(pos : Integer) : TObject;

Retrieves at an index as an object reference.

function atAsPChar(pos : Integer) : PChar;

Retrieves at an index as a PChar.

function atAsPointer(pos : Integer) : Pointer;

Retrieves at an index as an untyped pointer.

function atAsPWideChar(pos : Integer) : PWideChar;

Retrieves at an index as a pointer to a WideChar.

function atAsShortString(pos : Integer) : ShortString;

Retrieves at an index as a short string.

function atAsString(pos : Integer) : String;

Retrieves at an index as a String (AnsiString).

function atAsVariant(pos : Integer) : Variant;

Retrieves at an index as a variant.

function atAsWideChar(pos : Integer) : WideChar;

Retrieves at an index as a WideChar.

function atAsWideString(pos : Integer) : WideString;

Retrieves at an index as a WideString.

function atRef(pos : Integer) : PDObject; virtual;

Return a reference to the DObject at the given position.

function back : DObject; virtual;

Return the last item in the sequence.

function backRef : PDObject; virtual;

Return a reference to the last item in the sequence.

function countWithin(_begin, _end : Integer; objs : array of const) : Integer; virtual;

Count the number of times an item occurs in a given range.

function front : DObject; virtual;

Return the first object in the sequence.

function frontRef : PDObject; virtual;

Return a reference to the first object in the sequence.

function indexOf(objs : array of const) : Integer; virtual;

Find out where obj is in the collection.

function indexOfWithin(_begin, _end : Integer; objs : array of const) : Integer; virtual;

Find out where obj is within the given range.

function popBack : DObject; virtual; abstract;

Remove the last element in the sequence, returning its value.

function popFront : DObject; virtual; abstract;

Remove the first element in the sequence, returning its value.

procedure pushBack(objs : array of const); virtual;

Push values to the back of the container.

procedure pushFront(objs : array of const); virtual;

Push values to the front of the container.

procedure putAt(index : Integer; objs : array of const); virtual;

Set the item at a given position.

function removeAtIter(iter : DIterator; count : Integer) : DIterator; virtual; abstract;

Remove count items an iterator is positioned at.

procedure removeWithin(_begin, _end : Integer; objs : array of const); virtual;

Remove every occurrence of each of the specified objects within the given range.

procedure replace(sources, targets : array of const); virtual;

Replace sources with targets, pairwise.

procedure replaceWithin(_begin, _end : Integer; sources, targets : array of const); virtual;

Replace sources with targets, pairwise, in the specified range.

procedure _add(const obj : DObject); override;

Add a DObject to this container.

function _countWithin(_begin, _end : Integer; const obj : DObject) : Integer; virtual;

Count the number of times an item occurs in a given range.

function _indexOf(const obj : DObject) : Integer; virtual;

Find out where obj is in the collection.

function _indexOfWithin(_begin, _end : Integer; const obj : DObject) : Integer; virtual;

Find out where obj is within the given range.

procedure _pushBack(const obj : DObject); virtual; abstract;

Push an object to the back of the sequence.

procedure _pushFront(const obj : DObject); virtual; abstract;

Push an object to the front of the container.

procedure _putAt(index : Integer; const obj : DObject); virtual;

Set the item at a given position.

procedure _remove(const obj : DObject); override;

Removes an object, by value, from this sequence.

procedure _removeWithin(_begin, _end : Integer; const obj : DObject); virtual; abstract;

Remove every occurrence of the specified object within the given range.

procedure _replace(obj1, obj2 : DObject); virtual;

Replace every occurrence of obj1 with obj2 in the sequence.

procedure _replaceWithin(_begin, _end : Integer; obj1, obj2 : DObject); virtual;

Replace sources with targets, pairwise, in the specified range.

Properties

Events

Variables


Constructors


Functions


function at(pos : Integer) : DObject; virtual;

Return the item at the given position. Note that returning this item may or may not be an efficient implementation. DVector-based structures will be more efficient. The returned object can be converted with a toXXX function.


function atAsBoolean(pos : Integer) : Boolean;

Retrieves at an index as a Boolean. Asserts if the type is not correct.


function atAsChar(pos : Integer) : Char;

Retrieves at an index as a Char. Asserts if the type is not correct.


function atAsClass(pos : Integer) : TClass;

Retrieves at an index as a class reference (TClass). Asserts if the type is not correct.


function atAsCurrency(pos : Integer) : Currency;

Retrieves at an index as a currency value. Asserts if the type is not correct.


function atAsExtended(pos : Integer) : Extended;

Retrieves at an index as an extended floating point value. Asserts if the type is not correct.


function atAsInteger(pos : Integer) : Integer;

Retrieves at an index as an integer. Asserts if the type is not correct.


function atAsInterface(pos : Integer) : Pointer;

Retrieves at an index as an interface pointer. Asserts if the type is not correct.


function atAsObject(pos : Integer) : TObject;

Retrieves at an index as an object reference. Asserts if the type is not correct.


function atAsPChar(pos : Integer) : PChar;

Retrieves at an index as a PChar. Asserts if the type is not correct.


function atAsPointer(pos : Integer) : Pointer;

Retrieves at an index as an untyped pointer.Asserts if the type is not correct.


function atAsPWideChar(pos : Integer) : PWideChar;

Retrieves at an index as a pointer to a WideChar. Asserts if the type is not correct.


function atAsShortString(pos : Integer) : ShortString;

Retrieves at an index as a short string.Asserts if the type is not correct.


function atAsString(pos : Integer) : String;

Retrieves at an index as a String (AnsiString). Asserts if the type is not correct.


function atAsVariant(pos : Integer) : Variant;

Retrieves at an index as a variant. Asserts if the type is not correct.


function atAsWideChar(pos : Integer) : WideChar;

Retrieves at an index as a WideChar. Asserts if the type is not correct.


function atAsWideString(pos : Integer) : WideString;

Retrieves at an index as a WideString. Asserts if the type is not correct.


function atRef(pos : Integer) : PDObject; virtual;

Return a reference to the DObject at the given position.


function back : DObject; virtual;

Return the last item in the sequence. This returned item must be correctly disposed of, or converted with a toXXX function.


function backRef : PDObject; virtual;

Return a reference to the last item in the sequence.


function countWithin(_begin, _end : Integer; objs : array of const) : Integer; virtual;

Count the number of times an item occurs in a given range.


function front : DObject; virtual;

Return the first object in the sequence. This value must be cleaned up or converted with a toXXX function.


function frontRef : PDObject; virtual;

Return a reference to the first object in the sequence.


function indexOf(objs : array of const) : Integer; virtual;

Find out where obj is in the collection. Returns -1 if not found.


function indexOfWithin(_begin, _end : Integer; objs : array of const) : Integer; virtual;

Find out where obj is within the given range.. Returns -1 if not found.


function popBack : DObject; virtual; abstract;

Remove the last element in the sequence, returning its value. That value must be cleaned up or converted with a toXXX function.


function popFront : DObject; virtual; abstract;

Remove the first element in the sequence, returning its value. That value must be cleaned up or converted with a toXXX function.


procedure pushBack(objs : array of const); virtual;

Push values to the back of the container. The values will push in the order specified in the array.


procedure pushFront(objs : array of const); virtual;

Push values to the front of the container. The values will appear at the front of the container in the order given.


procedure putAt(index : Integer; objs : array of const); virtual;

Set the item at a given position.


function removeAtIter(iter : DIterator; count : Integer) : DIterator; virtual; abstract;

Remove count items an iterator is positioned at. All following items move up by count.


procedure removeWithin(_begin, _end : Integer; objs : array of const); virtual;

Remove every occurrence of each of the specified objects within the given range.


procedure replace(sources, targets : array of const); virtual;

Replace sources with targets, pairwise. That is, the first element in sources will be replaced with the first in targets, the second in sources with the second in targets, and so on.


procedure replaceWithin(_begin, _end : Integer; sources, targets : array of const); virtual;

Replace sources with targets, pairwise, in the specified range. That is, the first element in sources will be replaced with the first in targets, the second in sources with the second in targets, and so on.


procedure _add(const obj : DObject); override;

ParameterDescription
objThe object to add.

Add a DObject to this container. The object is copied and added to the container.


function _countWithin(_begin, _end : Integer; const obj : DObject) : Integer; virtual;

Count the number of times an item occurs in a given range.


function _indexOf(const obj : DObject) : Integer; virtual;

Find out where obj is in the collection. Returns -1 if not found.


function _indexOfWithin(_begin, _end : Integer; const obj : DObject) : Integer; virtual;

Find out where obj is within the given range.. Returns -1 if not found.


procedure _pushBack(const obj : DObject); virtual; abstract;

Push an object to the back of the sequence. The object will be copied.


procedure _pushFront(const obj : DObject); virtual; abstract;

Push an object to the front of the container.


procedure _putAt(index : Integer; const obj : DObject); virtual;

Set the item at a given position.


procedure _remove(const obj : DObject); override;

Removes an object, by value, from this sequence.


procedure _removeWithin(_begin, _end : Integer; const obj : DObject); virtual; abstract;

Remove every occurrence of the specified object within the given range.


procedure _replace(obj1, obj2 : DObject); virtual;

Replace every occurrence of obj1 with obj2 in the sequence. Copies will be made of obj2.


procedure _replaceWithin(_begin, _end : Integer; obj1, obj2 : DObject); virtual;

Replace sources with targets, pairwise, in the specified range. That is, the first element in sources will be replaced with the first in targets, the second in sources with the second in targets, and so on.


Properties


Events


Variables