~ubuntu-branches/ubuntu/gutsy/soprano/gutsy

« back to all changes in this revision

Viewing changes to soprano/resultset.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-10-12 14:43:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071012144348-yajzi51v4k23ahxf
Tags: 1.95.0~beta2-1ubuntu1
* Sync with Debian
* Add versioned build-dep on raptor

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * This file is part of Soprano Project.
3
 
 *
4
 
 * Copyright (C) 2006 Daniele Galdi <daniele.galdi@gmail.com>
5
 
 * Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
6
 
 *
7
 
 * This library is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU Library General Public
9
 
 * License as published by the Free Software Foundation; either
10
 
 * version 2 of the License, or (at your option) any later version.
11
 
 *
12
 
 * This library is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
 * Library General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU Library General Public License
18
 
 * along with this library; see the file COPYING.LIB.  If not, write to
19
 
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20
 
 * Boston, MA 02110-1301, USA.
21
 
 */
22
 
 
23
 
#ifndef SOPRANO_RESULT_SET_H
24
 
#define SOPRANO_RESULT_SET_H
25
 
 
26
 
#include <QtCore/QString>
27
 
#include <QtCore/QStringList>
28
 
#include <QtCore/QSharedDataPointer>
29
 
 
30
 
#include <soprano/soprano_export.h>
31
 
 
32
 
// FIXME: The ResultSet itself should not behave like an iterator if possible
33
 
namespace Soprano {
34
 
 
35
 
    class Model;
36
 
    class Node;
37
 
    class QueryResult;
38
 
    class Statement;
39
 
 
40
 
    class SOPRANO_EXPORT ResultSet
41
 
    {
42
 
    public:
43
 
        ResultSet();
44
 
        ResultSet( const ResultSet& );
45
 
        ResultSet( QueryResult *qr );
46
 
 
47
 
        virtual ~ResultSet();
48
 
 
49
 
        ResultSet& operator=( const ResultSet& );
50
 
 
51
 
        /**
52
 
         * Advance to the next entry (statement or bindingset)
53
 
         * \return true if the end of the ResultSet was not reached yet.
54
 
         * false if no more entries are found or if the ResultSet was
55
 
         * already invalidated by a call to model.
56
 
         */
57
 
        bool next();
58
 
 
59
 
        /**
60
 
         * Retrieve the current Statement after a call to next.
61
 
         */
62
 
        Statement currentStatement() const;
63
 
 
64
 
        Node binding( const QString &name ) const;
65
 
 
66
 
        Node binding( int offset ) const;
67
 
 
68
 
        int bindingCount() const;
69
 
 
70
 
        QStringList bindingNames() const;
71
 
 
72
 
        bool isGraph() const;
73
 
 
74
 
        bool isBinding() const;
75
 
 
76
 
        bool isBool() const;
77
 
 
78
 
        bool boolValue() const;
79
 
 
80
 
        /**
81
 
         * Retrieve a Model containing all Statements from a graph query.
82
 
         *
83
 
         * After calling this method the ResultSet is invalidated, i.e. can not
84
 
         * be reused.
85
 
         *
86
 
         * \return A new Model containing all result Statements from the graph query
87
 
         * or 0 in case this ResultSet does not represent a graph query or next has
88
 
         * already been called to iterate over the results.
89
 
         * Caution: the caller has to take care of deleting the 
90
 
         * returned model!
91
 
         */
92
 
        Model *model() const;
93
 
 
94
 
    private:
95
 
        class Private;
96
 
        QSharedDataPointer<Private> d;
97
 
    };
98
 
 
99
 
}
100
 
 
101
 
#endif // SOPRANO_RESULT_SET_H