Units
Classes, Interfaces, Objects
Types
Variables
Constants
Functions, Procedures
Identifiers

Class TExContainerType

Unit

rjExAnsiStringVector

Declaration

type TExContainerType = class(TBase04ZeroVector)

Description

Base class for TAnsiStringVector.

Hierarchy

TBase04ZeroVector > TBase04Vector > TExVector > TExContainer > TErrorObject

Fields

None.

Methods

Overview

constructor Create; override;
function ExistAllNamesCS(const ANames: array of TExNameType): Boolean;
function ExistAnyNamesCS(const ANames: array of TExNameType): Boolean;
function ExistsBackNameCI(const AName: TExNameType): Boolean;
function ExistsBackNameCS(const AName: TExNameType): Boolean;
function ExistsNameCI(const AName: TExNameType): Boolean;
function ExistsNameCS(const AName: TExNameType): Boolean;
function ExistsSortedNameCI(const Name: TExNameType): Boolean;
function ExistsSortedNameCS(const Name: TExNameType): Boolean;
function FindDescNameCI(const AName: TExNameType; out Index: Integer): Boolean;
function FindDescNameCS(const AName: TExNameType; out Index: Integer): Boolean;
function FindNameCI(const Name: TExNameType; out Index: Integer): Boolean;
function FindNameCS(const Name: TExNameType; out Index: Integer): Boolean;
function GetFirstName: TExNameType;
function GetLastName: TExNameType;
function GetName(const Item: Pointer): TExNameType;
function GetNameAt(const Index: Integer): TExNameType;
function IndexBackOfNameCI(const AName: TExNameType): Integer;
function IndexBackOfNameCS(const AName: TExNameType): Integer;
function IndexOfNameCI(const AName: TExNameType): Integer;
function IndexOfNameCS(const AName: TExNameType): Integer;
procedure InsertNameAt(const Index: Integer; const AName: TExNameType);
function InsertNameFirst(const Name: TExNameType): Integer;
function InsertNameLast(const Name: TExNameType): Integer;
function InsertNameSortedCI(const Name: TExNameType): Integer;
function InsertNameSortedCIDesc(const AName: TExNameType): Integer;
function InsertNameSortedCS(const AName: TExNameType): Integer;
function InsertNameSortedCSDesc(const AName: TExNameType): Integer;
function ItemOfNameCI(const Name: TExNameType): Pointer;
function ItemOfNameCS(const Name: TExNameType): Pointer;
function LoadFromStream(const Stream: TStream): Boolean; override;
function LoadNamesFromTextFile(const FileName: AnsiString): Boolean;
function LoadNamesFromTextStream(const Stream: TStream): Boolean; virtual;
procedure RemoveAllNamesCI(const AName: TExNameType);
procedure RemoveAllNamesCS(const AName: TExNameType);
procedure RemoveBackAllNamesCI(const AName: TExNameType);
procedure RemoveBackAllNamesCS(const AName: TExNameType);
procedure SaveNamesToTextFile(const FileName: AnsiString);
procedure SaveNamesToTextStream(const Stream: TStream); virtual;
procedure SaveToStream(const Stream: TStream); override;
procedure SetFirstName(const Name: TExNameType);
procedure SetLastName(const Name: TExNameType);
procedure SetName(const Item: Pointer; const Name: TExNameType);
procedure SetNameAt(const Index: Integer; const Name: TExNameType);
procedure SortByNameCI;
procedure SortByNameCIDesc;
procedure SortByNameCS;
procedure SortByNameCSDesc;

Description

constructor Create; override;

 

function ExistAllNamesCS(const ANames: array of TExNameType): Boolean;

Returns True if all of the ANames in the array exist in the Items' Name Elements of the container, otherwise returns False. Comparison starts with the first Item and is case sensitive.

function ExistAnyNamesCS(const ANames: array of TExNameType): Boolean;

Returns True if at least one of the ANames in the array exists in the Items' Name Elements of the container, otherwise returns False. Comparison starts with the first Item and is case sensitive.

function ExistsBackNameCI(const AName: TExNameType): Boolean;

Returns True if AName exists among the Items' Name Elements of the container, otherwise returns False. Comparison starts with the last Item and is case insensitive.

function ExistsBackNameCS(const AName: TExNameType): Boolean;

Returns True if AName exists among the Items' Name Elements of the container, otherwise returns False. Comparison starts with the last Item and is case sensitive.

function ExistsNameCI(const AName: TExNameType): Boolean;

Returns True if AName exists among the Items' Name Elements of the container, otherwise returns False. Comparison starts with the first Item and is case insensitive.

function ExistsNameCS(const AName: TExNameType): Boolean;

Returns True if AName exists among the Items' Name Elements of the container, otherwise returns False. Comparison starts with the first Item and is case sensitive.

function ExistsSortedNameCI(const Name: TExNameType): Boolean;

 

function ExistsSortedNameCS(const Name: TExNameType): Boolean;

 

function FindDescNameCI(const AName: TExNameType; out Index: Integer): Boolean;

 

function FindDescNameCS(const AName: TExNameType; out Index: Integer): Boolean;

 

