#include <Iterator.h>
Inheritance diagram for Patternist::Iterator< T >:


Public Types | |
| typedef QList< typename Iterator< T >::Ptr > | List |
| typedef PlainSharedPtr< Iterator< T > > | Ptr |
| typedef QVector< typename Iterator< T >::Ptr > | Vector |
Public Member Functions | |
| virtual Cardinality | cardinality () |
| virtual Iterator< T >::Ptr | copy () const=0 |
| Copies this Iterator and returns the copy. | |
| virtual xsInteger | count () |
| virtual T | current () const=0 |
| Iterator () | |
| virtual T | next ()=0 |
| virtual xsInteger | position () const=0 |
| virtual QList< T > | toList () |
| virtual Iterator< T >::Ptr | toReversed () |
| virtual | ~Iterator () |
Related Functions | |
| (Note that these are not member functions.) | |
| static Iterator< TResult >::Ptr | makeSequenceMappingIterator (const TMapper &mapper, const PlainSharedPtr< Iterator< TSource > > &source, const DynamicContext::Ptr &context) |
| An object generator for SequenceMappingIterator. | |
In order for an item to be able to be instantiated in Iterator, it needs to:
Definition at line 54 of file Iterator.h.
| typedef QList<typename Iterator<T>::Ptr> Patternist::Iterator< T >::List |
A list of Iterator instances, each wrapped in a smart pointer.
Definition at line 65 of file Iterator.h.
| typedef PlainSharedPtr<Iterator<T> > Patternist::Iterator< T >::Ptr |
A smart pointer wrapping an Item instance.
Definition at line 60 of file Iterator.h.
| typedef QVector<typename Iterator<T>::Ptr> Patternist::Iterator< T >::Vector |
A vector of Iterator instances, each wrapped in a smart pointer.
Definition at line 70 of file Iterator.h.
| Cardinality Patternist::Iterator< T >::cardinality | ( | ) | [virtual] |
Determines the cardinality of the sequence the Iterator this Iterator iterates over. The returned cardinality must not be a union but an exact cardinality; for example, Cardinality::empty() is but Cardinality::zeroOrMore() isn't. Thus, valid return values are Cardinality::empty(), Cardinality::exactlyOne(), and Cardinality::twoOrMore.
The default implementation calls next() for determining the cardinality.
Reimplemented in Patternist::EmptyIterator< T >, Patternist::ListIterator< T >, Patternist::RangeIterator, Patternist::RemovalIterator, Patternist::SingletonIterator< T >, Patternist::ToCodepointsIterator, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
Definition at line 200 of file Iterator.h.
References Patternist::Cardinality::empty(), Patternist::Cardinality::exactlyOne(), Patternist::isIteratorEnd(), Patternist::Iterator< T >::next(), and Patternist::Cardinality::twoOrMore().
Here is the call graph for this function:

| virtual Iterator<T>::Ptr Patternist::Iterator< T >::copy | ( | ) | const [pure virtual] |
Copies this Iterator and returns the copy.
A copy and the original instance are completely independent of each other, and doesn't affect each other in anyway. Since evaluating an Iterator modifies it one should always use a copy when an Iterator needs to be used several times.
Implemented in Patternist::AncestorIterator< IncludeSelf >, Patternist::ChildIterator, Patternist::SiblingIterator< IsFollowing >, Patternist::DescendantIterator< IncludeSelf >, Patternist::FollowingIterator, Patternist::PrecedingIterator, Patternist::AttributeIterator, Patternist::DistinctIterator, Patternist::EmptyIterator< T >, Patternist::IndexOfIterator, Patternist::InsertionIterator, Patternist::ItemMappingIterator< TResult, TSource, TMapper >, Patternist::ListIterator< T >, Patternist::RangeIterator, Patternist::RemovalIterator, Patternist::SequenceMappingIterator< TResult, TSource, TMapper >, Patternist::SingletonIterator< T >, Patternist::SubsequenceIterator, Patternist::ToCodepointsIterator, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
Referenced by Patternist::SequenceMappingIterator< TResult, TSource, TMapper >::copy(), and Patternist::ItemMappingIterator< TResult, TSource, TMapper >::copy().
Here is the caller graph for this function:

| xsInteger Patternist::Iterator< T >::count | ( | ) | [virtual] |
Determines the amount of items this Iterator represents.
Note that this function is not const, it modifies the Iterator as opposed to for example Qt's container classes functions by the same name. The reason for this is efficiency. If this Iterator should stay intact, one should use a copy().
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.
Reimplemented in Patternist::EmptyIterator< T >, Patternist::InsertionIterator, Patternist::ListIterator< T >, Patternist::RangeIterator, Patternist::RemovalIterator, Patternist::SequenceMappingIterator< TResult, TSource, TMapper >, Patternist::SingletonIterator< T >, Patternist::ToCodepointsIterator, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
Definition at line 189 of file Iterator.h.
References Patternist::isIteratorEnd(), and Patternist::Iterator< T >::next().
Here is the call graph for this function:

