Qt 4.8
Public Functions | Properties | List of all members
QPatternist::PrecedingIterator Class Reference

Implements axis preceding for the AccelTree. More...

#include <qacceliterators_p.h>

Inheritance diagram for QPatternist::PrecedingIterator:
QPatternist::AccelIterator QAbstractXmlForwardIterator< T > QSharedData

Public Functions

virtual QXmlNodeModelIndex::Iterator::Ptr copy () const
 Copies this QAbstractXmlForwardIterator and returns the copy. More...
 
virtual QXmlNodeModelIndex next ()
 Returns the next item in the sequence, or a null object if the end has been reached. More...
 
 PrecedingIterator (const AccelTree *const doc, const AccelTree::PreNumber pre)
 
- Public Functions inherited from QPatternist::AccelIterator
virtual QXmlNodeModelIndex current () const
 Returns the current item in the sequence. More...
 
virtual xsInteger position () const
 Returns the current position in the sequence represented by this. More...
 
- Public Functions inherited from QAbstractXmlForwardIterator< T >
virtual qint64 count ()
 Determines the number of items this QAbstractXmlForwardIterator represents. 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...
 
 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

const AccelTree::PreNumber m_postNumber
 

Additional Inherited Members

- Public Types inherited from QAbstractXmlForwardIterator< T >
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 Variables inherited from QSharedData
QAtomicInt ref
 
- Protected Functions inherited from QPatternist::AccelIterator
 AccelIterator (const AccelTree *const doc, const AccelTree::PreNumber pre, const AccelTree::PreNumber currentPre)
 
QXmlNodeModelIndex closedExit ()
 
- Protected Variables inherited from QPatternist::AccelIterator
QXmlNodeModelIndex m_current
 
AccelTree::PreNumber m_currentPre
 
const AccelTree *const m_document
 
xsInteger m_position
 
const AccelTree::PreNumber m_preNumber
 

Detailed Description

Implements axis preceding for the AccelTree.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 367 of file qacceliterators_p.h.

Constructors and Destructors

◆ PrecedingIterator()

QPatternist::PrecedingIterator::PrecedingIterator ( const AccelTree *const  doc,
const AccelTree::PreNumber  pre 
)
inline

@ pre must have at least one child.

Definition at line 373 of file qacceliterators_p.h.

374  : AccelIterator(doc, pre,
375  pre - 1 /* currentPre */)
377  {
378  }
const AccelTree::PreNumber m_preNumber
AccelIterator(const AccelTree *const doc, const AccelTree::PreNumber pre, const AccelTree::PreNumber currentPre)
PostNumber postNumber(const PreNumber pre) const
Definition: qacceltree_p.h:322
const AccelTree *const m_document
const AccelTree::PreNumber m_postNumber

Functions

◆ copy()

QXmlNodeModelIndex::Iterator::Ptr PrecedingIterator::copy ( ) const
virtual

Copies this QAbstractXmlForwardIterator and returns the copy.

Warning
This function is not part of the public interface.

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< T >.

Definition at line 122 of file qacceliterators.cpp.

123 {
125 }
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< T > > Ptr
A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass.
PrecedingIterator(const AccelTree *const doc, const AccelTree::PreNumber pre)
const AccelTree::PreNumber m_preNumber
const AccelTree *const m_document

◆ next()

QXmlNodeModelIndex PrecedingIterator::next ( )
virtual

Returns the next item in the sequence, or a null object if the end has been reached.

Implements QAbstractXmlForwardIterator< T >.

Definition at line 89 of file qacceliterators.cpp.

90 {
91  if(m_currentPre == -1)
92  return closedExit();
93 
94  /* We skip ancestors and attributes and take into account that they can be intermixed. If one
95  * skips them in two separate loops, one can end up with skipping all the attributes to then
96  * be positioned at an ancestor(which will be accepted because the ancestor loop was before the
97  * attributes loop). */
100  {
101  --m_currentPre;
102  if(m_currentPre == -1)
103  return closedExit();
104  }
105 
106  if(m_currentPre == -1)
107  {
108  m_currentPre = -1;
109  return closedExit();
110  }
111 
112  /* Phew, m_currentPre is now 1) not an ancestor; and
113  * 2) not an attribute; and 3) preceds the context node. */
114 
116  ++m_position;
117  --m_currentPre;
118 
119  return m_current;
120 }
QXmlNodeModelIndex m_current
virtual QXmlNodeModelIndex::NodeKind kind(const QXmlNodeModelIndex &ni) const
Returns a value indicating the kind of node identified by ni.
Definition: qacceltree.cpp:214
QXmlNodeModelIndex createIndex(qint64 data) const
Creates a node index with data as its internal data.
PostNumber postNumber(const PreNumber pre) const
Definition: qacceltree_p.h:322
AccelTree::PreNumber m_currentPre
QXmlNodeModelIndex closedExit()
const AccelTree *const m_document
const AccelTree::PreNumber m_postNumber

Properties

◆ m_postNumber

const AccelTree::PreNumber QPatternist::PrecedingIterator::m_postNumber
private

Definition at line 384 of file qacceliterators_p.h.


The documentation for this class was generated from the following files: