#include <utils.h>
Inheritance diagram for itunesdb::utils::SortablePtrVector< ElemType >::FilteredIterator< TUnaryPredicate >:
Public Member Functions | |
FilteredIterator (SortablePtrVector &container, const TUnaryPredicate &predicate=TUnaryPredicate()) | |
Creates a new FilteredIterator over all elements in container matching the given predicate. | |
bool | remove () |
bool | removeRemaining () |
bool | isValid () const |
Returns false if the underlying container got changed outside the control of this iterator, true otherwise. | |
bool | hasNext () const |
Returns true if there are elements left so calling next() would return the next element rather than causing a segfault. | |
ElemType * | next () |
Returns the next element of the range of elements we iterate over. | |
ElemType * | current () const |
Returns the element returned by the last next() call. | |
unsigned int | remaining () const |
Returns the number of elements remaining in this iterator. | |
ElemType * | last () const |
Returns the last element this iterator would return. | |
Protected Types | |
typedef RangeIterator< ElemType *, Iter_T, TUnaryPredicate > | BaseRangeIterator |
The base type of this iterator. | |
Protected Member Functions | |
void | setRange (Iter_Tpos, Iter_Tend) |
Sets the range to the given iterators. | |
Iter_T | currentPos () |
Returns the iterator pointing to the element returned by the last next() call. | |
bool | empty () const |
Returns true if there are no elements left to be iterated over. | |
Protected Attributes | |
Container_T & | m_container |
The container we iterate over. | |
unsigned long | m_containerversion |
The version of the container we iterate over. | |
DefaultDeref< ElemType *, Iter_T > | m_dereferenceFun |
RangeIteratorFunctions< ElemType *, Iter_T, TUnaryPredicate, DefaultDeref< ElemType *, Iter_T > > | m_helper |
Friends | |
class | SortablePtrVector |
ContainerVersionAwareIterator
providing functions to change the underlying container.
typedef RangeIterator< ElemType*, Iter_T, TUnaryPredicate > itunesdb::utils::SortablePtrVector< ElemType >::ContainerVersionAwareIterator< Container_T, Iter_T, TUnaryPredicate >::BaseRangeIterator [protected, inherited] |
The base type of this iterator.
itunesdb::utils::SortablePtrVector< ElemType >::FilteredIterator< TUnaryPredicate >::FilteredIterator | ( | SortablePtrVector & | container, | |
const TUnaryPredicate & | predicate = TUnaryPredicate() | |||
) | [inline] |
Creates a new FilteredIterator over all elements in container matching the given predicate.
container | the container to iterate over | |
predicate | the predicate to match the elements against |
bool itunesdb::utils::SortablePtrVector< ElemType >::FilteredIterator< TUnaryPredicate >::remove | ( | ) | [inline] |
Removes the element returned by the last next() call from the container and positions the iterator at the next element.
bool itunesdb::utils::SortablePtrVector< ElemType >::FilteredIterator< TUnaryPredicate >::removeRemaining | ( | ) | [inline] |
Removes the elements from the current position until the end that are part of this RangeIterator. For filtered iterators only those elements matching the filter get removed.
bool itunesdb::utils::SortablePtrVector< ElemType >::ContainerVersionAwareIterator< Container_T, Iter_T, TUnaryPredicate >::isValid | ( | ) | const [inline, inherited] |
Returns false if the underlying container got changed outside the control of this iterator, true otherwise.
bool itunesdb::utils::SortablePtrVector< ElemType >::ContainerVersionAwareIterator< Container_T, Iter_T, TUnaryPredicate >::hasNext | ( | ) | const [inline, inherited] |
Returns true if there are elements left so calling next() would return the next element rather than causing a segfault.
Reimplemented from itunesdb::utils::RangeIterator< ElemType *, Iter_T, TUnaryPredicate >.
void itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::setRange | ( | Iter_T | pos, | |
Iter_T | end | |||
) | [inline, protected, inherited] |
Sets the range to the given iterators.
Iter_T itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::currentPos | ( | ) | [inline, protected, inherited] |
bool itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::empty | ( | ) | const [inline, protected, inherited] |
Returns true if there are no elements left to be iterated over.
ElemType * itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::next | ( | ) | [inline, inherited] |
Returns the next element of the range of elements we iterate over.
This method positions the Iterator at the next element and returns it. The first call to this method will return the first element of the range.
If the iterator is filtered only those elements where the given predicate returned true are returned.
ElemType * itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::current | ( | ) | const [inline, inherited] |
unsigned int itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::remaining | ( | ) | const [inline, inherited] |
Returns the number of elements remaining in this iterator.
... meaning the number of times the next() method can be called before the hasNext() method willreturn false. For filtered iterators this may be a lengthy operation since the iterator needs to apply its filter over all elements to determine how many elements are left.
ElemType * itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::last | ( | ) | const [inline, inherited] |
Returns the last element this iterator would return.
This method is dangerous and makes no sense. Do not call this for empty iterators so at least check with hasNext() before.
Container_T& itunesdb::utils::SortablePtrVector< ElemType >::ContainerVersionAwareIterator< Container_T, Iter_T, TUnaryPredicate >::m_container [protected, inherited] |
The container we iterate over.
We need this to check our version and validity against
unsigned long itunesdb::utils::SortablePtrVector< ElemType >::ContainerVersionAwareIterator< Container_T, Iter_T, TUnaryPredicate >::m_containerversion [protected, inherited] |
The version of the container we iterate over.
If this differs from m_container.m_version the iterator gets invalid.
DefaultDeref< ElemType * , Iter_T > itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::m_dereferenceFun [protected, inherited] |
Dereferencer to dereference an iterator to IterType
RangeIteratorFunctions<ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > > itunesdb::utils::RangeIterator< ElemType * , Iter_T , TUnaryPredicate , DefaultDeref< ElemType * , Iter_T > >::m_helper [protected, inherited] |
Internal implementors of the underlying functions