The QMutableSetIterator class provides a Java style iterator for QSet.
More...
template<typename T>
class QMutableSetIterator< T >
The QMutableSetIterator class provides a Java style iterator for QSet. For more information refer to Java style iterators.
It is not possible to iterate backwards over a QSet since the order is not meaningful. This iterator class is similar to QSetIterator with the addition of the remove() method. Modifying a value in a QSet using an iterator is not allowed. Remove the value and then add the new element.
- See also
- QSetIterator, QSet::iterator
template<typename T >
QMutableSetIterator< T >::QMutableSetIterator |
( |
QSet< T > & |
set | ) |
|
|
inline |
Constructs an iterator for traversing set. The iterator is set to be at the front of the set (before the first item).
- See also
- operator=()
template<typename T >
QMutableSetIterator< T >::~QMutableSetIterator |
( |
| ) |
|
|
inline |
template<typename T >
bool QMutableSetIterator< 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.
template<typename T >
bool QMutableSetIterator< 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.
template<typename T >
bool QMutableSetIterator< T >::hasNext |
( |
| ) |
const |
|
inline |
Returns true if there is at least one item ahead of the iterator. This occurs when the iterator is not at the end of the container.
- See also
- next()
template<typename T >
bool QMutableSetIterator< T >::hasPrevious |
( |
| ) |
const |
|
inline |
Returns true if there is at least one item before the iterator. This occurs when the iterator is not at the beginning of the container.
- See also
- next()
template<typename T >
const T & QMutableSetIterator< T >::next |
( |
| ) |
|
|
inline |
Returns 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 results.
- See also
- hasNext(), peekNext(), previous()
template<typename T >
QMutableSetIterator & QMutableSetIterator< T >::operator= |
( |
QSet< T > & |
set | ) |
|
|
inline |
Makes the iterator operate on set. The iterator is set to be at the front of the set (before the first item).
- See also
- toFront(), toBack()
template<typename T >
const T & QMutableSetIterator< T >::peekNext |
( |
| ) |
const |
|
inline |
Returns 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()
template<typename T >
const T & QMutableSetIterator< T >::peekPrevious |
( |
| ) |
const |
|
inline |
Returns the previous item without moving the iterator.
Calling this function on an iterator located at the front of the container leads to undefined results.
- See also
- hasPrevious(), previous(), peekNext()
template<typename T >
const T & QMutableSetIterator< T >::previous |
( |
| ) |
|
|
inline |
Returns 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 results.
- See also
- hasPrevious(), peekPrevious(), next()
template<typename T >
void QMutableSetIterator< T >::remove |
( |
| ) |
|
|
inline |
Removes the last item which was jumped over using one of the traversal functions next() and findNext().
while (iter.hasNext()) {
int val = iter.next();
if (val < -32768 || val > 32767) {
iter.remove();
}
}
- See also
- value()
template<typename T >
void QMutableSetIterator< T >::toBack |
( |
| ) |
|
|
inline |
Moves the iterator to the back of the container (after the last item).
- See also
- toFront()
template<typename T >
void QMutableSetIterator< T >::toFront |
( |
| ) |
|
|
inline |
Moves the iterator to the front of the container (before the first item).
- See also
- toBack(), next()
template<typename T >
const T & QMutableSetIterator< T >::value |
( |
| ) |
const |
|
inline |
Returns the value of the last item that was jumped over using one of the traversal functions next() and findNext().