Defines collection-type objects (lists, hash tables) for managing interfaces.
Note
|
This unit is intended as a replacement for the deprecated InterfaceCollections.pas unit, which uses the deprecated (in XE4 mobile) TList and pointers.
|
|
Name
|
Description
|
|
TIHashTable<TKey>
|
The TIHashTable class implements and manages a hash table of TKey-interface associations. It stores interfaces (IUnknown and its descendants) indexed by a key. Hash tables provide constant time O(C) search access to any value in the table (using the key) as the table grows (unlike a TList where to search for an item is O(n). The TIHashTable object provides properties and methods to:
• Add or delete the interfaces in the table.
• Locate and access interfaces in the table. |
Note
|
For a small numbers of items, this class may be slower than a TList because its retrieval time constant is larger. It also consumes more memory than a TList.
|
|
|
TInterfaceListIterator
|
The TInterfaceListIterator object provides an enumeration of all the interfaces in a RSInterfaceCollections.TInterfaceListPersistent object, it implements the CommonInterfaces.IInterfaceIterator interface. It effectively hides the underlying implementation, in this case a TInterfaceListPersistent, while still allowing access to all the interfaces stored in the implementation.
The object provides functionality similar to an Enumeration in Java.
To use the iterator is simple, get the iterator and then keep calling the RSInterfaceCollections.TInterfaceListIterator.NextElement method until the RSInterfaceCollections.TInterfaceListIterator.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. The iterator manages its own memory and will free itself when it is completely dereferenced (as long as you use an interface to access it).
|
|
TInterfaceListPersistent
|
To implement a TInterfaceList-clone that is descended from TPersistent and implements the CommonInterfaces.ICloneable interface.
TInterfaceListPersistent represents a list of interfaces.
Use TInterfaceListPersistent to manage a list of interfaces.
Note
|
This class combines features from the old InterfaceCollections|TGInterfaceList and InterfaceCollections|TIList.
|
|
|
TIQueue
|
TIQueue maintains a first-in first-out array, or queue, of interfaces. Use a TIQueue object to store and maintain a first-in first-out list.
To use the class properly as a queue, use the RSInterfaceCollections.TIQueue.Push(IInterface) and RSInterfaceCollections.TIQueue.Pop methods, not Add or Items.
|
|
TIStack
|
Maintains a last-in first-out (LIFO) array, or stack, of interfaces.
Use a TIStack object to store and maintain a last-in first-out list. The TIStack object descends from RSInterfaceCollections.TIQueue but modifies the behavior of the Peek and Pop methods to return the last item added to the list.
|
|
TIStringHashTable
|
The TIStringHashTable class implements and manages a hash table of string-interface associations. It stores interfaces (IUnknown and its descendants) indexed by a string key. Hash tables provide constant time O(C) search access to any value in the table (using the key) as the table grows (unlike a TStringList where to search for an item is O(n). The TIStringHashTable object provides properties and methods to:
• Add or delete the interfaces in the table.
• Locate and access interfaces in the table. |
Note
|
For a small numbers of items, this class may be slower than a TStringList because its retrieval time constant is larger. It also consumes more memory than a TStringList.
|
|
|
TStringsIterator
|
The TStringsIterator object implements the CommonInterfaces.IIterator , CommonInterfaces.IObjectIterator, and CommonInterfaces.IStringIterator interfaces for an underlying TStrings Object. It provides an enumeration of all the items in a TStrings object or its descendants. It effectively hides the underlying implementation, in this case a TStrings, while still allowing access to all the items stored in the implementation.
The object provides functionality similar to an Enumeration in Java.
To use the iterator is simple, get the iterator as an IIterator, IObjectIterator, or IStringIterator interface and then keep calling the NextElement method of the interface 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. The iterator manages its own memory and will free itself when it is completely dereferenced (as long as you use an interface to access it). The NextElement and CurrentElement methods of the IObjectIterator interface have been mapped to the NextElementO and CurrentElementO of this object; it is completely transparent to the user of the interface. Similarly, the NextElementP and CurrentElementP methods implement the NextElement and CurrentElement methods of the IIterator interface.
Note
|
The enumeration guarantees no ordering in the manner that the next element returns items. It just guarantees all items will be returned eventually, with no item appearing twice.
|
|
Top
|
|
Name
|
Description
|
|
TListSortCompare2
|
Compares two interfaces and returns -1, 0, 1.
Used to sort interfaces.
|
Top
|
|
Name
|
Description
|
|
TIList
|
The TIList object stores and manages a list of interfaces. Originally, a descendant of TInterfaceList, it now descends from TInterfaceListPersistent, which improves the list by adding clone and assign methods and a protected Notify method (similar to TList) that may be overridden to notify an owner of list changes. Like any list, it provides properties and methods to:
• Add or delete the objects in the list.
• Rearrange the objects in the list.
• Locate and access objects in the list.
• Sort the objects in the list.
|
|
|
TIListClass
|
Defines the class of TIList classes.
|
|
TIStringList
|
Maintains a list of strings and their associated objects and interfaces. TIStringList is similar to TStringList but also adds a field for interfaces. Use a string list object to store and manipulate a list of strings with interfacaes. TIStringList implements the abstract properties and methods introduced by TStrings, and introduces new properties, events, and methods to
• Add or delete strings at specified positions in the list.
• Rearrange the strings in the list.
• Access the string at a particular location.
• Read the strings from or write the strings to a file or stream.
• Associate an object with each string in the list and, optionally free it when the string is deleted.
• Sort the strings in the list.
• Prohibit duplicate strings in sorted lists.
• Respond to changes in the contents of the list.
|
|
Top
|