ICursor

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.


ICursor - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class.


[view class]
~ICursor
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
ICursor

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.


Overload 1
protected:
ICursor(Implementation*)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
ICursor(ICursor const&)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Miscellaneous

Use these members to execute miscellaneous tasks.


[view class]
copy
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
invalidate
public:
void invalidate()

Invalidates the cursor; that is, it no longer points to an element of the associated collection.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isValid
public:
IBoolean isValid() const

Returns true if the cursor points to an element of the associated collection.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator !=
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator =
public:
void operator =(ICursor const&)

Returns true if the cursor points to the same element (of the same collection) as the given cursor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
operator ==
public:
IBoolean operator ==(ICursor const&) const

Returns true if the cursor points to the same element (of the same collection) as the given cursor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setToFirst
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.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setToNext
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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


ICursor - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

ICursor

Inherited Protected Data