Qt 4.8
Public Functions | Properties | List of all members
QPatternist::DescendantIterator< IncludeSelf > Class Template Reference

Implements axis descendant and descendant-or-self for the AccelTree. More...

#include <qacceliterators_p.h>

Inheritance diagram for QPatternist::DescendantIterator< IncludeSelf >:
QPatternist::AccelIterator QAbstractXmlForwardIterator< T > QSharedData

Public Functions

virtual QXmlNodeModelIndex::Iterator::Ptr copy () const
 Copies this QAbstractXmlForwardIterator and returns the copy. More...
 
 DescendantIterator (const AccelTree *const doc, const AccelTree::PreNumber pre)
 
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::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

template<const bool IncludeSelf>
class QPatternist::DescendantIterator< IncludeSelf >

Implements axis descendant and descendant-or-self for the AccelTree.

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

Definition at line 268 of file qacceliterators_p.h.

Constructors and Destructors

◆ DescendantIterator()

template<const bool IncludeSelf>
QPatternist::DescendantIterator< IncludeSelf >::DescendantIterator ( const AccelTree *const  doc,
const AccelTree::PreNumber  pre 
)
inline

pre must have at least one child.

Definition at line 274 of file qacceliterators_p.h.

275  : AccelIterator(doc, pre, pre + (IncludeSelf ? 0 : 1)),
276  m_postNumber(doc->postNumber(pre))
277  {
278  Q_ASSERT(IncludeSelf || m_document->hasChildren(pre));
279 
280  /* Make sure that m_currentPre is the first node part of this axis.
281  * Since we're not including ourself, advance to the node after our
282  * attributes, if any. */
283  if(!IncludeSelf)
284  {
286  {
287  ++m_currentPre;
288  /* We check the depth here because we would otherwise include
289  * following siblings. */
291  {
292  m_currentPre = -1;
293  break;
294  }
295  }
296  }
297  }
#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
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)
PostNumber postNumber(const PreNumber pre) const
Definition: qacceltree_p.h:322
AccelTree::PreNumber m_currentPre
PreNumber maximumPreNumber() const
Definition: qacceltree_p.h:333
const AccelTree *const m_document
const AccelTree::PreNumber m_postNumber

Functions

◆ copy()

template<const bool IncludeSelf>
virtual QXmlNodeModelIndex::Iterator::Ptr QPatternist::DescendantIterator< IncludeSelf >::copy ( ) const
inlinevirtual

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 333 of file qacceliterators_p.h.

334  {
335  return QXmlNodeModelIndex::Iterator::Ptr(new DescendantIterator<IncludeSelf>(m_document, m_preNumber));
336  }
QExplicitlySharedDataPointer< QAbstractXmlForwardIterator< T > > Ptr
A smart pointer wrapping an instance of a QAbstractXmlForwardIterator subclass.
const AccelTree::PreNumber m_preNumber
const AccelTree *const m_document

◆ next()

template<const bool IncludeSelf>
virtual QXmlNodeModelIndex QPatternist::DescendantIterator< IncludeSelf >::next ( )
inlinevirtual

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

Implements QAbstractXmlForwardIterator< T >.

Definition at line 299 of file qacceliterators_p.h.

300  {
301  if(m_currentPre == -1)
302  return closedExit();
303 
304  ++m_position;
306 
307  ++m_currentPre;
308 
310  {
311  m_currentPre = -1;
312  return m_current;
313  }
314 
316  {
318  {
319  ++m_currentPre;
321  {
322  m_currentPre = -1;
323  break;
324  }
325  }
326  }
327  else
328  m_currentPre = -1;
329 
330  return m_current;
331  }
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
PreNumber maximumPreNumber() const
Definition: qacceltree_p.h:333
QXmlNodeModelIndex closedExit()
const AccelTree *const m_document
const AccelTree::PreNumber m_postNumber

Properties

◆ m_postNumber

template<const bool IncludeSelf>
const AccelTree::PreNumber QPatternist::DescendantIterator< IncludeSelf >::m_postNumber
private

Definition at line 339 of file qacceliterators_p.h.


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