/usr/include/soprano/nodeiterator.h is in libsoprano-dev 2.7.6+dfsg.1-2wheezy1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | /*
* This file is part of Soprano Project.
*
* Copyright (C) 2006 Daniele Galdi <daniele.galdi@gmail.com>
* Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SOPRANO_NODE_ITERATOR_H
#define SOPRANO_NODE_ITERATOR_H
#include "iterator.h"
#include "node.h"
#include "soprano_export.h"
#include <QtCore/QList>
namespace Soprano {
class NodeIteratorBackend;
/**
* \class NodeIterator nodeiterator.h Soprano/NodeIterator
*
* \brief 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:
*
* \code
* Soprano::NodeIterator it = model->listContexts();
* QList<Node> allNodes = it.allElements();
* Q_FOREACH( Soprano::Node n, allNodes ) {
* modifyTheModel( model, n );
* }
* \endcode
*
* Iterators have to be closed.
* This can either be achieved by deleting the iterator, finishing it (next() does return \p 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>
*/
class SOPRANO_EXPORT NodeIterator : public Iterator<Node>
{
public:
/**
* Creates and empty, invalid iterator.
*/
NodeIterator();
/**
* Create a new NodeIterator instance that uses sti as backend.
* NodeIterator will take ownership of the backend.
*/
NodeIterator( IteratorBackend<Node> *sti );
NodeIterator( const NodeIterator &sti );
virtual ~NodeIterator();
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.
*
* \return A list of all nodes that rest in the iterator.
*/
QList<Node> allNodes() { return allElements(); }
};
}
#endif // SOPRANO_NODE_ITERATOR_H
|