KDb

KDbQuerySchemaParameter.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2006-2010 Jarosław Staniek <staniek@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "KDbQuerySchemaParameter.h"
21#include "KDbDriver.h"
22#include "KDbDriverManager_p.h"
23#include "kdb_debug.h"
24
25#include <QWeakPointer>
26
27KDbQuerySchemaParameter::~KDbQuerySchemaParameter()
28{
29}
30
32{
33 dbg.nospace() << "MESSAGE=" << parameter.message() << "TYPE=" << KDbField::typeName(parameter.type());
34 return dbg.space();
35}
36
38{
39 dbg.nospace() << QString::fromLatin1("QUERY PARAMETERS (%1):").arg(list.count());
40 foreach(const KDbQuerySchemaParameter& parameter, list) {
41 dbg.nospace() << " - " << parameter;
42 }
43 return dbg.space();
44}
45
46//================================================
47
48class Q_DECL_HIDDEN KDbQuerySchemaParameterValueListIterator::Private
49{
50public:
51 Private(/*const KDbDriver &driver, */const QList<QVariant>& aParams)
52 : //driverWeakPointer(DriverManagerInternal::self()->driverWeakPointer(driver))
53 params(aParams)
54 {
55 //move to last item, as the order is reversed due to parser's internals
56 paramsIt = params.constEnd();
57 --paramsIt;
58 paramsItPosition = params.count();
59 }
60 //! @todo ?? QWeakPointer<const KDbDriver> driverWeakPointer;
61 const QList<QVariant> params;
63 int paramsItPosition;
64private:
65 Q_DISABLE_COPY(Private)
66};
67
68KDbQuerySchemaParameterValueListIterator::KDbQuerySchemaParameterValueListIterator(
69 const QList<QVariant>& params)
70 : d(new Private(params))
71{
72}
73
74KDbQuerySchemaParameterValueListIterator::~KDbQuerySchemaParameterValueListIterator()
75{
76 delete d;
77}
78
80{
81 if (d->paramsItPosition == 0) { //d->params.constEnd()) {
82 kdbWarning() << "no prev value";
83 return QVariant();
84 }
85 QVariant res(*d->paramsIt);
86 --d->paramsItPosition;
87 --d->paramsIt;
88 return res;
89}
QString typeName() const
Definition KDbField.h:377
An iterator for a list of values of query schema parameters Allows to iterate over parameters and ret...
A single parameter of a query schema.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
QDebug & nospace()
QDebug & space()
qsizetype count() const const
QString arg(Args &&... args) const const
QString fromLatin1(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 19 2024 12:00:07 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.