| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the test suite of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
| 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 The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
| 21 | ** included in the packaging of this file. Please review the following |
| 22 | ** information to ensure the GNU General Public License requirements will |
| 23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
| 24 | ** |
| 25 | ** $QT_END_LICENSE$ |
| 26 | ** |
| 27 | ****************************************************************************/ |
| 28 | |
| 29 | |
| 30 | // |
| 31 | // W A R N I N G |
| 32 | // ------------- |
| 33 | // |
| 34 | // This file is not part of the Qt API. It exists purely as an |
| 35 | // implementation detail. This header file may change from version to |
| 36 | // version without notice, or even be removed. |
| 37 | // |
| 38 | // We mean it. |
| 39 | |
| 40 | #ifndef Patternist_PushBaseliner_h |
| 41 | #define Patternist_PushBaseliner_h |
| 42 | |
| 43 | #include <QTextStream> |
| 44 | #include <QtXmlPatterns/QAbstractXmlReceiver> |
| 45 | #include <QtXmlPatterns/QXmlNamePool> |
| 46 | #include <QtXmlPatterns/QXmlNamePool> |
| 47 | |
| 48 | class PushBaseliner : public QAbstractXmlReceiver |
| 49 | { |
| 50 | public: |
| 51 | PushBaseliner(QTextStream &out, |
| 52 | const QXmlNamePool &namePool) : m_out(out) |
| 53 | , m_namePool(namePool) |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | bool isValid() const; |
| 58 | virtual void startElement(const QXmlName&); |
| 59 | virtual void endElement(); |
| 60 | virtual void attribute(const QXmlName&, const QStringRef&); |
| 61 | virtual void comment(const QString&); |
| 62 | virtual void characters(const QStringRef&); |
| 63 | virtual void startDocument(); |
| 64 | virtual void endDocument(); |
| 65 | virtual void processingInstruction(const QXmlName&, const QString&); |
| 66 | virtual void atomicValue(const QVariant&); |
| 67 | virtual void namespaceBinding(const QXmlName&); |
| 68 | virtual void startOfSequence(); |
| 69 | virtual void endOfSequence(); |
| 70 | |
| 71 | private: |
| 72 | QTextStream & m_out; |
| 73 | const QXmlNamePool m_namePool; |
| 74 | }; |
| 75 | |
| 76 | bool PushBaseliner::isValid() const |
| 77 | { |
| 78 | return m_out.codec(); |
| 79 | } |
| 80 | |
| 81 | void PushBaseliner::startElement(const QXmlName &name) |
| 82 | { |
| 83 | m_out << "startElement(" << name.toClarkName(query: m_namePool) << ')'<< endl; |
| 84 | } |
| 85 | |
| 86 | void PushBaseliner::endElement() |
| 87 | { |
| 88 | m_out << "endElement()" << endl; |
| 89 | } |
| 90 | |
| 91 | void PushBaseliner::attribute(const QXmlName &name, const QStringRef &value) |
| 92 | { |
| 93 | m_out << "attribute(" << name.toClarkName(query: m_namePool) << ", " << value.toString() << ')'<< endl; |
| 94 | } |
| 95 | |
| 96 | void PushBaseliner::(const QString &value) |
| 97 | { |
| 98 | m_out << "comment(" << value << ')' << endl; |
| 99 | } |
| 100 | |
| 101 | void PushBaseliner::characters(const QStringRef &value) |
| 102 | { |
| 103 | m_out << "characters(" << value.toString() << ')' << endl; |
| 104 | } |
| 105 | |
| 106 | void PushBaseliner::startDocument() |
| 107 | { |
| 108 | m_out << "startDocument()" << endl; |
| 109 | } |
| 110 | |
| 111 | void PushBaseliner::endDocument() |
| 112 | { |
| 113 | m_out << "endDocument()" << endl; |
| 114 | } |
| 115 | |
| 116 | void PushBaseliner::processingInstruction(const QXmlName &name, const QString &data) |
| 117 | { |
| 118 | m_out << "processingInstruction(" << name.toClarkName(query: m_namePool) << ", " << data << ')' << endl; |
| 119 | } |
| 120 | |
| 121 | void PushBaseliner::atomicValue(const QVariant &val) |
| 122 | { |
| 123 | m_out << "atomicValue(" << val.toString() << ')' << endl; |
| 124 | } |
| 125 | |
| 126 | void PushBaseliner::namespaceBinding(const QXmlName &name) |
| 127 | { |
| 128 | m_out << "namespaceBinding(" << name.toClarkName(query: m_namePool) << ')' << endl; |
| 129 | } |
| 130 | |
| 131 | void PushBaseliner::startOfSequence() |
| 132 | { |
| 133 | m_out << "startOfSequence()" << endl; |
| 134 | } |
| 135 | |
| 136 | void PushBaseliner::endOfSequence() |
| 137 | { |
| 138 | m_out << "endOfSequence()" << endl; |
| 139 | } |
| 140 | |
| 141 | #endif |
| 142 | |