File indexing completed on 2024-05-05 04:43:22

0001 /*
0002  *    This file is part of the KDE project
0003  *    Copyright (C) 2015 by Adam Pigg <adam@piggz.co.uk>
0004  *
0005  *    This library is free software; you can redistribute it and/or
0006  *    modify it under the terms of the GNU Library General Public
0007  *    License as published by the Free Software Foundation; either
0008  *    version 2.1 of the License, or (at your option) any later version.
0009  *
0010  *    This library is distributed in the hope that it will be useful,
0011  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  *    Library General Public License for more details.
0014  *
0015  *    You should have received a copy of the GNU Library General Public License
0016  *    along with this library; see the file COPYING.LIB.  If not, write to
0017  *    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  *    Boston, MA 02110-1301, USA.
0019  *
0020 */
0021 
0022 #ifndef KREPORTONERECORDDATA_H
0023 #define KREPORTONERECORDDATA_H
0024 
0025 #include <KReportDataSource.h>
0026 
0027 namespace KReportPrivate {
0028 /**
0029  * @brief A report data source which returns one record
0030  *
0031  * When no other data source is specified the pre-renderer
0032  * will create this as its data source.  This will return
0033  * one record of data, and no fields.  Useful for creating
0034  * a report with a static page of data, or a report page
0035  * generated from a script only.
0036  */
0037 class OneRecordDataSource :  public KReportDataSource
0038 {
0039 public:
0040     OneRecordDataSource();
0041     ~OneRecordDataSource() override;
0042     QVariant value(const QString &field) const override;
0043     QVariant value(int fieldNum) const override;
0044     QStringList fieldNames() const override;
0045     int fieldNumber(const QString &field) const override;
0046     qint64 recordCount() const override;
0047     qint64 at() const override;
0048     bool moveLast() override;
0049     bool moveFirst() override;
0050     bool movePrevious() override;
0051     bool moveNext() override;
0052     bool close() override;
0053     bool open() override;
0054     QStringList dataSourceNames() const override;
0055 };
0056 }
0057 
0058 #endif // KREPORTONERECORDDATA_H