File indexing completed on 2024-04-28 04:41:55
0001 /* This file is part of the KDE project 0002 * Copyright (C) 2007-2010 by Adam Pigg (adam@piggz.co.uk) 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 #include "KReportDataSource.h" 0019 #include <QVariant> 0020 0021 #define KReportDataSortedFieldPrivateArgs(o) std::tie(o.field, o.order) 0022 0023 class KReportDataSource::SortedField::Private 0024 { 0025 0026 public: 0027 Private() {} 0028 Private(const Private& other) { 0029 KReportDataSortedFieldPrivateArgs((*this)) = KReportDataSortedFieldPrivateArgs(other); 0030 } 0031 QString field; 0032 Qt::SortOrder order = Qt::AscendingOrder; 0033 }; 0034 0035 class KReportDataSource::Private 0036 { 0037 public: 0038 bool dummy = true; 0039 }; 0040 0041 //==========KReportData::SortedField========== 0042 0043 KReportDataSource::SortedField::SortedField() 0044 : d(new Private) 0045 { 0046 } 0047 0048 KReportDataSource::SortedField::SortedField(const KReportDataSource::SortedField& other) : d(new Private(*other.d)) 0049 { 0050 } 0051 0052 0053 KReportDataSource::SortedField::~SortedField() 0054 { 0055 delete d; 0056 } 0057 0058 KReportDataSource::SortedField & KReportDataSource::SortedField::operator=(const KReportDataSource::SortedField& other) 0059 { 0060 if (this != &other) { 0061 setField(other.field()); 0062 setOrder(other.order()); 0063 } 0064 return *this; 0065 } 0066 0067 bool KReportDataSource::SortedField::operator==(const KReportDataSource::SortedField& other) const 0068 { 0069 return KReportDataSortedFieldPrivateArgs((*d)) == KReportDataSortedFieldPrivateArgs((*other.d)); 0070 } 0071 0072 bool KReportDataSource::SortedField::operator!=(const KReportDataSource::SortedField& other) const 0073 { 0074 return KReportDataSortedFieldPrivateArgs((*d)) != KReportDataSortedFieldPrivateArgs((*other.d)); 0075 } 0076 0077 QString KReportDataSource::SortedField::field() const 0078 { 0079 return d->field; 0080 } 0081 0082 Qt::SortOrder KReportDataSource::SortedField::order() const 0083 { 0084 return d->order; 0085 } 0086 0087 void KReportDataSource::SortedField::setField(const QString& field) 0088 { 0089 d->field = field; 0090 } 0091 0092 void KReportDataSource::SortedField::setOrder(Qt::SortOrder order) 0093 { 0094 d->order = order; 0095 } 0096 0097 0098 //==========KReportData========== 0099 0100 KReportDataSource::KReportDataSource() : d(new Private()) 0101 { 0102 } 0103 0104 KReportDataSource::~KReportDataSource() 0105 { 0106 delete d; 0107 } 0108 0109 QStringList KReportDataSource::fieldKeys() const 0110 { 0111 return fieldNames(); 0112 } 0113 0114 QString KReportDataSource::sourceName() const 0115 { 0116 return QString(); 0117 } 0118 0119 QString KReportDataSource::sourceClass() const 0120 { 0121 return QString(); 0122 } 0123 0124 void KReportDataSource::setSorting(const QList<SortedField> &sorting) 0125 { 0126 Q_UNUSED(sorting); 0127 } 0128 0129 void KReportDataSource::addCondition(const QString &field, const QVariant &value, const QString& relation) 0130 { 0131 Q_UNUSED(field); 0132 Q_UNUSED(value); 0133 Q_UNUSED(relation); 0134 } 0135 0136 QStringList KReportDataSource::dataSourceNames() const 0137 { 0138 return QStringList(); 0139 } 0140 0141 QString KReportDataSource::dataSourceCaption(const QString &dataSourceName) const 0142 { 0143 return dataSourceName; 0144 } 0145 0146 KReportDataSource* KReportDataSource::create(const QString &source) const 0147 { 0148 Q_UNUSED(source); 0149 return nullptr; 0150 }