function FindNameCI(const Name: TExNameType; out Index: Integer): Boolean;

 

function FindNameCS(const Name: TExNameType; out Index: Integer): Boolean;

 

function GetFirstName: TExNameType;

Returns the Name Element of the first Item in the container.

function GetLastName: TExNameType;

Returns the Name Element of the last Item in the container.

function GetName(const Item: Pointer): TExNameType;

Returns the Name Element of the Item pointed to by Item.

function GetNameAt(const Index: Integer): TExNameType;

Returns the Name Element of the Item referenced by a 0-based Index.

function IndexBackOfNameCI(const AName: TExNameType): Integer;

Returns the position of the last occurrence of an Item whose Name Element is the same as AName. Comparison is case insensitive. IndexBackOfNameCI returns the 0-based Index of the Item, i.e. 0 for the Last Item, 1 for the second, and so on. If AName is not in the vector, IndexBackOfNameCI returns -1.

function IndexBackOfNameCS(const AName: TExNameType): Integer;

Returns the position of the last occurrence of an Item whose Name Element is the same as AName. Comparison is case sensitive. IndexBackOfNameCS returns the 0-based Index of the Item, i.e. 0 for the first Item, 1 for the second, and so on. If AName is not in the vector, IndexBackOfNameCS returns -1.

function IndexOfNameCI(const AName: TExNameType): Integer;

Returns the position of the first occurrence of an Item whose Name Element is the same as AName. Comparison starts with the first Item and is case insensitive. IndexOfNameCI returns the 0-based Index of the Item, i.e. 0 for the first Item, 1 for the second, and so on. If AName is not in the vector, IndexOfNameCI returns -1.

function IndexOfNameCS(const AName: TExNameType): Integer;

Returns the position of the first occurrence of an Item whose Name Element is the same as AName. Comparison starts with the first Item and is case sensitive. IndexOfNameCS returns the 0-based Index of the Item, i.e. 0 for the first Item, 1 for the second, and so on. If AName is not in the vector, IndexOfNameCS returns -1.

procedure InsertNameAt(const Index: Integer; const AName: TExNameType);

Inserts a new Item at the position specified by Index and stores AName to the new Item's Name Element.

function InsertNameFirst(const Name: TExNameType): Integer;

Inserts a new Item to the beginning of the vector and stores Name to the new Item's Name Element. InsertNameFirst returns the Index position of the new Item in the vector, where the first Item in the vector has an Index of 0.

function InsertNameLast(const Name: TExNameType): Integer;

Inserts a new Item to the end of the vector and stores Name to the new Item's Name Element. InsertNameLast returns the Index position of the new Item in the vector, where the first Item in the vector has an Index of 0.

function InsertNameSortedCI(const Name: TExNameType): Integer;

Inserts a new Item at the appropriate position to a vector already sorted by its Items' Name Elements in ascending order. The new position will be based on comparisons with AName. The comparison is case insensitive.

AddNameSortedCI relies on the vector to be in sorted order already; do not use it on unsorted vectors. Call SortByNameCI to prepare an unsorted vector for using AddNameSortedCI.

AddNameSortedCI does not allow duplicates in the vector. If AName is already present in the vector, no new Item will be inserted and AName will not be stored.

AddNameSortedCI returns the Index position of the new Item in the vector, where the first Item in the vector has an Index of 0. If no new Item has been added (to avoid duplicates), the result will be -1.

function InsertNameSortedCIDesc(const AName: TExNameType): Integer;

Inserts a new Item at the appropriate position to a vector already sorted by its Items' Name Elements in descending order. The new position will be based on comparisons with AName. The comparison is case insensitive.

AddNameSortedCIDesc relies on the vector to be in sorted order already; do not use it on unsorted vectors. Call SortByNameCIDesc to prepare an unsorted vector for using AddNameSortedCIDesc.

AddNameSortedCIDesc does not allow duplicates in the vector. If AName is already present in the vector, no new Item will be inserted and AName will not be stored.

AddNameSortedCIDesc returns the Index position of the new Item in the vector, where the first Item in the vector has an Index of 0. If no new Item has been added (to avoid duplicates), the result will be -1.

function InsertNameSortedCS(const AName: TExNameType): Integer;

Inserts a new Item at the appropriate position to a vector already sorted by its Items' Name Elements in ascending order. The new position will be based on comparisons with AName. The comparison is case sensitive.

InsertNameSortedCS relies on the vector to be in sorted order already; do not use it on unsorted vectors. Call SortByNameCS to prepare an unsorted vector for using InsertNameSortedCS.

InsertNameSortedCS does not allow duplicates in the vector. If AName is already present in the vector, no new Item will be inserted and AName will not be stored.

InsertNameSortedCS returns the Index position of the new Item in the vector, where the first Item in the vector has an Index of 0. If no new Item has been added (to avoid duplicates), the result will be -1.

function InsertNameSortedCSDesc(const AName: TExNameType): Integer;

Inserts a new Item at the appropriate position to a vector already sorted by its Items' Name Elements in descending order. The new position will be based on comparisons with AName. The comparison is case sensitive.

