Class APointerListItem

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type APointerListItem = class(ANode)

Description

This class represents a single entry in APointerList. It extends ANode to allow each one to hold a pointer value. The list item also supports streaming.

Hierarchy

Overview

Fields

Protected myReference: pointer;

Methods

Public constructor withReference(const thisReference: pointer); virtual;
Public function init: boolean; override;
Public function Find(const thisReference: pointer): APointerListItem; virtual;
Public function shallowCopyFrom(const Other: AnObject): boolean; override;
Public function selfStreamingLength: TStreamIOSize; override;
Public function writeSelfTo(const Dest: AStream): TStreamIOSize; override;
Public function readFrom(const Source: AStream): TStreamIOSize; override;
Public function toString: AnsiString; override;
Public function reference: pointer; virtual;
Public function setReference(const newReference: pointer): pointer;

Description

Fields

Protected myReference: pointer;

Stores the value of the list item.

Methods

Public constructor withReference(const thisReference: pointer); virtual;

Construct a new list item that has the specified pointer value.

Public function init: boolean; override;

Initializer

Public function Find(const thisReference: pointer): APointerListItem; virtual;

Search the node, its children, and its older siblings for the specified value.

This method performs a sequential search through each node and so can be inefficient for large lists. It begins by recursively calling itself on any older siblings. If the value is not found, then it searches the current node and its children.

If this method is called on the last item in APointerList, it will result in the entire list being searched.

Returns

A reference to the first node that contains the specified pointer value, if found; Nil if the value was not found.

Public function shallowCopyFrom(const Other: AnObject): boolean; override;

Construct a shallow copy of the other object.

This method overrides the behavior inherited from AnObject.shallowCopyFrom: it calls that method, then checks to see whether Other is an instance of APointerListItem. If so, it copies the value of APointerListItem.reference from Other to Self, overwriting the value in Self.

Note that this method does NOT copy any sibling or child nodes and so cannot be used to create a full copy of any descendant of ANode. The copy will NOT be automatically placed in the list to which Other belongs, if any, but the caller is free to do so.

Public function selfStreamingLength: TStreamIOSize; override;

Calculate the number of bytes required to stream the node, and just the node.

This method builds upon the behavior inherited from ANode.selfStreamingLength: it calls the inherited routine, then calculates the number of bytes required to stream its text and adds that to the result, which is returned to the caller.

Public function writeSelfTo(const Dest: AStream): TStreamIOSize; override;

Write the node, and just the node, to the specified stream. For more information on this method, see ANode.writeSelfTo.

This writes the value of its reference, then calls the inherited routine.

Returns

The total number of bytes written to Dest.

Public function readFrom(const Source: AStream): TStreamIOSize; override;

Read the node from the specified stream. For more information on this method, see ANode.readFrom.

This method reads the value of its pointer reference, then calls the inherited routine.

Returns

The total number of bytes read from Source.

Public function toString: AnsiString; override;

Construct and return a string representation of the node.

In accordance with the criteria described in APrintingObject.toString, this method returns a string representation of Self.reference. The format of the string is controlled by plitStringRepresentation.

Public function reference: pointer; virtual;

Retrieve the pointer value associated with the node.

Public function setReference(const newReference: pointer): pointer;

Set the pointer value associated with the node.

Returns

The old pointer value associated with the node.


Generated by PasDoc 0.13.0 on 2015-06-23 19:40:11