07aa7d56cb90e06c302d669186afe22ff8dc1c35
[profile/ivi/qtxmlpatterns.git] / tests / auto / qxmlquery / PushBaseliner.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42
43 //
44 //  W A R N I N G
45 //  -------------
46 //
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.
50 //
51 // We mean it.
52
53 #ifndef Patternist_PushBaseliner_h
54 #define Patternist_PushBaseliner_h
55
56 #include <QTextStream>
57 #include <QtXmlPatterns/QAbstractXmlReceiver>
58 #include <QtXmlPatterns/QXmlNamePool>
59 #include <QtXmlPatterns/QXmlNamePool>
60
61 class PushBaseliner : public QAbstractXmlReceiver
62 {
63 public:
64     PushBaseliner(QTextStream &out,
65                   const QXmlNamePool &namePool) : m_out(out)
66                                                 , m_namePool(namePool)
67     {
68     }
69
70     bool isValid() const;
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();
83
84 private:
85     QTextStream &   m_out;
86     const QXmlNamePool m_namePool;
87 };
88
89 bool PushBaseliner::isValid() const
90 {
91     return m_out.codec();
92 }
93
94 void PushBaseliner::startElement(const QXmlName &name)
95 {
96     m_out << "startElement(" << name.toClarkName(m_namePool) << ')'<< endl;
97 }
98
99 void PushBaseliner::endElement()
100 {
101     m_out << "endElement()" << endl;
102 }
103
104 void PushBaseliner::attribute(const QXmlName &name, const QStringRef &value)
105 {
106     m_out << "attribute(" << name.toClarkName(m_namePool) << ", " << value.toString() << ')'<< endl;
107 }
108
109 void PushBaseliner::comment(const QString &value)
110 {
111     m_out << "comment(" << value << ')' << endl;
112 }
113
114 void PushBaseliner::characters(const QStringRef &value)
115 {
116     m_out << "characters(" << value.toString() << ')' << endl;
117 }
118
119 void PushBaseliner::startDocument()
120 {
121     m_out << "startDocument()" << endl;
122 }
123
124 void PushBaseliner::endDocument()
125 {
126     m_out << "endDocument()" << endl;
127 }
128
129 void PushBaseliner::processingInstruction(const QXmlName &name, const QString &data)
130 {
131     m_out << "processingInstruction(" << name.toClarkName(m_namePool) << ", " << data << ')' << endl;
132 }
133
134 void PushBaseliner::atomicValue(const QVariant &val)
135 {
136     m_out << "atomicValue(" << val.toString() << ')' << endl;
137 }
138
139 void PushBaseliner::namespaceBinding(const QXmlName &name)
140 {
141     m_out << "namespaceBinding(" << name.toClarkName(m_namePool) << ')' << endl;
142 }
143
144 void PushBaseliner::startOfSequence()
145 {
146     m_out << "startOfSequence()" << endl;
147 }
148
149 void PushBaseliner::endOfSequence()
150 {
151     m_out << "endOfSequence()" << endl;
152 }
153
154 #endif