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

Iterates along the child axis in an AccelTree. More...

#include <qacceliterators_p.h>

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

Public Functions

 ChildIterator (const AccelTree *const doc, const AccelTree::PreNumber pre)
 
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...
 
- 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::Depth m_depth
 

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

Iterates along the child axis in an AccelTree.

Author
Frans Englichfrans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 156 of file qacceliterators_p.h.

Constructors and Destructors

◆ ChildIterator()

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

pre must have at least one child.

Definition at line 162 of file qacceliterators_p.h.

163  : AccelIterator(doc, pre, pre + 1),
165  {
167 
168  /* Skip the attributes, that are children in the pre/post plane, of
169  * the node we're applying the child axis to. */
171  {
172  ++m_currentPre;
173  /* We check the depth here because we would otherwise include
174  * following siblings. */
176  {
177  m_currentPre = -1;
178  break;
179  }
180  }
181  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool hasChildren(const PreNumber pre) const
Returns true if the node identified by pre has child nodes(in the sense of the XDM), but also if it has namespace nodes, or attribute nodes.
Definition: qacceltree_p.h:294
Depth depth(const PreNumber pre) const
Definition: qacceltree_p.h:350
const AccelTree::Depth m_depth
virtual QXmlNodeModelIndex::NodeKind kind(const QXmlNodeModelIndex &ni) const
Returns a value indicating the kind of node identified by ni.
Definition: qacceltree.cpp:214
AccelIterator(const AccelTree *const doc, const AccelTree::PreNumber pre, const AccelTree::PreNumber currentPre)
AccelTree::PreNumber m_currentPre
PreNumber maximumPreNumber() const
Definition: qacceltree_p.h:333
const AccelTree *const m_document

Functions

◆ copy()

QXmlNodeModelIndex::Iterator::Ptr ChildIterator::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 151 of file qacceliterators.cpp.

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

◆ next()

QXmlNodeModelIndex ChildIterator::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 132 of file qacceliterators.cpp.

133 {
134  if(m_currentPre == -1)
135  return closedExit();
136 
137  ++m_position;
139 
140  /* We get the count of the descendants, and increment m_currentPre. After
141  * this, m_currentPre is the node after the descendants. */
143  ++m_currentPre;
144 
146  m_currentPre = -1;
147 
148  return m_current;
149 }
QXmlNodeModelIndex m_current
Depth depth(const PreNumber pre) const
Definition: qacceltree_p.h:350
const AccelTree::Depth m_depth
QXmlNodeModelIndex createIndex(qint64 data) const
Creates a node index with data as its internal data.
AccelTree::PreNumber m_currentPre
PreNumber maximumPreNumber() const
Definition: qacceltree_p.h:333
PreNumber size(const PreNumber pre) const
Definition: qacceltree_p.h:343
QXmlNodeModelIndex closedExit()
const AccelTree *const m_document

Properties

◆ m_depth

const AccelTree::Depth QPatternist::ChildIterator::m_depth
private

Definition at line 187 of file qacceliterators_p.h.


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