Qt 4.8
|
Proxies another QAbstractXmlForwardIterator, and for each item, returns the Item returned from a mapping function. More...
#include <qabstractxmlnodemodel.h>
Public Functions | |
virtual QAbstractXmlForwardIterator< TResult >::Ptr | copy () const |
Copies this QAbstractXmlForwardIterator and returns the copy. More... | |
virtual TResult | current () const |
Returns the current item in the sequence. More... | |
ItemMappingIterator (const TMapper &mapper, const typename QAbstractXmlForwardIterator< TSource >::Ptr &iterator, const Context &context) | |
virtual TResult | next () |
virtual xsInteger | position () const |
Returns the current position in the sequence represented by this. More... | |
Public Functions inherited from QAbstractXmlForwardIterator< TResult > | |
virtual qint64 | count () |
Determines the number of items this QAbstractXmlForwardIterator represents. More... | |
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 Context | m_context |
TResult | m_current |
const QAbstractXmlForwardIterator< TSource >::Ptr | m_it |
const TMapper | m_mapper |
xsInteger | m_position |
Related Functions | |
(Note that these are not member functions.) | |
template<typename TResult , typename TSource , typename TMapper , typename Context > | |
static QAbstractXmlForwardIterator< TResult >::Ptr | makeItemMappingIterator (const TMapper &mapper, const QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< TSource > > &source, const Context &context) |
An object generator for ItemMappingIterator. More... | |
Related Functions inherited from QAbstractXmlForwardIterator< TResult > | |
static QAbstractXmlForwardIterator< TResult >::Ptr | makeSequenceMappingIterator (const TMapper &mapper, const QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< TSource > > &source, const DynamicContext::Ptr &context) |
An object generator for SequenceMappingIterator. More... | |
bool | qIsForwardIteratorEnd (const TResult &unit) |
The Callback QAbstractXmlForwardIterator uses for determining whether unit is the end of a sequence. More... | |
Additional Inherited Members | |
Public Types inherited from QAbstractXmlForwardIterator< TResult > | |
typedef QList< QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< TResult > > > | List |
A QList containing QAbstractXmlForwardIterator::Ptr instances. More... | |
typedef QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< TResult > > | Ptr |
A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass. More... | |
typedef QVector< QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< TResult > > > | Vector |
A QVector containing QAbstractXmlForwardIterator::Ptr instances. More... | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Proxies another QAbstractXmlForwardIterator, and for each item, returns the Item 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.
This is achieved by that ItemMappingIterator's constructor takes an instance of a class, that must have the following member:
For each item in the QAbstractXmlForwardIterator ItemMappingIterator proxies, this function is called and its return value becomes the return value of the ItemMappingIterator. If the mapping function returns null, ItemMappingIterator maps the next item in the source sequence such that a contiguous sequence of items is returned.
Declaring the mapToItem() function as inline, can be a good way to improve performance.
Definition at line 75 of file qabstractxmlnodemodel.h.
|
inline |
Constructs an ItemMappingIterator.
mapper | the object that has the mapToItem() sequence. |
iterator | the QAbstractXmlForwardIterator whose items should be mapped. |
context | the context that will be passed to the map function. May be null. |
Definition at line 103 of file qitemmappingiterator_p.h.
|
inlinevirtual |
Copies this QAbstractXmlForwardIterator and returns the copy.
A copy and the original instance are completely independent of each other. Because evaluating an QAbstractXmlForwardIterator modifies it, one should always use a copy when an QAbstractXmlForwardIterator needs to be used several times.
Reimplemented from QAbstractXmlForwardIterator< TResult >.
Definition at line 151 of file qitemmappingiterator_p.h.
|
inlinevirtual |
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 141 of file qitemmappingiterator_p.h.
|
inlinevirtual |
null
if the end have been reached. Implements QAbstractXmlForwardIterator< TResult >.
Definition at line 118 of file qitemmappingiterator_p.h.
|
inlinevirtual |
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 146 of file qitemmappingiterator_p.h.
|
related |
An object generator for ItemMappingIterator.
makeItemMappingIterator() is a convenience function for avoiding specifying the full template instantiation for ItemMappingIterator. Conceptually, it is identical to Qt's qMakePair().
Definition at line 177 of file qitemmappingiterator_p.h.
|
private |
Definition at line 160 of file qitemmappingiterator_p.h.
Referenced by QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::copy(), and QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::next().
|
private |
Definition at line 161 of file qitemmappingiterator_p.h.
Referenced by QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::current(), and QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::next().
|
private |
Definition at line 159 of file qitemmappingiterator_p.h.
Referenced by QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::copy(), and QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::next().
|
private |
Definition at line 158 of file qitemmappingiterator_p.h.
Referenced by QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::copy(), and QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::next().
|
private |
Definition at line 162 of file qitemmappingiterator_p.h.
Referenced by QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::next(), and QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::position().