1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the test suite of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
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;