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

Iterates along the ancestor or ancestor-or-self axis in an AccelTree. More...

#include <qacceliterators_p.h>

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

Public Functions

 AncestorIterator (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...
 

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::AncestorIterator< IncludeSelf >

Iterates along the ancestor or ancestor-or-self axis in an AccelTree.

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

Definition at line 116 of file qacceliterators_p.h.

Constructors and Destructors

◆ AncestorIterator()

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

pre is the node from which iteration starts from. In the ancestor axis it is excluded, while in ancestor-or-self it is included. pre must have at least one ancestor.

Definition at line 125 of file qacceliterators_p.h.

126  : AccelIterator(doc, pre, IncludeSelf ? pre : doc->basicData.at(pre).parent())
127  {
128  Q_ASSERT(IncludeSelf || m_document->hasParent(pre));
129  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool hasParent(const PreNumber pre) const
Definition: qacceltree_p.h:312
AccelIterator(const AccelTree *const doc, const AccelTree::PreNumber pre, const AccelTree::PreNumber currentPre)
const AccelTree *const m_document

Functions

◆ copy()

template<const bool IncludeSelf>
virtual QXmlNodeModelIndex::Iterator::Ptr QPatternist::AncestorIterator< 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 145 of file qacceliterators_p.h.

146  {
147  return QXmlNodeModelIndex::Iterator::Ptr(new AncestorIterator<IncludeSelf>(m_document, m_preNumber));
148  }
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::AncestorIterator< 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 131 of file qacceliterators_p.h.

132  {
133  if(m_currentPre == -1)
134  return closedExit();
135  else
136  {
137  ++m_position;
140 
141  return m_current;
142  }
143  }
QVector< BasicNodeData > basicData
Definition: qacceltree_p.h:276
QXmlNodeModelIndex m_current
QXmlNodeModelIndex createIndex(qint64 data) const
Creates a node index with data as its internal data.
AccelTree::PreNumber m_currentPre
QXmlNodeModelIndex closedExit()
const AccelTree *const m_document

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