tests/auto/qxmlquery/PushBaseliner.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the test suite of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    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         Q_ASSERT(m_out.codec());
       
    69     }
       
    70 
       
    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 void PushBaseliner::startElement(const QXmlName &name)
       
    90 {
       
    91     m_out << "startElement(" << name.toClarkName(m_namePool) << ')'<< endl;
       
    92 }
       
    93 
       
    94 void PushBaseliner::endElement()
       
    95 {
       
    96     m_out << "endElement()" << endl;
       
    97 }
       
    98 
       
    99 void PushBaseliner::attribute(const QXmlName &name, const QStringRef &value)
       
   100 {
       
   101     m_out << "attribute(" << name.toClarkName(m_namePool) << ", " << value.toString() << ')'<< endl;
       
   102 }
       
   103 
       
   104 void PushBaseliner::comment(const QString &value)
       
   105 {
       
   106     m_out << "comment(" << value << ')' << endl;
       
   107 }
       
   108 
       
   109 void PushBaseliner::characters(const QStringRef &value)
       
   110 {
       
   111     m_out << "characters(" << value.toString() << ')' << endl;
       
   112 }
       
   113 
       
   114 void PushBaseliner::startDocument()
       
   115 {
       
   116     m_out << "startDocument()" << endl;
       
   117 }
       
   118 
       
   119 void PushBaseliner::endDocument()
       
   120 {
       
   121     m_out << "endDocument()" << endl;
       
   122 }
       
   123 
       
   124 void PushBaseliner::processingInstruction(const QXmlName &name, const QString &data)
       
   125 {
       
   126     m_out << "processingInstruction(" << name.toClarkName(m_namePool) << ", " << data << ')' << endl;
       
   127 }
       
   128 
       
   129 void PushBaseliner::atomicValue(const QVariant &val)
       
   130 {
       
   131     m_out << "atomicValue(" << val.toString() << ')' << endl;
       
   132 }
       
   133 
       
   134 void PushBaseliner::namespaceBinding(const QXmlName &name)
       
   135 {
       
   136     m_out << "namespaceBinding(" << name.toClarkName(m_namePool) << ')' << endl;
       
   137 }
       
   138 
       
   139 void PushBaseliner::startOfSequence()
       
   140 {
       
   141     m_out << "startOfSequence()" << endl;
       
   142 }
       
   143 
       
   144 void PushBaseliner::endOfSequence()
       
   145 {
       
   146     m_out << "endOfSequence()" << endl;
       
   147 }
       
   148 
       
   149 #endif