Qt 4.8
|
Proxies another QAbstractXmlForwardIterator, and for each item, returns the Sequence returned from a mapping function. More...
#include <qabstractxmlnodemodel.h>
Public Functions | |
virtual QAbstractXmlForwardIterator< TResult >::Ptr | copy () const |
virtual xsInteger | count () |
Determines the number of items this QAbstractXmlForwardIterator represents. More... | |
virtual TResult | current () const |
Returns the current item in the sequence. More... | |
virtual TResult | next () |
Returns the next item in the sequence, or a null object if the end has been reached. More... | |
virtual xsInteger | position () const |
Returns the current position in the sequence represented by this. More... | |
SequenceMappingIterator (const TMapper &mapper, const typename QAbstractXmlForwardIterator< TSource >::Ptr &sourceIterator, const DynamicContext::Ptr &context) | |
Public Functions inherited from QAbstractXmlForwardIterator< TResult > | |
virtual bool | isEmpty () |
Returns true if the sequence is empty. More... | |
virtual TResult | last () |
Returns the item at the end of this QAbstractXmlForwardIterator. More... | |
QAbstractXmlForwardIterator () | |
Default constructor. More... | |
virtual qint64 | sizeHint () const |
Gives a hint to the size of the contained sequence. More... | |
virtual QList< TResult > | toList () |
Performs a copy of this QAbstractXmlForwardIterator(with copy()), and returns its items in a QList. More... | |
virtual QAbstractXmlForwardIterator< TResult >::Ptr | toReversed () |
Returns a reverse iterator for the sequence. More... | |
virtual | ~QAbstractXmlForwardIterator () |
Destructor. More... | |
Public Functions inherited from QSharedData | |
QSharedData () | |
Constructs a QSharedData object with a reference count of 0. More... | |
QSharedData (const QSharedData &) | |
Constructs a QSharedData object with reference count 0. More... | |
Properties | |
const DynamicContext::Ptr | m_context |
TResult | m_current |
QAbstractXmlForwardIterator< TResult >::Ptr | m_currentIterator |
QAbstractXmlForwardIterator< TSource >::Ptr | m_mainIterator |
const TMapper | m_mapper |
xsInteger | m_position |
Proxies another QAbstractXmlForwardIterator, and for each item, returns the Sequence returned from a mapping function.
ItemMappingIterator is practical when the items in an QAbstractXmlForwardIterator needs to be translated to another sequence, while still doing it in a pipe-lined fashion. In contrast to ItemMappingIterator, SequenceMappingIterator maps each item into another QAbstractXmlForwardIterator, and where the SequenceMappingIterator's own result is the concatenation of all those Iterators. Hence, while ItemMappingIterator is better tailored for one-to-one or one-to-zero conversion, SequenceMappingIterator is more suitable for one-to-many conversion.
This is achieved by that SequenceMappingIterator's constructor takes an instance of a class, that must have the following member:
Definition at line 76 of file qabstractxmlnodemodel.h.
QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::SequenceMappingIterator | ( | const TMapper & | mapper, |
const typename QAbstractXmlForwardIterator< TSource >::Ptr & | sourceIterator, | ||
const DynamicContext::Ptr & | context | ||
) |
Constructs a SequenceMappingIterator.
mapper | the object that has the mapToItem() sequence. |
sourceIterator | the QAbstractXmlForwardIterator whose items should be mapped. |
context | the DynamicContext that will be passed to the map function. May be null. |
Definition at line 131 of file qsequencemappingiterator_p.h.
|
inlinevirtual |
The reason the implementation is placed in line here, is due to a bug in MSVC-2005 version 14.00.50727.762. Note that it works with version 14.00.50727.42.
Reimplemented from QAbstractXmlForwardIterator< TResult >.
Definition at line 113 of file qsequencemappingiterator_p.h.
|
virtual |
Determines the number of items this QAbstractXmlForwardIterator represents.
Note that this function is not const
. It modifies the QAbstractXmlForwardIterator. The reason for this is efficiency. If this QAbstractXmlForwardIterator must not be changed, get a copy() before performing the count.
The default implementation simply calls next() until the end is reached. Hence, it may be of interest to override this function if the sub-class knows a better way of computing its count.
The number of items in the sequence is returned.
Reimplemented from QAbstractXmlForwardIterator< TResult >.
Definition at line 181 of file qsequencemappingiterator_p.h.
|
virtual |
Returns the current item in the sequence.
If this function is called before the first call to next(), a null object is returned. If the end of the sequence has been reached, a null object is returned.
Implements QAbstractXmlForwardIterator< TResult >.
Definition at line 197 of file qsequencemappingiterator_p.h.
|
virtual |
Returns the next item in the sequence, or a null object if the end has been reached.
Implements QAbstractXmlForwardIterator< TResult >.
Definition at line 145 of file qsequencemappingiterator_p.h.
|
virtual |
Returns the current position in the sequence represented by this.
The first position is 1, not 0. If next() hasn't been called, 0 is returned. If this has reached the end, -1 is returned.
Implements QAbstractXmlForwardIterator< TResult >.
Definition at line 203 of file qsequencemappingiterator_p.h.
|
private |
Definition at line 126 of file qsequencemappingiterator_p.h.
Referenced by QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::copy(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::count(), and QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next().
|
private |
Definition at line 123 of file qsequencemappingiterator_p.h.
Referenced by QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::current(), and QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next().
|
private |
Definition at line 125 of file qsequencemappingiterator_p.h.
Referenced by QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next().
|
private |
Definition at line 124 of file qsequencemappingiterator_p.h.
Referenced by QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::copy(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::count(), and QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next().
|
private |
Definition at line 127 of file qsequencemappingiterator_p.h.
Referenced by QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::copy(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::count(), and QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next().
|
private |
Definition at line 122 of file qsequencemappingiterator_p.h.
Referenced by QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next(), and QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::position().