• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

soprano

Soprano::NodeIterator

Soprano::NodeIterator Class Reference

#include <Soprano/NodeIterator>

Inheritance diagram for Soprano::NodeIterator:

Inheritance graph
[legend]

List of all members.


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 );
 }

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.)

Warning:
Be aware that iterators in Soprano are shared objects which means that copies of one iterator object work on the same data.
For further details on Soprano iterators see Iterator.

Author:
Sebastian Trueg <trueg@kde.org>

Definition at line 72 of file nodeiterator.h.


Public Member Functions

QList< Node > allNodes ()
 NodeIterator (const NodeIterator &sti)
 NodeIterator (IteratorBackend< Node > *sti)
 NodeIterator ()
NodeIterator & operator= (const NodeIterator &)
virtual ~NodeIterator ()

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

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 101 of file nodeiterator.h.

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


The documentation for this class was generated from the following file:
  • nodeiterator.h

soprano

Skip menu "soprano"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • akonadi
  • Decibel
  • eigen
  • Eigen2
  • kdewin32
  • Phonon
  •     Backend
  • qca
  • qimageblitz
  • soprano
  • strigi
  •     searchclient
  •     streamanalyzer
  •     streams
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal