CopperSpice API  1.9.1
QMutableLinkedListIterator< T > Class Template Reference

The QMutableLinkedListIterator class provides a Java style iterator for QLinkedList. More...

Public Methods

 QMutableLinkedListIterator (QLinkedList< T > &list)
 
 ~QMutableLinkedListIterator ()
 
bool findNext (const T &value)
 
bool findPrevious (const T &value)
 
bool hasNext () const
 
bool hasPrevious () const
 
void insert (const T &value)
 
T & next ()
 
QMutableLinkedListIterator & operator= (QLinkedList< T > &list)
 
T & peekNext () const
 
T & peekPrevious () const
 
T & previous ()
 
void remove ()
 
void setValue (const T &value) const
 
void toBack ()
 
void toFront ()
 
T & value ()
 
const T & value () const
 

Detailed Description

template<class T>
class QMutableLinkedListIterator< T >

The QMutableLinkedListIterator class provides a Java style iterator for QLinkedList. For more information refer to Java style iterators.

See also
QLinkedListIterator, QLinkedList::iterator

Constructor & Destructor Documentation

template<class T >
QMutableLinkedListIterator< T >::QMutableLinkedListIterator ( QLinkedList< T > &  list)
inline

Constructs an iterator for traversing list. The iterator is set to be at the front of the list (before the first item).

See also
operator=()
template<class T >
QMutableLinkedListIterator< T >::~QMutableLinkedListIterator ( )
inline

Destroys the iterator.

See also
operator=()

Method Documentation

template<class T >
bool QMutableLinkedListIterator< T >::findNext ( const T &  value)
inline

Searches for value starting from the current iterator position and moving forward. Returns true if the specified value is found, otherwise it returns false. If value is found the iterator is positioned just after the matching item, otherwise the iterator is positioned at the end of the container.

See also
findPrevious()
template<class T >
bool QMutableLinkedListIterator< T >::findPrevious ( const T &  value)
inline

Searches for value starting from the current iterator position and moving backward. Returns true if the specified value is found, otherwise it returns false. If value was found the iterator is positioned just before the matching item. Otherwise the iterator is positioned at the beginning of the container.

See also
findNext()
template<class T >
bool QMutableLinkedListIterator< T >::hasNext ( ) const
inline

Returns true if there is at least one item ahead of the iterator, i.e. the iterator is not at the back of the container, otherwise returns false.

See also
hasPrevious(), next()
template<class T >
bool QMutableLinkedListIterator< T >::hasPrevious ( ) const
inline

Returns true if there is at least one item behind the iterator, i.e. the iterator is not at the front of the container, otherwise returns false.

See also
hasNext(), previous()
template<class T >
void QMutableLinkedListIterator< T >::insert ( const T &  value)
inline

Inserts value at the current iterator position. After the call, the iterator is located just after the inserted item.

See also
remove(), setValue()
template<class T >
T & QMutableLinkedListIterator< T >::next ( )
inline

Returns a reference to the next item, and advances the iterator by one position.

Calling this function on an iterator located at the back of the container leads to undefined behavior.

See also
hasNext(), peekNext(), previous()
template<class T >
QMutableLinkedListIterator & QMutableLinkedListIterator< T >::operator= ( QLinkedList< T > &  list)
inline

Makes the iterator operate on list. The iterator is set to be at the front of the list (before the first item).

See also
toFront(), toBack()
template<class T >
T & QMutableLinkedListIterator< T >::peekNext ( ) const
inline

Returns a reference to the next item, without moving the iterator.

Calling this function on an iterator located at the back of the container leads to undefined behavior.

See also
hasNext(), next(), peekPrevious()
template<class T >
T & QMutableLinkedListIterator< T >::peekPrevious ( ) const
inline

Returns a reference to the previous item, without moving the iterator.

Calling this function on an iterator located at the front of the container leads to undefined behavior.

See also
hasPrevious(), previous(), peekNext()
template<class T >
T & QMutableLinkedListIterator< T >::previous ( )
inline

Returns a reference to the previous item and moves the iterator back by one position. Calling this function on an iterator located at the front of the container leads to undefined behavior.

See also
hasPrevious(), peekPrevious(), next()
template<class T >
void QMutableLinkedListIterator< T >::remove ( )
inline

Removes the last item that was jumped over using one of the traversal functions (next(), previous(), findNext(), findPrevious()).

while (iter.hasNext()) {
int val = iter.next();
if (val < -32768 || val > 32767) {
iter.remove();
}
}
See also
insert(), setValue()
template<class T >
void QMutableLinkedListIterator< T >::setValue ( const T &  value) const
inline

Replaces the value of the last item that was jumped over using one of the traversal functions with value. The traversal functions are next(), previous(), findNext(), and findPrevious().

while (iter.hasNext()) {
double val = iter.next();
iter.setValue(sqrt(val));
}
See also
value(), remove(), insert()
template<class T >
void QMutableLinkedListIterator< T >::toBack ( )
inline

Moves the iterator to the back of the container after the last item.

See also
toFront(), previous()
template<class T >
void QMutableLinkedListIterator< T >::toFront ( )
inline

Moves the iterator to the front of the container before the first item.

See also
toBack(), next()
template<class T >
T & QMutableLinkedListIterator< T >::value ( )
inline

Returns a non-const reference to the value of the last item that was jumped over using one of the traversal functions.

template<class T >
const T & QMutableLinkedListIterator< T >::value ( ) const
inline

Returns the value of the last item which was jumped over using one of the traversal functions (next(), previous(), findNext(), findPrevious()). After a call to next() or findNext(), value() is equivalent to peekPrevious(). After a call to previous() or findPrevious(), value() is equivalent to peekNext().

See also
setValue()