Qt 4.8
|
The QAbstractXmlForwardIterator class is a base class for forward iterators. More...
#include <qabstractxmlforwarditerator_p.h>
Public Types | |
typedef QList< QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< T > > > | List |
A QList containing QAbstractXmlForwardIterator::Ptr instances. More... | |
typedef QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< T > > | Ptr |
A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass. More... | |
typedef QVector< QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< T > > > | Vector |
A QVector containing QAbstractXmlForwardIterator::Ptr instances. More... | |
Public Functions | |
virtual QAbstractXmlForwardIterator< T >::Ptr | copy () const |
Copies this QAbstractXmlForwardIterator and returns the copy. More... | |
virtual qint64 | count () |
Determines the number of items this QAbstractXmlForwardIterator represents. More... | |
virtual T | current () const =0 |
Returns the current item in the sequence. More... | |
virtual bool | isEmpty () |
Returns true if the sequence is empty. More... | |
virtual T | last () |
Returns the item at the end of this QAbstractXmlForwardIterator. More... | |
virtual T | next ()=0 |
Returns the next item in the sequence, or a null object if the end has been reached. More... | |
virtual qint64 | position () const =0 |
Returns the current position in the sequence represented by this. More... | |
QAbstractXmlForwardIterator () | |
Default constructor. More... | |
virtual qint64 | sizeHint () const |
Gives a hint to the size of the contained sequence. More... | |
virtual QList< T > | toList () |
Performs a copy of this QAbstractXmlForwardIterator(with copy()), and returns its items in a QList. More... | |
virtual QAbstractXmlForwardIterator< T >::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 | |
QAbstractXmlForwardIteratorPrivate * | d_ptr |
Related Functions | |
(Note that these are not member functions.) | |
template<typename TResult , typename TSource , typename TMapper > | |
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 T &unit) |
The Callback QAbstractXmlForwardIterator uses for determining whether unit is the end of a sequence. More... | |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
The QAbstractXmlForwardIterator class is a base class for forward iterators.
This abstract base class is for creating iterators for traversing custom data structures modeled to look like XML. An item can be instantiated in QAbstractXmlForwardIterator if:
It has a default constructor, a copy constructor, and an assignment operator, and
Definition at line 90 of file qabstractxmlforwarditerator_p.h.
QAbstractXmlForwardIterator< T >::List |
A QList containing QAbstractXmlForwardIterator::Ptr instances.
Definition at line 99 of file qabstractxmlforwarditerator_p.h.
QAbstractXmlForwardIterator< T >::Ptr |
A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass.
Definition at line 98 of file qabstractxmlforwarditerator_p.h.
QAbstractXmlForwardIterator< T >::Vector |
A QVector containing QAbstractXmlForwardIterator::Ptr instances.
Definition at line 100 of file qabstractxmlforwarditerator_p.h.
|
inline |
Default constructor.
Definition at line 102 of file qabstractxmlforwarditerator_p.h.
|
inlinevirtual |
|
virtual |
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 in QPatternist::IteratorVector, QPatternist::AttributeIterator, QPatternist::PrecedingIterator, QPatternist::FollowingIterator, QPatternist::DescendantIterator< IncludeSelf >, QPatternist::SiblingIterator< IsFollowing >, QPatternist::ChildIterator, QPatternist::ListIteratorPlatform< InputType, OutputType, Derived, ListType >, QPatternist::ListIteratorPlatform< QVariant, Item, VariantListIterator >, QPatternist::ListIteratorPlatform< QString, Item, StringListIterator >, QPatternist::ListIteratorPlatform< T, T, ListIterator< T, ListType >, ListType >, QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >, QPatternist::AncestorIterator< IncludeSelf >, QPatternist::SingletonIterator< T >, QPatternist::EmptyIterator< T >, QPatternist::EmptyIterator< QPatternist::Item >, QPatternist::RangeIterator, QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >, QPatternist::RemovalIterator, QPatternist::DistinctIterator, QPatternist::IndexOfIterator, QPatternist::InsertionIterator, QPatternist::SubsequenceIterator, QPatternist::CachingIterator, QPatternist::ToCodepointsIterator, QPatternist::DeduplicateIterator, QPatternist::IntersectIterator, QPatternist::ExceptIterator, and QPatternist::UnionIterator.
Definition at line 317 of file qabstractxmlforwarditerator_p.h.
Referenced by QPatternist::AttributeIterator::AttributeIterator(), QPatternist::ChildIterator::ChildIterator(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::copy(), QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::copy(), QPatternist::FollowingIterator::FollowingIterator(), QPatternist::PrecedingIterator::PrecedingIterator(), and QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
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 in QPatternist::ListIteratorPlatform< InputType, OutputType, Derived, ListType >, QPatternist::ListIteratorPlatform< QVariant, Item, VariantListIterator >, QPatternist::ListIteratorPlatform< QString, Item, StringListIterator >, QPatternist::ListIteratorPlatform< T, T, ListIterator< T, ListType >, ListType >, QPatternist::SingletonIterator< T >, QPatternist::RangeIterator, QPatternist::EmptyIterator< T >, QPatternist::EmptyIterator< QPatternist::Item >, QPatternist::RemovalIterator, QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >, QPatternist::InsertionIterator, QPatternist::ToCodepointsIterator, and QPatternist::DeduplicateIterator.
Definition at line 280 of file qabstractxmlforwarditerator_p.h.
Referenced by QPatternist::DeduplicateIterator::count(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::count(), and QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
pure 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.
Implemented in QPatternist::ListIteratorPlatform< InputType, OutputType, Derived, ListType >, QPatternist::ListIteratorPlatform< QVariant, Item, VariantListIterator >, QPatternist::ListIteratorPlatform< QString, Item, StringListIterator >, QPatternist::ListIteratorPlatform< T, T, ListIterator< T, ListType >, ListType >, QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >, QPatternist::RangeIterator, QPatternist::SingletonIterator< T >, QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >, QPatternist::DistinctIterator, QPatternist::IndexOfIterator, QPatternist::InsertionIterator, QPatternist::RemovalIterator, QPatternist::SubsequenceIterator, StringSplitter, QPatternist::CachingIterator, QPatternist::EmptyIterator< T >, QPatternist::EmptyIterator< QPatternist::Item >, QPatternist::ToCodepointsIterator, QPatternist::IntersectIterator, QPatternist::ExceptIterator, QPatternist::UnionIterator, and QPatternist::AccelIterator.
Referenced by QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
virtual |
Returns true if the sequence is empty.
Definition at line 325 of file qabstractxmlforwarditerator_p.h.
Referenced by QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
virtual |
Returns the item at the end of this QAbstractXmlForwardIterator.
The default implementation calls next() until the end is reached.
Definition at line 306 of file qabstractxmlforwarditerator_p.h.
Referenced by QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
pure virtual |
Returns the next item in the sequence, or a null object if the end has been reached.
Implemented in QPatternist::AttributeIterator, QPatternist::PrecedingIterator, QPatternist::FollowingIterator, QPatternist::DescendantIterator< IncludeSelf >, QPatternist::SiblingIterator< IsFollowing >, QPatternist::ChildIterator, QPatternist::ListIteratorPlatform< InputType, OutputType, Derived, ListType >, QPatternist::ListIteratorPlatform< QVariant, Item, VariantListIterator >, QPatternist::ListIteratorPlatform< QString, Item, StringListIterator >, QPatternist::ListIteratorPlatform< T, T, ListIterator< T, ListType >, ListType >, QPatternist::AncestorIterator< IncludeSelf >, QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >, QPatternist::RangeIterator, QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >, QPatternist::DistinctIterator, QPatternist::IndexOfIterator, QPatternist::InsertionIterator, QPatternist::RemovalIterator, QPatternist::SubsequenceIterator, QPatternist::SingletonIterator< T >, StringSplitter, QPatternist::CachingIterator, QPatternist::ToCodepointsIterator, QPatternist::DeduplicateIterator, QPatternist::EmptyIterator< T >, QPatternist::EmptyIterator< QPatternist::Item >, QPatternist::IntersectIterator, QPatternist::ExceptIterator, and QPatternist::UnionIterator.
Referenced by QPatternist::AttributeIterator::AttributeIterator(), QPatternist::ChildIterator::ChildIterator(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::count(), QAbstractXmlForwardIterator< OutputType >::count(), QPatternist::FollowingIterator::FollowingIterator(), QAbstractXmlForwardIterator< OutputType >::isEmpty(), QAbstractXmlForwardIterator< OutputType >::last(), QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >::next(), QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >::next(), QPatternist::PrecedingIterator::PrecedingIterator(), QAbstractXmlForwardIterator< OutputType >::toList(), QAbstractXmlForwardIterator< OutputType >::toReversed(), and QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
pure 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.
Implemented in QPatternist::ListIteratorPlatform< InputType, OutputType, Derived, ListType >, QPatternist::ListIteratorPlatform< QVariant, Item, VariantListIterator >, QPatternist::ListIteratorPlatform< QString, Item, StringListIterator >, QPatternist::ListIteratorPlatform< T, T, ListIterator< T, ListType >, ListType >, QPatternist::ItemMappingIterator< TResult, TSource, TMapper, Context >, QPatternist::SingletonIterator< T >, QPatternist::RangeIterator, QPatternist::SequenceMappingIterator< TResult, TSource, TMapper >, QPatternist::DistinctIterator, QPatternist::IndexOfIterator, QPatternist::InsertionIterator, QPatternist::RemovalIterator, QPatternist::SubsequenceIterator, QPatternist::EmptyIterator< T >, QPatternist::EmptyIterator< QPatternist::Item >, StringSplitter, QPatternist::CachingIterator, QPatternist::ToCodepointsIterator, QPatternist::IntersectIterator, QPatternist::ExceptIterator, QPatternist::UnionIterator, and QPatternist::AccelIterator.
Referenced by QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
virtual |
Gives a hint to the size of the contained sequence.
The hint is assumed to be as close as possible to the actual size.
If no sensible estimate can be computed, -1 should be returned.
Definition at line 331 of file qabstractxmlforwarditerator_p.h.
Referenced by QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
virtual |
Performs a copy of this QAbstractXmlForwardIterator(with copy()), and returns its items in a QList.
Thus, this function acts as a conversion function, converting the sequence to a QList.
This function may modify the iterator. It is not a getter, but potentially alters the iterator in the same way the next() function does. If this QAbstractXmlForwardIterator must not be modified, such that it can be used for evaluation with next(), use a copy().
Reimplemented in QPatternist::ListIterator< T, ListType >, QPatternist::ListIterator< Item >, and QPatternist::ListIterator< QXmlNodeModelIndexIteratorPointer, QVector< QXmlNodeModelIndexIteratorPointer > >.
Definition at line 265 of file qabstractxmlforwarditerator_p.h.
Referenced by QPatternist::ListIterator< QXmlNodeModelIndexIteratorPointer, QVector< QXmlNodeModelIndexIteratorPointer > >::toList(), and QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
virtual |
Returns a reverse iterator for the sequence.
This function may modify the iterator, it can be considered a function that evaluates this QAbstractXmlForwardIterator. It is not a getter, but potentially alters the iterator in the same way the next() function does. If this QAbstractXmlForwardIterator must not be modified, such that it can be used for evaluation with next(), use a copy().
Reimplemented in QPatternist::SingletonIterator< T >, QPatternist::RangeIterator, QPatternist::EmptyIterator< T >, and QPatternist::EmptyIterator< QPatternist::Item >.
Definition at line 291 of file qabstractxmlforwarditerator_p.h.
Referenced by QAbstractXmlForwardIterator< OutputType >::~QAbstractXmlForwardIterator().
|
related |
An object generator for SequenceMappingIterator.
makeSequenceMappingIterator() is a convenience function for avoiding specifying the full template instantiation for SequenceMappingIterator. Conceptually, it is identical to Qt's qMakePair().
mapper
, source
, and context
. Definition at line 224 of file qsequencemappingiterator_p.h.
|
related |
The Callback QAbstractXmlForwardIterator uses for determining whether unit is the end of a sequence.
If unit is a value that would signal the end of a sequence (typically a default constructed value), this function returns true
, otherwise false
.
This implementation works for any type that has a boolean operator. For example, this function should work satisfactory for pointers.
Definition at line 72 of file qabstractxmlforwarditerator_p.h.
Referenced by QAbstractXmlForwardIterator< OutputType >::count(), QAbstractXmlForwardIterator< OutputType >::isEmpty(), QAbstractXmlForwardIterator< OutputType >::last(), QPatternist::SingletonIterator< T >::SingletonIterator(), QAbstractXmlForwardIterator< OutputType >::toList(), and QAbstractXmlForwardIterator< OutputType >::toReversed().
|
private |
Definition at line 121 of file qabstractxmlforwarditerator_p.h.