The IInterfaceIterator interface describes an abstract interface for enumerating over a list of interfaces. It effectively hides the underlying implementation, whether a TInterfaceList, a interface hash table or other structure, while still allowing access to all the interfaces stored in the implementation.
The IInterfaceIterator interface is similar to an Enumeration in java.
To use the iterator is simple, get the iterator and then keep calling the
NextElement method until the
HasMoreElements method returns False. The iterator works by giving you the next element until the end of the list, there is no provision for getting the previous element.
Namespace: CommonInterfaces
Delphi
|
type
IInterfaceIterator = interface
['{E1A337B7-D59B-11D3-B9BF-00C04F8EDA5F}']
end;
|
|
Name
|
Description
|
|
Count
|
Returns the number of items left in the enumeration.
|
Top
|
|
Name
|
Description
|
|
CurrentElement
|
Returns the current item in the enumeration, your "place" in the enumeration.
When the iterator is first supplied or when it is Reset, there is no current element (calling this method in such a case should raise an exception). Only after the first call to the NextElement method will this method return a value.
Unlike the NextElement method which returns a new value every time you call it, this method always returns the same value no matter how many times you call it (until NextElement is called, of course).
|
|
GetCount
|
Returns the number of items left in the enumeration.
Accessor method for Count property.
|
|
get_Count
|
Returns the number of items left in the enumeration.
Accessor method for Count property.
Note
|
Required by VCL.Net
|
|
|
HasMoreElements
|
Returns True if there are more elements to retrieve from the enumeration. While this method returns true, the NextElement method should not raise an exception.
|
|
NextElement
|
Returns the next item in the enumeration. If there are no more items, the method should raise an exception.
To check if there are more items, use the HasMoreElements method. The NextElement method advances its place in the enumeration and then returns that item. Every call to NextElement returns a new item (until the end of the enumeration). If you wish to access the current item multiple times in a loop, use the CurrentElement method.
|
|
Reset
|
Resets the iterator to the beginning of the enumeration.
|
Top
|
The InterfaceCollections unit contains some implementations of the iterators for common objects.
|