SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWSlistCollectablesIterator Class Reference

Iterator for class RWSlistCollectables. Traverses the linked-list from the first to last item. More...

#include <rw/slistcol.h>

Inheritance diagram for RWSlistCollectablesIterator:
RWIterator

Public Member Functions

 RWSlistCollectablesIterator (RWSlistCollectables &s)
 
bool atFirst () const
 
bool atLast () const
 
virtual RWCollectablefindNext (const RWCollectable *target)
 
RWCollectablefindNextReference (const RWCollectable *e)
 
RWCollectableinsertAfterPoint (RWCollectable *a)
 
virtual RWCollectablekey () const
 
virtual RWCollectableoperator() ()
 
void * operator++ ()
 
void * operator+= (size_t n)
 
RWCollectableremove ()
 
RWCollectableremoveNext (const RWCollectable *target)
 
RWCollectableremoveNextReference (const RWCollectable *e)
 
virtual void reset ()
 
void toFirst ()
 
void toLast ()
 

Detailed Description

Iterator for class RWSlistCollectables. Traverses the linked-list from the first to last item.

The "current item" is undefined immediately after construction. You must define it by using operator()() or some other (valid) operation.

Once the iterator has advanced beyond the end of the collection, it is no longer valid; continuing to use it will result in undefined behavior.

Synopsis
// Smalltalk typedef.
typedef RWSlistCollectablesIterator LinkedListIterator;
#include <rw/slistcol.h>
Iterator for class RWSlistCollectables. Traverses the linked-list from the first to last item.
Definition slistcol.h:369
Represents a group of ordered elements without keyed access, where duplicates are allowed.
Definition slistcol.h:56
Persistence
None

Constructor & Destructor Documentation

◆ RWSlistCollectablesIterator()

RWSlistCollectablesIterator::RWSlistCollectablesIterator ( RWSlistCollectables & s)
inline

Constructs an iterator from a singly-linked list. Immediately after construction, the position of the iterator is undefined.

Member Function Documentation

◆ atFirst()

bool RWSlistCollectablesIterator::atFirst ( ) const
inline

Returns true if the iterator is at the beginning of the list, otherwise returns false.

◆ atLast()

bool RWSlistCollectablesIterator::atLast ( ) const
inline

Returns true if the iterator is at the end of the list, otherwise returns false;

◆ findNext()

virtual RWCollectable * RWSlistCollectablesIterator::findNext ( const RWCollectable * target)
inlinevirtual

Moves iterator to the next item that isEqual() to the item pointed to by target and returns it. If no item is found, returns rwnil and the position of the iterator will be undefined.

Implements RWIterator.

◆ findNextReference()

RWCollectable * RWSlistCollectablesIterator::findNextReference ( const RWCollectable * e)
inline

Moves iterator to the next item which is identical to the item pointed to by e (that is, that has address e) and returns it. If no item is found, returns rwnil and the position of the iterator will be undefined.

◆ insertAfterPoint()

RWCollectable * RWSlistCollectablesIterator::insertAfterPoint ( RWCollectable * a)
inline

Insert item a after the current cursor position and return the item. The cursor's position will be unchanged.

◆ key()

virtual RWCollectable * RWSlistCollectablesIterator::key ( ) const
inlinevirtual

Returns the item at the current iterator position.

Implements RWIterator.

◆ operator()()

virtual RWCollectable * RWSlistCollectablesIterator::operator() ( )
inlinevirtual

Advances the iterator and returns the next item, or rwnil if the end of the collection has been reached.

Implements RWIterator.

◆ operator++()

void * RWSlistCollectablesIterator::operator++ ( )
inline

Advances the iterator one item.

◆ operator+=()

void * RWSlistCollectablesIterator::operator+= ( size_t n)
inline

Advances the iterator n items.

◆ remove()

RWCollectable * RWSlistCollectablesIterator::remove ( )
inline

Removes and returns the item at the current cursor position. Afterwards, the iterator will be positioned at the previous item in the list. This function is not very efficient in a singly-linked list.

◆ removeNext()

RWCollectable * RWSlistCollectablesIterator::removeNext ( const RWCollectable * target)
inline

Moves iterator to the next item in the list that isEqual() to the item pointed to by target, removes it from the list and returns it. Afterwards, the iterator will be positioned at the previous item in the list. If no item is found, returns rwnil and the position of the iterator will be undefined.

◆ removeNextReference()

RWCollectable * RWSlistCollectablesIterator::removeNextReference ( const RWCollectable * e)
inline

Moves iterator to the next item in the list which is identical to the item pointed to by e (that is, that has address e), removes it from the list and returns it. Afterwards, the iterator will be positioned at the previous item in the list. If no item is found, returns rwnil and the position of the iterator will be undefined.

◆ reset()

virtual void RWSlistCollectablesIterator::reset ( )
inlinevirtual

Resets the iterator. Afterwards, the position of the iterator will be undefined.

Implements RWIterator.

◆ toFirst()

void RWSlistCollectablesIterator::toFirst ( )
inline

Moves the iterator to the beginning of the list.

◆ toLast()

void RWSlistCollectablesIterator::toLast ( )
inline

Moves the iterator to the end of the list.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.