Each collection defines its own nested cursor class. All of these cursor classes are derived from one of the following classes:
IOrderedCursor is derived from IElementCursor, and IElementCursor is in turn derived from ICursor. Only cursors of ordered collections are derived from IOrderedCursor. Cursors from unordered collections are derived from IElementCursor, and only know the member functions from IElement and ICursor.
Because the cursor classes are all abstract classes, no objects of type IOrderedCursor, IElementCursor, or ICursor can be declared. You can obtain cursor objects by using the collection member IACollection::newCursor or by defining a cursor of a specific collection cursor class. The newCursor() member creates a cursor of the collection to which it is applied.
The newCursor() member returns a pointer to the newly created cursor object.
Each cursor object is associated with a collection object. A cursor function merely calls the corresponding function for this collection. For example, cursor.setToFirst() is the same as collection.setToFirst(cursor), where collection is the object associated with cursor.
You can construct and destruct objects of this class.
![]() |
public:
virtual ~ICursor()
Removes all elements from the collection. Destructors are called for all elements contained in the collection and for elements that have been constructed in advance.
Side Effects
All cursors of the collection become undefined.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Constructs the cursor and associates it with the given collection. The cursor is initially invalid. The name of the constructor is that of the nested cursor class.
protected:
ICursor(Implementation*)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
ICursor(ICursor const&)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to execute miscellaneous tasks.
![]() |
public:
void copy(ICursor const&)
Copies the given cursor to this cursor. This cursor now points to where the given cursor points.
Precondition
The given cursor and this cursor must refer to the same collection type.
Note This precondition cannot be checked.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
void invalidate()
Invalidates the cursor; that is, it no longer points to an element of the associated collection.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean isValid() const
Returns true if the cursor points to an element of the associated collection.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean operator !=(ICursor const&) const
Returns true if the cursor does not point to the same element (of the same collection) as the given cursor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
void operator =(ICursor const&)
Returns true if the cursor points to the same element (of the same collection) as the given cursor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean operator ==(ICursor const&) const
Returns true if the cursor points to the same element (of the same collection) as the given cursor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean setToFirst()
Sets the cursor to the first element of the associated collection in iteration order. Invalidates the cursor if the collection is empty (if no first element exists).
Return Value
Returns true if the associated collection is not empty.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IBoolean setToNext()
Sets the cursor to the next element in the associated collection in iteration order. Invalidates the cursor if no more elements are left to be visited. Returns true if there was a next element.
Precondition
The cursor must point to an element of the associated collection.
Exception
ICursorInvalidException
Windows | OS/2 | AIX |
Yes | Yes | Yes |
inline static Implementation& ImplOf(ICursor const&)