Indy 9 | Content | Index | Reference

TIdFTPListItems
Hierarchy, Properties, Methods, Events, See Also, Unit: IdFTPList
Collection that encapsulates an FTP directory listing.

    TIdFTPListItems = class(TCollection)

Unit
IdFTPList
Description
TIdFTPListItems is a TCollection descendant that encapsulates an FTP directory listing, and contains individual TIdFTPListItem objects for each entry in the listing.

TIdFTPListItems.DirectoryName
TIdFTPListItems, See Also
File system directory represented by entries in the collection.

    property DirectoryName: string;

Description
DirectoryName is a public String property that indicates the name of the file system directory represented by the entries in the collection. Use Items to access the entries in the directory listing. Changing the value in DirectoryName causes the collection to be cleared.

TIdFTPListItems.Items
TIdFTPListItems, See Also
Provides indexed access to directory entries in the collection.

    property Items [AIndex: Integer]: TIdFTPListItem;

Parameters
AIndex
Integer position in the collection to be accessed.
Description
Items is an indexed TIdFTPListItem property that provides access to TIdFTPListItem objects contained in the collection using the index specified in AIndex. They are usually created by the TIdFTPList.LoadList method.

TIdFTPListItems.ListFormat
TIdFTPListItems, See Also
Indicates the directory listing format used when parsing in TIdFTPList.LoadList.

    property ListFormat: TIdFTPListFormat;

Description
ListFormat is a TIdFTPListFormat property that indicates the type of directory listing format that should be used when loading the directory listing with the LoadList method. ListFormat us ised in Parse to determine the appropriate parsing mechanism for directory entries in the collection.

ListFormat normally contains the the value returned by the TIdFTPList.CheckListFormat method.

The default value for ListFormat is flfUnix, as assigned in the Create constructor.

TIdFTPListItems.Add
TIdFTPListItems, See Also
Creates a new directory listing entry and adds it to the collection.

    function Add: TIdFTPListItem;

Return Value
TIdFTPListItem - The new directory list item that was created.
Description
Add is a TIdFTPListItem function that creates a new entry for a formatted directory listing, and adds the object instance to the Items in the collection.

TIdFTPListItems.CheckListFormat
TIdFTPListItems, See Also
Determines the appropriate directory list type.

    function CheckListFormat(Data: string; const ADetails: Boolean = False): TIdFTPListFormat; virtual;

Parameters
Data: string
Directory list data
Return Value
TIdFTPListFormat - The appropriate directory listing format type.
Description
CheckListFormat is a TIdFTPListFormat function that determines the appropriate directory list type to be used in the LoadList and Parse methods. CheckListFormat is called when TIdFTP needs to load and parses a directory listing returned from the FTP server. To use this with the LoadList, you need to set the ListFormat property to the return value.

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

    constructor Create; overload;

Description
Create is the constructor for the object instance. Create calls the inherited constructor using TIdFTPListItem as the ItemClass for the collection. Create also sets the default value for the ListFormat property to flfUnix.

TIdFTPListItems.IndexOf
TIdFTPListItems, See Also
Returns the position of a directory entry in the collection.

    function IndexOf(AItem: TIdFTPListItem): Integer;

Parameters
AItem: TIdFTPListItem
Directory entry to be located in the collection.
Return Value
Integer - Position of the item in the collection.
Description
IndexOf is an Integer function that returns the integer position of the directory entry specified in AItem in the Items for the collection. IndexOf will return a value in the range 0 to Count - 1, or -1 when Items does not contain a directory entry item that matches AItem.

TIdFTPListItems.LoadList
TIdFTPListItems, See Also
Loads the Directory listing from a TStrings and parses it based on the value of TIdFTPList.ListFormat.

    procedure LoadList(AData: TStrings);

Parameters
AData: TStrings
The directory listing data to be parsed into the TIdFTPList.
Description
LoadList is a procedure used to load the Directory listing from the TStrings variable AData, and parses directory entries based on the value in TIdFTPList.ListFormat. LoadList will create individual TIdFTPListItem objects, and call the TIdFTPList.Parse method.

TIdFTPListItems.Parse
TIdFTPListItems, See Also
Parses data for a directory entry using the specified ListFormat.

    procedure Parse(ListFormat: TIdFTPListFormat; AItem: TIdFTPListItem);

Parameters
ListFormat: TIdFTPListFormat
The list item format
AItem: TIdFTPListItem
The item that is to be parsed.
Description
This parses the data located in the AItem.Data using the specified layout in in the ListFormat parameter.

TIdFTPListItems.ParseCustom
TIdFTPListItems, See Also
This procedure triggers the IdFTPList.OnParseCustomListFormat event.

    procedure ParseCustom(AItem: TIdFTPListItem); virtual;

Parameters
AItem: TIdFTPListItem
The item that is to be parsed.
Description
This procedure triggers the TIdFTPList.OnParseCustomListFormat event. This event is used to provide custom parsing code. This is sometimes required if a developer needs to support some unusual directory listing formats.

If no TIdFTPList.OnParseCustomListFormat event is provided, an EIdInvalidFTPListingFormat exception is raised.

TIdFTPListItems.ParseUnknown
TIdFTPListItems, See Also
This procedure raises an EIdInvalidFTPListingFormat exception.

    procedure ParseUnknown(AItem: TIdFTPListItem);

Parameters
AItem: TIdFTPListItem
The item that is to be parsed.
Description
This procedure raises an EIdInvalidFTPListingFormat exception. This is done if the ListFormat property is set to flfUnknown.

TIdFTPListItems.OnGetCustomListFormat
TIdFTPListItems, See Also
Gets the text representation of an item in a custom directory listing.

    property OnGetCustomListFormat: TIdOnGetCustomListFormat;

Description
OnGetCustomListFormat is a TIdOnGetCustomListFormat property that represents the event handler signalled when a TIdFTPListItems collection needs to access the text representation of a custom list format for the contents of an FTP listing. The application may assign a procedure to the event handler to allow creation of a custom directory listing when TIdFTPListItems.ListFormat contains the value flfCustom.

TIdFTPListItems.OnParseCustomListFormat
TIdFTPListItems, See Also
Event triggered when custom FTP parsing is desired.

    property OnParseCustomListFormat: TIdOnParseCustomListFormat;

Parameters
AItem
The TIdFTPListItem object that you parse. You parse the Data property and set the other properties as appropriately.
ASender
The object that triggered the event
Description
OnParseCustomListFormat is an event handler triggered by the TIdFTPList.ParseCustom method, and is normally triggered when the TIdFTPList.ListFormat property contains flfCustom.

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