Soprano
2.7.2
|
00001 /* 00002 * This file is part of Soprano Project. 00003 * 00004 * Copyright (C) 2009 Sebastian Trueg <trueg@kde.org> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this library; see the file COPYING.LIB. If not, write to 00018 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 */ 00021 00022 #ifndef _SOPRANO_UTIL_ASYNC_QUERY_H_ 00023 #define _SOPRANO_UTIL_ASYNC_QUERY_H_ 00024 00025 #include <QtCore/QObject> 00026 #include "error.h" 00027 #include "sopranotypes.h" 00028 #include "soprano_export.h" 00029 00030 namespace Soprano { 00031 00032 class Statement; 00033 class BindingSet; 00034 class Node; 00035 class Model; 00036 00037 namespace Util { 00076 class SOPRANO_EXPORT AsyncQuery : public QObject, public Error::ErrorCache 00077 { 00078 Q_OBJECT 00079 00080 public: 00088 ~AsyncQuery(); 00089 00091 00095 Statement currentStatement() const; 00096 00101 BindingSet currentBindings() const; 00102 00110 bool boolValue() const; 00112 00114 00124 Node binding( const QString &name ) const; 00125 00136 Node binding( int offset ) const; 00137 00145 int bindingCount() const; 00146 00152 QStringList bindingNames() const; 00154 00156 00162 bool isGraph() const; 00163 00170 bool isBinding() const; 00171 00181 bool isBool() const; 00183 00184 public Q_SLOTS: 00193 bool next(); 00194 00202 void close(); 00203 00204 Q_SIGNALS: 00213 void nextReady( Soprano::Util::AsyncQuery* query ); 00214 00226 void finished( Soprano::Util::AsyncQuery* query ); 00227 00228 public: 00244 static AsyncQuery* executeQuery( Soprano::Model* model, 00245 const QString& query, 00246 Query::QueryLanguage language, 00247 const QString& userQueryLanguage = QString() ); 00248 00249 private: 00250 AsyncQuery(); 00251 00252 class Private; 00253 Private* const d; 00254 00255 Q_PRIVATE_SLOT( d, void _s_finished() ) 00256 Q_PRIVATE_SLOT( d, void _s_emitNextReady() ) 00257 }; 00258 } 00259 } 00260 00261 #endif