Soprano::NodeIterator Class Reference

An iterator that provides a stream of Nodes. More...

#include <Soprano/NodeIterator>

Inheritance diagram for Soprano::NodeIterator:
[legend]

List of all members.

Public Member Functions

 NodeIterator ()
 NodeIterator (IteratorBackend< Node > *sti)
 NodeIterator (const NodeIterator &sti)
virtual ~NodeIterator ()
NodeIteratoroperator= (const NodeIterator &)
QList< NodeallNodes ()


Detailed Description

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:

 Soprano::NodeIterator it = model->listContexts();
 QList<Node> allNodes = it.allElements();
 Q_FOREACH( Soprano::Node n, allNodes ) {
    modifyTheModel( model, n );
 }

For further details on Soprano iterators see Iterator.

Warning:
Be aware that iterators in Soprano are shared objects which means that copies of one iterator object work on the same data.
Author:
Sebastian Trueg <trueg@kde.org>

Definition at line 63 of file nodeiterator.h.


Constructor & Destructor Documentation

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 Soprano::NodeIterator::~NodeIterator (  )  [virtual]


Member Function Documentation

NodeIterator& Soprano::NodeIterator::operator= ( const NodeIterator  ) 

QList<Node> Soprano::NodeIterator::allNodes (  )  [inline]

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.

Returns:
A list of all nodes that rest in the iterator.

Definition at line 92 of file nodeiterator.h.


The documentation for this class was generated from the following file:
Generated on Fri Mar 7 18:57:46 2008 for Soprano by  doxygen 1.5.4