Qt 4.8
|
An QAbstractXmlForwardIterator that gets its item from a cache unless its empty, in which case it continues to populate the cache as well as deliver on its own from a source QAbstractXmlForwardIterator. More...
#include <qcachingiterator_p.h>
Public Functions | |
CachingIterator (ItemSequenceCacheCell::Vector &cacheCells, const VariableSlotID slot, const DynamicContext::Ptr &context) | |
virtual Item::Iterator::Ptr | copy () const |
Copies this QAbstractXmlForwardIterator and returns the copy. More... | |
virtual Item | current () const |
Returns the current item in the sequence. More... | |
virtual Item | next () |
Returns the next item in the sequence, or a null object if the end has been reached. More... | |
virtual xsInteger | position () const |
Returns the current position in the sequence represented by this. More... | |
Public Functions inherited from QAbstractXmlForwardIterator< Item > | |
virtual qint64 | count () |
Determines the number of items this QAbstractXmlForwardIterator represents. More... | |
virtual bool | isEmpty () |
Returns true if the sequence is empty. More... | |
virtual Item | 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< Item > | toList () |
Performs a copy of this QAbstractXmlForwardIterator(with copy()), and returns its items in a QList. More... | |
virtual QAbstractXmlForwardIterator< Item >::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 | |
ItemSequenceCacheCell::Vector & | m_cacheCells |
const DynamicContext::Ptr | m_context |
Item | m_current |
xsInteger | m_position |
bool | m_usingCache |
const VariableSlotID | m_varSlot |
An QAbstractXmlForwardIterator that gets its item from a cache unless its empty, in which case it continues to populate the cache as well as deliver on its own from a source QAbstractXmlForwardIterator.
Definition at line 75 of file qcachingiterator_p.h.
CachingIterator::CachingIterator | ( | ItemSequenceCacheCell::Vector & | cacheCells, |
const VariableSlotID | slot, | ||
const DynamicContext::Ptr & | context | ||
) |
We always use the same cache cell so why don't we use it directly, instead of passing the slot and ItemSequenceCacheCell::Vector to this class? Because the GenericDynamicContext might decide to resize the vector and that would invalidate the reference.
We intentionally pass in a non-const reference here.
Definition at line 50 of file qcachingiterator.cpp.
Referenced by copy().
|
virtual |
Copies this QAbstractXmlForwardIterator and returns the copy.
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< Item >.
Definition at line 121 of file qcachingiterator.cpp.
|
virtual |
Returns the current item in the sequence.
If this function is called before the first call to next(), a null object is returned. If the end of the sequence has been reached, a null object is returned.
Implements QAbstractXmlForwardIterator< Item >.
Definition at line 111 of file qcachingiterator.cpp.
|
virtual |
Returns the next item in the sequence, or a null object if the end has been reached.
Implements QAbstractXmlForwardIterator< Item >.
Definition at line 67 of file qcachingiterator.cpp.
|
virtual |
Returns the current position in the sequence represented by this.
The first position is 1, not 0. If next() hasn't been called, 0 is returned. If this has reached the end, -1 is returned.
Implements QAbstractXmlForwardIterator< Item >.
Definition at line 116 of file qcachingiterator.cpp.
|
private |
We intentionally store a reference here such that we are able to modify the item.
Definition at line 115 of file qcachingiterator_p.h.
Referenced by CachingIterator(), copy(), and next().
|
private |
We don't use the context. We only keep a reference such that it doesn't get deleted, and m_cacheCells starts to dangle.
Definition at line 109 of file qcachingiterator_p.h.
Referenced by CachingIterator(), and copy().
|
private |
Definition at line 96 of file qcachingiterator_p.h.
|
private |
Definition at line 97 of file qcachingiterator_p.h.
Referenced by next(), and position().
|
private |
Whether this CachingIterator is delivering items from m_cacheCell.cacheItems or from m_cacheCell.sourceIterator.
Definition at line 121 of file qcachingiterator_p.h.
Referenced by next().
|
private |
This variable cannot be called m_slot, because /usr/include/sys/sysmacros.h on hpuxi-acc defines it.
Definition at line 103 of file qcachingiterator_p.h.
Referenced by CachingIterator(), copy(), and next().