AddNameSortedCSDesc relies on the vector to be in sorted order already; do not use it on unsorted vectors. Call SortByNameCSDesc to prepare an unsorted vector for using AddNameSortedCSDesc.

AddNameSortedCSDesc does not allow duplicates in the vector. If AName is already present in the vector, no new Item will be inserted and AName will not be stored.

AddNameSortedCSDesc returns the Index position of the new Item in the vector, where the first Item in the vector has an Index of 0. If no new Item has been added (to avoid duplicates), the result will be -1.

function ItemOfNameCI(const Name: TExNameType): Pointer;

 

function ItemOfNameCS(const Name: TExNameType): Pointer;

 

function LoadFromStream(const Stream: TStream): Boolean; override;

Loads the container's Names from a binary stream. If ItemSize is bigger than that of an AnsiString, all additional elements are loaded as raw binary data as they were save with SaveToStream. This stream format is not compatible with text files. To load the names from a text file compatible stream, use LoadFromTextStream.

function LoadNamesFromTextFile(const FileName: AnsiString): Boolean;

Loads the Item's Names from a file which can be read and edited as text. Calls LoadFromTextStream to do the actual reading.

function LoadNamesFromTextStream(const Stream: TStream): Boolean; virtual;

Fills the items' Name Elements with lines of text read from a stream. The text read from the stream is parsed into strings separated by carriage return or linefeed characters.

In contrast to the TStrings' LoadFromStream method, this method does not read the whole stream into memory but starts parsing the lines immediately, using less memory and CPU power.

LoadNamesFromTextStream first clears the container before loading the Names, so all other Elements will be undefined after calling this function.

procedure RemoveAllNamesCI(const AName: TExNameType);

Removes all Items whose Name Element is the same as AName from the container. Comparison is case insensitive.

procedure RemoveAllNamesCS(const AName: TExNameType);

Removes all Items whose Name Element is the same as AName from the container. Comparison is case sensitive.

procedure RemoveBackAllNamesCI(const AName: TExNameType);

Removes all Items whose Name Element is the same as AName from the container starting at the last Item. Comparison is case insensitive.

procedure RemoveBackAllNamesCS(const AName: TExNameType);

Removes all Items whose Name Element is the same as AName from the container starting at the last Item. Comparison is case sensitive.

procedure SaveNamesToTextFile(const FileName: AnsiString);

 

procedure SaveNamesToTextStream(const Stream: TStream); virtual;

Writes the Name Elements of all Items in the container to a stream object. The stream format written by this method is compatible with text files. Call SaveNamesToTextStream to save the Name Elements in the container to the stream specified by the Stream parameter. SaveNamesToTextStream writes the Names delimited by carriage return, line feed pairs. If the stream is a file stream, SaveNamesToTextStream does the same thing as SaveNamesToTextFile, except the application must create and destroy the file stream.

Use LoadValuesFromTextStream to read back a stream written by this method.

procedure SaveToStream(const Stream: TStream); override;

Writes the Name Elements of all Items to a stream object. SaveToStream writes a binary stream format which is not compatible with text files. For writing to a text file compatible stream, use SaveToTextStream instead.

Use LoadFromStream to read back a stream written by this method.

See also:

procedure SetFirstName(const Name: TExNameType);

Stores Name to the Name Element of the first Item in the container.

procedure SetLastName(const Name: TExNameType);

Stores Name to the Name Element of the last Item in the container.

procedure SetName(const Item: Pointer; const Name: TExNameType);

Stores Name to the Name Element of the Item pointed to by Item.

procedure SetNameAt(const Index: Integer; const Name: TExNameType);

Stores Name to the Name Element of the Item referenced by a 0-based Index.

procedure SortByNameCI;

Sorts all Items in the container by their Name Element in ascending order.

The comparison is case insensitive.

procedure SortByNameCIDesc;

Sorts all Items in the container by their Name Element in descending order.

The comparison is case insensitive.

procedure SortByNameCS;

Sorts all Items in the container by their Name Element in ascending order.

The comparison is case sensitive.

procedure SortByNameCSDesc;

Sorts all Items in the container by their Name Element in descending order.

The comparison is case insensitive.

Properties

Overview

FirstName: TExNameType;
LastName: TExNameType;
Name[const Item: Pointer]: TExNameType;
NameAt[const Index: Integer]: TExNameType;

Description

FirstName: TExNameType;

Reads or modifies the Name Element of the first Item in the container.

LastName: TExNameType;

Reads or modifies the Name Element of the last Item in the container.

Name[const Item: Pointer]: TExNameType;

Reads or writes the Name Element of the Item pointed to by Item.

NameAt[const Index: Integer]: TExNameType;

Lists the Name Element of the container's Items, referenced by a 0-based Index. Use Names to read or modify the Name Element of an Item at a particular position. Index gives the position of the Item, where 0 is the position of the first Item, 1 is the position of the second Item, and so on.


rjExContainer Library Version 0.2.
Copyright Ralf Junker 2000-2001.
http://www.zeitungsjunge.de/delphi/.