1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the test suite of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
53 #ifndef Patternist_PushBaseliner_h
54 #define Patternist_PushBaseliner_h
56 #include <QTextStream>
57 #include <QtXmlPatterns/QAbstractXmlReceiver>
58 #include <QtXmlPatterns/QXmlNamePool>
59 #include <QtXmlPatterns/QXmlNamePool>
61 class PushBaseliner : public QAbstractXmlReceiver
64 PushBaseliner(QTextStream &out,
65 const QXmlNamePool &namePool) : m_out(out)
66 , m_namePool(namePool)
71 virtual void startElement(const QXmlName&);
72 virtual void endElement();
73 virtual void attribute(const QXmlName&, const QStringRef&);
74 virtual void comment(const QString&);
75 virtual void characters(const QStringRef&);
76 virtual void startDocument();
77 virtual void endDocument();
78 virtual void processingInstruction(const QXmlName&, const QString&);
79 virtual void atomicValue(const QVariant&);
80 virtual void namespaceBinding(const QXmlName&);
81 virtual void startOfSequence();
82 virtual void endOfSequence();
86 const QXmlNamePool m_namePool;
89 bool PushBaseliner::isValid() const
94 void PushBaseliner::startElement(const QXmlName &name)
96 m_out << "startElement(" << name.toClarkName(m_namePool) << ')'<< endl;
99 void PushBaseliner::endElement()
101 m_out << "endElement()" << endl;
104 void PushBaseliner::attribute(const QXmlName &name, const QStringRef &value)
106 m_out << "attribute(" << name.toClarkName(m_namePool) << ", " << value.toString() << ')'<< endl;
109 void PushBaseliner::comment(const QString &value)
111 m_out << "comment(" << value << ')' << endl;
114 void PushBaseliner::characters(const QStringRef &value)
116 m_out << "characters(" << value.toString() << ')' << endl;
119 void PushBaseliner::startDocument()
121 m_out << "startDocument()" << endl;
124 void PushBaseliner::endDocument()
126 m_out << "endDocument()" << endl;
129 void PushBaseliner::processingInstruction(const QXmlName &name, const QString &data)
131 m_out << "processingInstruction(" << name.toClarkName(m_namePool) << ", " << data << ')' << endl;
134 void PushBaseliner::atomicValue(const QVariant &val)
136 m_out << "atomicValue(" << val.toString() << ')' << endl;
139 void PushBaseliner::namespaceBinding(const QXmlName &name)
141 m_out << "namespaceBinding(" << name.toClarkName(m_namePool) << ')' << endl;
144 void PushBaseliner::startOfSequence()
146 m_out << "startOfSequence()" << endl;
149 void PushBaseliner::endOfSequence()
151 m_out << "endOfSequence()" << endl;