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

Iterates along the sibling axes in an AccelTree. More...

#include <qacceliterators_p.h>

Inheritance diagram for QPatternist::SiblingIterator< IsFollowing >:
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...
 
 SiblingIterator (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::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

template<const bool IsFollowing>
class QPatternist::SiblingIterator< IsFollowing >

Iterates along the sibling axes in an AccelTree.

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

Definition at line 196 of file qacceliterators_p.h.

Constructors and Destructors

◆ SiblingIterator()

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

Definition at line 199 of file qacceliterators_p.h.

200  : AccelIterator(doc, pre, pre + (IsFollowing ? 0 : -1)),
201  m_depth(doc->depth(pre))
202  {
203  Q_ASSERT_X(IsFollowing || pre != 0, "",
204  "When being preceding-sibling, the context node cannot be the first node in the document.");
205  Q_ASSERT_X(!IsFollowing || pre != m_document->maximumPreNumber(), "",
206  "When being following-sibling, the context node cannot be the last node in the document.");
207  }
const AccelTree::Depth m_depth
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
AccelIterator(const AccelTree *const doc, const AccelTree::PreNumber pre, const AccelTree::PreNumber currentPre)
PreNumber maximumPreNumber() const
Definition: qacceltree_p.h:333
const AccelTree *const m_document

Functions

◆ copy()

template<const bool IsFollowing>
virtual QXmlNodeModelIndex::Iterator::Ptr QPatternist::SiblingIterator< IsFollowing >::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 252 of file qacceliterators_p.h.

253  {
254  return QXmlNodeModelIndex::Iterator::Ptr(new SiblingIterator<IsFollowing>(m_document, m_preNumber));
255  }
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 IsFollowing>
virtual QXmlNodeModelIndex QPatternist::SiblingIterator< IsFollowing >::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 209 of file qacceliterators_p.h.

210  {
211  if(m_currentPre == -1)
212  return QXmlNodeModelIndex();
213 
214  if(IsFollowing)
215  {
216  /* Skip the descendants, and jump to the next node. */
218 
220  return closedExit();
221  else
222  {
223  ++m_position;
225  return m_current;
226  }
227  }
228  else
229  {
231  --m_currentPre;
232 
234  --m_currentPre;
235 
238  {
240  ++m_position;
241  --m_currentPre;
242  return m_current;
243  }
244  else
245  {
246  m_currentPre = -1;
247  return closedExit();
248  }
249  }
250  }
The QXmlNodeModelIndex class identifies a node in an XML node model subclassed from QAbstractXmlNodeM...
QXmlNodeModelIndex m_current
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
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

template<const bool IsFollowing>
const AccelTree::Depth QPatternist::SiblingIterator< IsFollowing >::m_depth
private

Definition at line 258 of file qacceliterators_p.h.


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