| virtual T Patternist::Iterator< T >::current | ( | ) | const [pure virtual] |
null is returned. If the end of the sequence have beeen reached null. Implemented in Patternist::AccelIterator, Patternist::DistinctIterator, Patternist::EmptyIterator< T >, Patternist::IndexOfIterator, Patternist::InsertionIterator, Patternist::ItemMappingIterator< TResult, TSource, TMapper >, Patternist::ListIterator< T >, Patternist::RangeIterator, Patternist::RemovalIterator, Patternist::SequenceMappingIterator< TResult, TSource, TMapper >, Patternist::SingletonIterator< T >, Patternist::SubsequenceIterator, Patternist::ToCodepointsIterator, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
| virtual T Patternist::Iterator< T >::next | ( | ) | [pure virtual] |
null if the end has been reached. Implemented in Patternist::AncestorIterator< IncludeSelf >, Patternist::ChildIterator, Patternist::SiblingIterator< IsFollowing >, Patternist::DescendantIterator< IncludeSelf >, Patternist::FollowingIterator, Patternist::PrecedingIterator, Patternist::AttributeIterator, Patternist::DistinctIterator, Patternist::EmptyIterator< T >, Patternist::IndexOfIterator, Patternist::InsertionIterator, Patternist::ItemMappingIterator< TResult, TSource, TMapper >, Patternist::ListIterator< T >, Patternist::RangeIterator, Patternist::RemovalIterator, Patternist::SequenceMappingIterator< TResult, TSource, TMapper >, Patternist::SingletonIterator< T >, Patternist::SubsequenceIterator, Patternist::ToCodepointsIterator, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
Referenced by Patternist::Iterator< T >::cardinality(), Patternist::SequenceMappingIterator< TResult, TSource, TMapper >::count(), Patternist::Iterator< T >::count(), Patternist::SequenceMappingIterator< TResult, TSource, TMapper >::next(), Patternist::ItemMappingIterator< TResult, TSource, TMapper >::next(), Patternist::Iterator< T >::toList(), and Patternist::Iterator< T >::toReversed().
Here is the caller graph for this function:

| virtual xsInteger Patternist::Iterator< T >::position | ( | ) | const [pure virtual] |
Returns the current position in the stream.
The first position is 1, not 0. If next() hasn't been called, 0 is returned. If the end of iterator has been reached, -1 is returned.
Implemented in Patternist::AccelIterator, Patternist::DistinctIterator, Patternist::EmptyIterator< T >, Patternist::IndexOfIterator, Patternist::InsertionIterator, Patternist::ItemMappingIterator< TResult, TSource, TMapper >, Patternist::ListIterator< T >, Patternist::RangeIterator, Patternist::RemovalIterator, Patternist::SequenceMappingIterator< TResult, TSource, TMapper >, Patternist::SingletonIterator< T >, Patternist::SubsequenceIterator, Patternist::ToCodepointsIterator, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
| QList< T > Patternist::Iterator< T >::toList | ( | ) | [virtual] |
Performs a copy of this Iterator(with copy()), and returns its items in a QList. Thus, this function acts as a conversion function, by allowing a sequence of items to be converted into a QList, instead of being represented by an Iterator.
Reimplemented in Patternist::ListIterator< T >.
Definition at line 174 of file Iterator.h.
References Patternist::isIteratorEnd(), and Patternist::Iterator< T >::next().
Here is the call graph for this function:

| Iterator< T >::Ptr Patternist::Iterator< T >::toReversed | ( | ) | [virtual] |
Retrieves an iterator working in a reverse direction over the sequence.
Reimplemented in Patternist::EmptyIterator< T >, Patternist::RangeIterator, Patternist::SingletonIterator< T >, and Patternist::EmptyIterator< Patternist::PlainSharedPtrlainSharedPtr< Item > >.
Definition at line 216 of file Iterator.h.
References Patternist::isIteratorEnd(), and Patternist::Iterator< T >::next().
Here is the call graph for this function:

| static Iterator< TResult >::Ptr makeSequenceMappingIterator | ( | const TMapper & | mapper, | |
| const PlainSharedPtr< Iterator< TSource > > & | source, | |||
| const DynamicContext::Ptr & | context | |||
| ) | [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 185 of file SequenceMappingIterator.h.
1.5.1