00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010-2011 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (ivan.frade@nokia.com) 00006 ** 00007 ** This file is part of the QtSparql module (not yet part of the Qt Toolkit). 00008 ** 00009 ** $QT_BEGIN_LICENSE:LGPL$ 00010 ** GNU Lesser General Public License Usage 00011 ** This file may be used under the terms of the GNU Lesser General Public 00012 ** License version 2.1 as published by the Free Software Foundation and 00013 ** appearing in the file LICENSE.LGPL included in the packaging of this 00014 ** file. Please review the following information to ensure the GNU Lesser 00015 ** General Public License version 2.1 requirements will be met: 00016 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00017 ** 00018 ** In addition, as a special exception, Nokia gives you certain additional 00019 ** rights. These rights are described in the Nokia Qt LGPL Exception 00020 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 00021 ** 00022 ** GNU General Public License Usage 00023 ** Alternatively, this file may be used under the terms of the GNU General 00024 ** Public License version 3.0 as published by the Free Software Foundation 00025 ** and appearing in the file LICENSE.GPL included in the packaging of this 00026 ** file. Please review the following information to ensure the GNU General 00027 ** Public License version 3.0 requirements will be met: 00028 ** http://www.gnu.org/copyleft/gpl.html. 00029 ** 00030 ** Other Usage 00031 ** Alternatively, this file may be used in accordance with the terms and 00032 ** conditions contained in a signed written agreement between you and Nokia. 00033 ** 00034 ** If you have questions regarding the use of this file, please contact 00035 ** Nokia at ivan.frade@nokia.com. 00036 ** $QT_END_LICENSE$ 00037 ** 00038 ****************************************************************************/ 00039 00040 #ifndef QSPARQLQUERYMODEL_P_H 00041 #define QSPARQLQUERYMODEL_P_H 00042 00043 // 00044 // W A R N I N G 00045 // ------------- 00046 // 00047 // This file is not part of the Qt API. It exists for the convenience 00048 // of qsparql*model.h . This header file may change from version to version 00049 // without notice, or even be removed. 00050 // 00051 // We mean it. 00052 // 00053 00054 #include "QtSparql/qsparqlerror.h" 00055 #include "QtSparql/qsparqlquery.h" 00056 #include "QtSparql/qsparqlresultrow.h" 00057 #include "QtCore/qhash.h" 00058 #include "QtCore/qvarlengtharray.h" 00059 #include "QtCore/qvector.h" 00060 #include "QtCore/qabstractitemmodel.h" 00061 00062 QT_BEGIN_NAMESPACE 00063 00064 class QSparqlQueryModel; 00065 class QSparqlResult; 00066 class QSparqlConnection; 00067 00068 class QSparqlQueryModelPrivate : public QObject 00069 { 00070 Q_OBJECT 00071 public: 00072 QSparqlQueryModelPrivate(QSparqlQueryModel* q_) 00073 : q(q_), result(0), connection(0), atEnd(false), newQuery(false) {} 00074 ~QSparqlQueryModelPrivate(); 00075 void prefetch(int); 00076 void initColOffsets(int size); 00077 00078 QSparqlQueryModel* q; 00079 mutable QSparqlQuery query; 00080 mutable QSparqlError error; 00081 mutable QSparqlResult *result; 00082 const QSparqlConnection* connection; 00083 QModelIndex bottom; 00084 QSparqlResultRow resultRow; 00085 uint atEnd : 1; 00086 QVector<QHash<int, QVariant> > headers; 00087 QVarLengthArray<int, 56> colOffsets; // used to calculate indexInQuery of columns 00088 bool newQuery; 00089 void beginQuery(int totalResults); 00090 public Q_SLOTS: 00091 void addData(int totalResults); 00092 void queryFinished(); 00093 }; 00094 00095 QT_END_NAMESPACE 00096 00097 #endif // QSPARQLQUERYMODEL_P_H