Indy 9 | Content | Index | Reference

TIdRFCReplies
Hierarchy, Properties, Methods, See Also, Unit: IdRFCReply
Implements a container for RFC-compliant protocol responses.

    TIdRFCReplies = class(TOwnedCollection)

Unit
IdRFCReply
Description
TIdRFCReplies is a TOwnedCollection descendant that implements a container for maintenance and storage of TIdRFCReply collection items. TIdRFCReplies is used in server applications that generate RFC-compliant protocol response messages that include a numeric response code and associated descriptive text.

The TIdRFCReplies collection provides methods that locate specific response collection items, and update the associated numeric response code and descriptive text for an existing reply.

TIdRFCReplies is the type used to represent the TIdTCPServer.ReplyTexts property.

TIdRFCReplies.Items
TIdRFCReplies, See Also
Provides indexed access to the items in the collection.

    property Items [Index: Integer]: TIdRFCReply;

Description
Items is an indexed TIdRFCReply property used to access individual items in the collection by the ordinal position specified in Index. Items is also the default property accessed when referring to TIdRFCReplies. For example, the following statements return the same values:

          TIdRFCReplies[0]
          TIdRFCReplies.Items[0];

Read access to the Items property insures that the return value is cast to a TIdRFCReply object instance.

Items is used in FindByNumber to locate and return a collection item having a specific numeric code.

TIdRFCReplies.Add
TIdRFCReplies, See Also
Creates a new protocol response item for the collection.

    function Add: TIdRFCReply; overload;

Parameters
ANumericCode
Numeric code for the protocol response.
AText
Descriptive text for the protocol response.
Description
Add is an overloaded TIdRFCReply function in TIdRFCReplies used to create a new TIdRFCReply protocol reponse item for the collection. Add calls the inherited Add method and casts the return value to a TIdRFCReply instance as required in Items.

When Add is called with the arguments ANumericCode and AText, Add attempts locate an exist TIdRFCReply instance having the specified values. If a collection item with the numeric code in ANumericCode already exists, add performs no action and returns Nil. Otherwise, a new collection item is created containing the specified values.

TIdRFCReplies.Add
TIdRFCReplies, See Also
Creates a new protocol response item for the collection.

    function Add(const ANumericCode: Integer; const AText: string): TIdRFCReply; overload;

Parameters
const ANumericCode: Integer
Numeric code for the protocol response.
const AText: string
Descriptive text for the protocol response.
Description
Add is an overloaded TIdRFCReply function in TIdRFCReplies used to create a new TIdRFCReply protocol reponse item for the collection. Add calls the inherited Add method and casts the return value to a TIdRFCReply instance as required in Items.

When Add is called with the arguments ANumericCode and AText, Add attempts locate an exist TIdRFCReply instance having the specified values. If a collection item with the numeric code in ANumericCode already exists, add performs no action and returns Nil. Otherwise, a new collection item is created containing the specified values.

TIdRFCReplies.Create
TIdRFCReplies, See Also
Constructor for the object instance.

    constructor Create(AOwner: TPersistent); reintroduce;

Parameters
AOwner: TPersistent
Owner of the collection.
Description
Create is the constructor for the object instance. Create calls the inherited constructor using AOwner as the owner of the collection and TIdRFCReply as the ItemClass for new Items added to the collection.

TIdRFCReplies.FindByNumber
TIdRFCReplies, See Also
Locates an item in the collection having a specific numeric code.

    function FindByNumber(const ANo: Integer): TIdRFCReply; virtual;

Parameters
const ANo: Integer
Numeric response to locate in the collection.
Description
FindByNumber is a TIdRFCReply function used to locate an existing TIdRFCReply protocol reponse in the collection Items that has the numeric code specified in ANo. FindByNumber will return Nil if a collection tem cannot be found in Items that matches the numeric code in ANo.

TIdRFCReplies.UpdateReply
TIdRFCReplies, See Also
Ensures a collection item having the specified numeric code and text.

    function UpdateReply(const ANumericCode: Integer; const AText: string): TIdRFCReply;

Parameters
const ANumericCode: Integer
Numeric code for the protocol response.
const AText: string
Descriptive text for the protocol response.
Description
UpdateReply is a TIdRFCReply function used to ensure that the collection contains a TIdRFCReply in Items having the numeric code and text specified in the ANumericCode and AText parameters. UpdateReply calls FindByNumber to locate a collection item with the value in ANumericCode, and calls Add if none can be located in Items. UpdateReply sets property values in the TIdRFCReply instance to the numeric code and text specified in the ANumericCode and AText parameters.

TIdRFCReplies.UpdateText
TIdRFCReplies, See Also
Updates text for an RFC response using values from the collection.

    procedure UpdateText(AReply: TIdRFCReply);

Parameters
AReply: TIdRFCReply
RFC response to be updated.
Description
UpdateText is a procedure used to update the descriptive text for the RFC response indicated in AReply using values from a collection item having the same numeric code. UpdateText checks AReply for blank text values, and calls FindByNumber to get a TIdRFCReply from Items having a matching numeric code. If a collection item exists, it is used to assigned the decriptive text to the TIdRFCReply.Text in AReply.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.