Soprano
2.8.0
|
An iterator that provides a stream of Nodes. More...
#include <Soprano/NodeIterator>
Public Member Functions | |
NodeIterator () | |
NodeIterator (IteratorBackend< Node > *sti) | |
NodeIterator (const NodeIterator &sti) | |
virtual | ~NodeIterator () |
NodeIterator & | operator= (const NodeIterator &) |
QList< Node > | allNodes () |
![]() | |
Iterator () | |
Iterator (IteratorBackend< Node > *sti) | |
Iterator (const Iterator &sti) | |
virtual | ~Iterator () |
Iterator & | operator= (const Iterator &) |
void | close () |
bool | next () |
Node | current () const |
Node | operator* () const |
bool | isValid () const |
QList< Node > | allElements () |
![]() | |
virtual | ~ErrorCache () |
virtual Error | lastError () const |
Additional Inherited Members | |
![]() | |
void | setBackend (IteratorBackend< Node > *b) |
IteratorBackend< Node > * | backend () const |
![]() | |
ErrorCache () | |
void | clearError () const |
void | setError (const Error &) const |
void | setError (const QString &errorMessage, int code=ErrorUnknown) const |
An iterator that provides a stream of Nodes.
The most common use of NodeIterator is through Model::listContexts().
Many backends do lock the underlying Model during iteration. Thus, it is always a good idea to cache the results if they are to be used to modify the model to prevent a deadlock:
Iterators have to be closed. This can either be achieved by deleting the iterator, finishing it (next() does return false
), or calling close(). Before that other operations on the Model may block.
Iterators are not thread-safe. Two threads using the same iterator may result in undefined behaviour and even crashes. An iterator needs to be closed by the same thread that opened it (except if the iterator contains special code to handle such a situation.)
For further details on Soprano iterators see Iterator.
Definition at line 72 of file nodeiterator.h.
Soprano::NodeIterator::NodeIterator | ( | ) |
Creates and empty, invalid iterator.
Soprano::NodeIterator::NodeIterator | ( | IteratorBackend< Node > * | sti | ) |
Create a new NodeIterator instance that uses sti as backend. NodeIterator will take ownership of the backend.
Soprano::NodeIterator::NodeIterator | ( | const NodeIterator & | sti | ) |
|
virtual |
NodeIterator& Soprano::NodeIterator::operator= | ( | const NodeIterator & | ) |
Convenience method which extracts all nodes (this does not include the nodes that have already been read from the iterator) from the iterator and returns them in a list.
Be aware that after calling this method the iterator will be invalid.
Definition at line 101 of file nodeiterator.h.