Indy 9 | Content | Index | Reference

TIdMessageDecoderList
Hierarchy, Methods, See Also, Unit: IdMessageCoder
Provides a framework for registering and retrieving decoder classes for RFC 822 message parts.

    TIdMessageDecoderList = class(TObject)

Unit
IdMessageCoder
Description
TIdMessageDecoderList is a TObject descendant that provides a framework for registering and retrieving decoder classes for RFC 822-compliant message parts.

All methods in TIdMessageDecoderList, except the Constructor and Destructor, are class methods that provide for registering a new decoder class, accessing a decoder by name, and determining when a decoder is appropriate for use on a given message part.

TIdMessageDecoderList.ByName
TIdMessageDecoderList, See Also
Locates an instance of a registered decoder class by name.

    class function ByName(const AName: string): TIdMessageDecoderInfo;

Parameters
const AName: string
Decoder class name to be located.
Return Value
TIdMessageDecoderInfo - Container that holds information and class type for the registered decoder class.
Description
ByName is a TIdMessageDecoderInfo class function used to locate an instance of a registered decoder class by the name specified in AName. ByName searches the global list of registerd decoder classes to locate an instance with a name matching AName.

If there is no registered decoder class with a name matching AName, an EIdException is raised with the constant message RSMessageDecoderNotFound and the value in AName.

TIdMessageDecoderList.CheckForStart
TIdMessageDecoderList, See Also
Determines the registered decoder class instance to be used for an RFC 822 message part.

    class function CheckForStart(ASender: TIdMessage; const ALine: string): TIdMessageDecoder;

Parameters
ASender: TIdMessage
Message to be associated with the decoder class instance.
const ALine: string
Text to be examined to determine the decoder needed for the message part.
Return Value
TIdMessageDecoder - Decoder class instance for the message part.
Description
CheckForStart is a TIdMessageDecoder class function in TIdMessageDecoderList that determines the registered decoder class instance to be used for an RFC 822 message part.

CheckForStart examines the list of registered decoder classes, and calls the TIdMessageDecoderInfo.CheckForStart method for each instance. When a decoder class is found for the message part, the method exits and returns the TIdMessageDecoderInfo instance for the message part. If no decoder class is located for the message part, the return value for CheckForStart is Nil.

TIdMessageDecoderList.Create
TIdMessageDecoderList
Constructor for the object instance.

    constructor Create;

Description
Create is the Constructor for the object instance, and relies on the inherited Create method. Create also initializes an internal list used to identify and retrieve registered message decoder class instances.

TIdMessageDecoderList.Destroy
TIdMessageDecoderList, See Also
Destructor for the object instance.

    destructor Destroy; override;

Description
Destroy is the Destructor for the object instance. Destroy iterates over a list of the registered decoder class instances, and frees each TIdMessageDecoderInfo instance. When all registered decoder class instances have been freed, Destroy also frees the list. Finally, Destroy calls the inherited Destroy method.

TIdMessageDecoderList.RegisterDecoder
TIdMessageDecoderList, See Also
Adds a decoder class to the list of registered decoder classes.

    class procedure RegisterDecoder(const AMessageCoderName: string; AMessageCoderInfo: TIdMessageDecoderInfo);

Parameters
const AMessageCoderName: string
Name to used for identification of the registered decoder class.
AMessageCoderInfo: TIdMessageDecoderInfo
Decoder class information to be registered.
Description
RegisterDecoder is a class procedure in TIdMessageDecoderList that adds information about decoder classes for RFC message parts to the list of registered decoder classes.

RegisterDecoder checks to make sure that the list for registered decoder classes has been initalized to an instance of TIdMessageDecoderList. RegisterDecoder then adds the decoder information in AMessageCoderInfo to the list with the name specified in AMessageCoderName.

RegisterDecoder is called in the initialization section of the unit that contains the decoder class, like IdMessageCoderMIME.pas, IdMessageCoderUUE.pas, and IdMessageCoderXXE.pas.

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