CopperSpice API  1.9.1
QVectorIterator< T > Class Template Reference

The QVectorIterator class provides a Java style const iterator for QVector and QStack. More...

Public Methods

 QVectorIterator (const QVector< T > &vector)
 
bool findNext (const T &value)
 
bool findPrevious (const T &value)
 
bool hasNext () const
 
bool hasPrevious () const
 
const T & next ()
 
QVectorIterator & operator= (const QVector< T > &vector)
 
const T & peekNext () const
 
const T & peekPrevious () const
 
const T & previous ()
 
void toBack ()
 
void toFront ()
 

Detailed Description

template<class T>
class QVectorIterator< T >

The QVectorIterator class provides a Java style const iterator for QVector and QStack. For more information refer to Java style iterators.

See also
QMutableVectorIterator, QVector::const_iterator

Constructor & Destructor Documentation

template<class T >
QVectorIterator< T >::QVectorIterator ( const QVector< T > &  vector)
inline

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

See also
operator=()

Method Documentation

template<class T >
bool QVectorIterator< 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 QVectorIterator< 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 QVectorIterator< T >::hasNext ( ) const
inline

Returns true if there is at least one item ahead of the iterator, otherwise returns false.

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

Returns true if there is at least one item behind the iterator, otherwise returns false.

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

Returns the next item and advances the iterator by one position. Calling this method on an iterator located at the back of the container leads to undefined behavior.

See also
hasNext(), peekNext(), previous()
template<class T >
QVectorIterator & QVectorIterator< T >::operator= ( const QVector< T > &  vector)
inline

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

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

Returns the next item without moving the iterator. Calling this method on an iterator located at the back of the container leads to undefined behavior.

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

Returns the previous item without moving the iterator. Calling this method on an iterator located at the front of the container leads to undefined behavior.

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

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

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

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

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

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

See also
toBack(), next()