Changeset 561 for trunk/src/corelib/xml


Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/xml/make-parser.sh

    r2 r561  
    11#!/bin/sh
     2
     3
     4
     5
     6
     7
     8
     9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
    242
    343me=$(dirname $0)
    444mkdir -p $me/out
    5 (cd $me/out && ../../../../util/qlalr/qlalr --troll --no-debug --no-lines ../qxmlstream.g)
     45(cd $me/out && ../../../../util/qlalr/qlalr -- --no-debug --no-lines ../qxmlstream.g)
    646
    747for f in $me/out/*.h; do
    848    n=$(basename $f)
    9     p4 open $n
    1049    cp $f $n
    1150done
    1251
    13 p4 revert -a ...
    14 p4 diff -dub ...
     52git diff .
    1553
  • trunk/src/corelib/xml/qxmlstream.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5353#include "qxmlutils_p.h"
    5454#include <qdebug.h>
    55 #include <QFile>
     55#include <>
    5656#include <stdio.h>
    5757#include <qtextcodec.h>
     
    5959#include <qbuffer.h>
    6060#ifndef QT_BOOTSTRAPPED
    61 #include <QCoreApplication>
     61#include <>
    6262#else
    6363// This specialization of Q_DECLARE_TR_FUNCTIONS is not in qcoreapplication.h,
     
    130130
    131131/*!
     132
     133
     134
     135
     136
     137
     138
     139
     140
     141
     142
     143
     144
     145
     146
    132147    \enum QXmlStreamReader::Error
    133148
     
    245260  well-formed XML via a simple streaming API.
    246261
    247   \mainclass
     262
    248263  \ingroup xml-tools
    249264
     
    299314
    300315  The \l{QXmlStream Bookmarks Example} illustrates how to use the
    301   recursive descent technique with a subclassed stream reader to read
    302   an XML bookmark file (XBEL).
     316  recursive descent technique
     317  a.
    303318
    304319  \section1 Namespaces
     
    335350  new data with the next call to readNext().
    336351
    337   For example, if you read data from the network using QHttp, you
    338   would connect its \l{QHttp::readyRead()}{readyRead()} signal to a
    339   custom slot. In this slot, you read all available data with
    340   \l{QHttp::readAll()}{readAll()} and pass it to the XML stream reader
    341   using addData(). Then you call your custom parsing function that
    342   reads the XML events from the reader.
     352  For example, if your application reads data from the network using a
     353  \l{QNetworkAccessManager} {network access manager}, you would issue
     354  a \l{QNetworkRequest} {network request} to the manager and receive a
     355  \l{QNetworkReply} {network reply} in return. Since a QNetworkReply
     356  is a QIODevice, you connect its \l{QNetworkReply::readyRead()}
     357  {readyRead()} signal to a custom slot, e.g. \c{slotReadyRead()} in
     358  the code snippet shown in the discussion for QNetworkAccessManager.
     359  In this slot, you read all available data with
     360  \l{QNetworkReply::readAll()} {readAll()} and pass it to the XML
     361  stream reader using addData(). Then you call your custom parsing
     362  function that reads the XML events from the reader.
    343363
    344364  \section1 Performance and memory consumption
     
    430450    if (d->deleteDevice)
    431451        delete d->device;
    432     delete d;
    433452}
    434453
     
    569588  QXmlStreamReader::Invalid.
    570589
    571   The exception is when error() return PrematureEndOfDocumentError.
     590  The exception is when error() return PrematureEndOfDocumentError.
    572591  This error is reported when the end of an otherwise well-formed
    573592  chunk of XML is reached, but the chunk doesn't represent a complete
     
    618637}
    619638
     639
     640
     641
     642
     643
     644
     645
     646
     647
     648
     649
     650
     651
     652
     653
     654
     655
     656
     657
     658
     659
     660
     661
     662
     663
     664
     665
     666
     667
     668
     669
     670
     671
     672
     673
     674
     675
     676
     677
     678
     679
     680
     681
     682
     683
     684
     685
     686
     687
     688
    620689/*
    621690 * Use the following Perl script to generate the error string index list:
     
    630699    $counter += length 1 + $_;
    631700}
    632 print "    \"\\0\";\n\nstatic const int QXmlStreamReader_tokenTypeString_indices[] = {\n    ";
     701print "    \"\\0\";\n\nstatic const t QXmlStreamReader_tokenTypeString_indices[] = {\n    ";
    633702for ($j = 0; $j < $i; ++$j) {
    634703    printf "$sizes[$j], ";
     
    661730    "DTD\0"
    662731    "EntityReference\0"
    663     "ProcessingInstruction\0"
    664     "\0";
    665 
    666 static const int QXmlStreamReader_tokenTypeString_indices[] = {
     732    "ProcessingInstruction\0";
     733
     734static const short QXmlStreamReader_tokenTypeString_indices[] = {
    667735    0, 8, 16, 30, 42, 55, 66, 77, 85, 89, 105, 0
    668736};
     
    820888    stack_size <<= 1;
    821889    sym_stack = reinterpret_cast<Value*> (qRealloc(sym_stack, stack_size * sizeof(Value)));
     890
    822891    state_stack = reinterpret_cast<int*> (qRealloc(state_stack, stack_size * sizeof(int)));
     892
    823893}
    824894
     
    20182088  The function concatenates text() when it reads either \l Characters
    20192089  or EntityReference tokens, but skips ProcessingInstruction and \l
    2020   Comment. In case anything else is read before reaching EndElement,
    2021   the function returns what it read so far and raises an
    2022   UnexpectedElementError. If the current token is not StartElement, an
    2023   empty string is returned.
    2024  */
    2025 QString QXmlStreamReader::readElementText()
     2090  Comment. If the current token is not StartElement, an empty string is
     2091  returned.
     2092
     2093  The \a behaviour defines what happens in case anything else is
     2094  read before reaching EndElement. The function can include the text from
     2095  child elements (useful for example for HTML), ignore child elements, or
     2096  raise an UnexpectedElementError and return what was read so far.
     2097
     2098  \since 4.6
     2099 */
     2100QString QXmlStreamReader::readElementText(ReadElementTextBehaviour behaviour)
    20262101{
    20272102    Q_D(QXmlStreamReader);
     
    20392114            case Comment:
    20402115                break;
     2116
     2117
     2118
     2119
     2120
     2121
     2122
     2123
     2124
    20412125            default:
    2042                 if (!d->error)
    2043                     d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data."));
    2044                 return result;
     2126                if (d->error || behaviour == ErrorOnUnexpectedElement) {
     2127                    if (!d->error)
     2128                        d->raiseError(UnexpectedElementError, QXmlStream::tr("Expected character data."));
     2129                    return result;
     2130                }
    20452131            }
    20462132        }
    20472133    }
    20482134    return QString();
     2135
     2136
     2137
     2138
     2139
     2140
     2141
     2142
     2143
     2144
    20492145}
    20502146
     
    27892885  simple streaming API.
    27902886
    2791   \mainclass
    2792   \inmodule QtXml
    27932887  \ingroup xml-tools
    27942888
     
    28492943
    28502944  The \l{QXmlStream Bookmarks Example} illustrates how to use a
    2851   subclassed stream writer to write an XML bookmark file (XBEL) that
     2945  stream writer to write an XML bookmark file (XBEL) that
    28522946  was previously read in by a QXmlStreamReader.
    28532947
     
    30593153        int n = ++namespacePrefixCount;
    30603154        forever {
    3061             s = QLatin1String("n") + QString::number(n++);
     3155            s = QLatin1) + QString::number(n++);
    30623156            int j = namespaceDeclarations.size() - 2;
    30633157            while (j >= 0 && namespaceDeclarations.at(j).prefix != s)
     
    31323226QXmlStreamWriter::~QXmlStreamWriter()
    31333227{
    3134     Q_D(QXmlStreamWriter);
    3135     delete d;
    31363228}
    31373229
     
    34123504    Q_D(QXmlStreamWriter);
    34133505    Q_ASSERT(!text.contains(QLatin1String("--")) && !text.endsWith(QLatin1Char('-')));
    3414     if (!d->finishStartElement() && d->autoFormatting)
     3506    if (!d->finishStartElement() && d->autoFormatting)
    34153507        d->indent(d->tagStack.size());
    34163508    d->write("<!--");
    34173509    d->write(text);
    34183510    d->write("-->");
     3511
    34193512}
    34203513
  • trunk/src/corelib/xml/qxmlstream.g

    r2 r561  
    22--
    33-- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 -- Contact: Qt Software Information ([email protected])
     4-- All rights reserved.
     5-- Contact: Nokia Corporation ([email protected])
    56--
    67-- This file is part of the QtCore module of the Qt Toolkit.
     
    2122-- will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223--
    23 -- In addition, as a special exception, Nokia gives you certain
    24 -- additional rights. These rights are described in the Nokia Qt LGPL
    25 -- Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 -- package.
     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.
    2727--
    2828-- GNU General Public License Usage
     
    3434-- met: http://www.gnu.org/copyleft/gpl.html.
    3535--
    36 -- If you are unsure which license is appropriate for your use, please
    37 -- contact the sales department at qt-sales@nokia.com.
     36-- If you
     37-- @nokia.com.
    3838-- $QT_END_LICENSE$
    39 --
    40 -- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
    41 -- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    4239--
    4340----------------------------------------------------------------------------
     
    162159            cap = qMax(tos + extraCapacity + 1, cap << 1 );
    163160            data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T)));
     161
    164162        }
    165163    }
     
    247245
    248246class QXmlStreamEntityResolver;
    249 
     247#ifndef QT_NO_XMLSTREAMREADER
    250248class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{
    251249    QXmlStreamReader *q_ptr;
     
    918916markup_list ::= markup_decl | space | pereference;
    919917markup_list ::= markup_list markup_decl | markup_list space | markup_list pereference;
     918
    920919
    921920markup_decl ::= element_decl | attlist_decl | entity_decl | entity_done | notation_decl | processing_instruction | comment;
     
    15341533                    QStringRef namespaceUri = symString(attribute.value);
    15351534                    attributeStack.pop();
    1536                     if ((namespacePrefix == QLatin1String("xml")
    1537                          ^ namespaceUri == QLatin1String("http://www.w3.org/XML/1998/namespace"))
     1535                    if (()
     1536                         ^ ))
    15381537                        || namespaceUri == QLatin1String("http://www.w3.org/2000/xmlns/")
    15391538                        || namespaceUri.isEmpty()
     
    18441843    return false;
    18451844}
    1846 ./
     1845#endif //QT_NO_XMLSTREAMREADER.xml
     1846
     1847./
  • trunk/src/corelib/xml/qxmlstream.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4343#define QXMLSTREAM_H
    4444
    45 #include <QtCore/QIODevice>
     45#include <QtCore/>
    4646
    4747#ifndef QT_NO_XMLSTREAM
    4848
    49 #include <QtCore/QString>
    50 #include <QtCore/QVector>
     49#include <QtCore/qstring.h>
     50#include <QtCore/qvector.h>
     51#include <QtCore/qscopedpointer.h>
    5152
    5253QT_BEGIN_HEADER
     
    6162//
    6263// The list of supported platforms is in:
    63 //   http://qtsoftware.com/developer/notes/supported_platforms
     64//   http://qt
    6465//
    6566// These platforms do not support symbol moving nor duplication
     
    322323    TokenType readNext();
    323324
     325
     326
     327
    324328    TokenType tokenType() const;
    325329    QString tokenString() const;
     
    349353
    350354    QXmlStreamAttributes attributes() const;
     355
     356
     357
     358
     359
     360
     361
    351362    QString readElementText();
    352363
     
    393404    Q_DISABLE_COPY(QXmlStreamReader)
    394405    Q_DECLARE_PRIVATE(QXmlStreamReader)
    395     QXmlStreamReaderPrivate *d_ptr;
     406    Qd_ptr;
    396407
    397408};
     
    466477    Q_DISABLE_COPY(QXmlStreamWriter)
    467478    Q_DECLARE_PRIVATE(QXmlStreamWriter)
    468     QXmlStreamWriterPrivate *d_ptr;
     479    Qd_ptr;
    469480};
    470481#endif // QT_NO_XMLSTREAMWRITER
  • trunk/src/corelib/xml/qxmlstream_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5151//
    5252
     53
    5354#ifndef QXMLSTREAM_P_H
    5455#define QXMLSTREAM_P_H
     56
     57
     58
     59
    5560
    5661class QXmlStreamReader_Table
     
    117122
    118123    ACCEPT_STATE = 416,
    119     RULE_COUNT = 269,
     124    RULE_COUNT = 2,
    120125    STATE_COUNT = 427,
    121126    TERMINAL_COUNT = 57,
     
    127132  };
    128133
    129   static const char  *const spell [];
    130   static const int            lhs [];
    131   static const int            rhs [];
    132   static const int   goto_default [];
    133   static const int action_default [];
    134   static const int   action_index [];
    135   static const int    action_info [];
    136   static const int   action_check [];
     134  static const char  *const spell [];
     135  static const             lhs [];
     136  static const             rhs [];
     137  static const    goto_default [];
     138  static const action_default [];
     139  static const    action_index [];
     140  static const     action_info [];
     141  static const    action_check [];
    137142
    138143  static inline int nt_action (int state, int nt)
    139144  {
    140     const int *const goto_index = &action_index [GOTO_INDEX_OFFSET];
    141     const int *const goto_check = &action_check [GOTO_CHECK_OFFSET];
    142 
    143     const int yyn = goto_index [state] + nt;
    144 
    145     if (yyn < 0 || goto_check [yyn] != nt)
     145    const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
     146    if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
    146147      return goto_default [nt];
    147148
    148     const int *const goto_info = &action_info [GOTO_INFO_OFFSET];
    149     return goto_info [yyn];
     149    return action_info [GOTO_INFO_OFFSET + yyn];
    150150  }
    151151
     
    170170  "IDREFS", "ENTITIES", "NMTOKEN", "NMTOKENS", "<?xml", "version", 0};
    171171
    172 const int QXmlStreamReader_Table::lhs [] = {
     172const t QXmlStreamReader_Table::lhs [] = {
    173173  57, 57, 59, 59, 59, 59, 59, 59, 59, 59,
    174174  67, 68, 64, 72, 72, 72, 75, 66, 66, 66,
    175   66, 79, 78, 80, 80, 80, 80, 80, 80, 81,
    176   81, 81, 81, 81, 81, 81, 87, 83, 88, 88,
    177   88, 88, 91, 92, 93, 93, 93, 93, 94, 94,
    178   96, 96, 96, 97, 97, 98, 98, 99, 99, 100,
    179   100, 89, 89, 95, 90, 101, 101, 103, 103, 103,
    180   103, 103, 103, 103, 103, 103, 103, 104, 105, 105,
    181   105, 105, 107, 108, 109, 109, 84, 84, 110, 110,
    182   112, 112, 85, 85, 85, 65, 65, 76, 114, 63,
    183   115, 116, 86, 86, 86, 117, 117, 117, 117, 117,
     175  66, 79, 78, 80, 80, 80, 80, 80, 80, 8,
     176  81, 81, 81, 81, 81, 81, 8, 88,
     177  88, 88, , 94,
     178  9,
     179  100, , 103, 103,
     180  103, 103, 103, 103, 103, 103, 103, 10, 105,
     181  105, 105, 10, 110,
     182  11,
     183  , 117, 117, 117, 117,
    184184  117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
    185   117, 117, 117, 117, 117, 117, 117, 117, 118, 118,
    186   119, 119, 119, 119, 119, 119, 119, 119, 122, 70,
    187   70, 70, 70, 123, 124, 123, 124, 123, 124, 123,
    188   124, 126, 126, 126, 126, 126, 126, 126, 126, 126,
     185  117, 117, 117, 117, 117, 117, 117, 117, 11, 118,
     186  11,
     187  70, 70, 70, ,
     188  12, 126, 126, 126, 126, 126, 126, 126, 126,
    189189  126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
    190   126, 126, 126, 125, 73, 113, 113, 113, 113, 127,
    191   128, 127, 128, 127, 128, 127, 128, 129, 129, 129,
     190  126, 126, 126, 12,
     191  12, 129, 129,
    192192  129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
    193193  129, 129, 129, 129, 129, 129, 129, 129, 129, 129,
    194   129, 129, 106, 106, 106, 106, 131, 132, 131, 132,
    195   131, 131, 132, 132, 133, 133, 133, 133, 135, 71,
    196   71, 71, 136, 136, 137, 62, 60, 61, 138, 121,
    197   82, 130, 134, 120, 139, 139, 139, 139, 58, 58,
    198   58, 58, 58, 58, 58, 58, 58, 58, 74, 69,
    199   69, 77, 111, 102, 102, 102, 102, 102, 140};
    200 
    201 const int QXmlStreamReader_Table:: rhs[] = {
     194  129, 129, 1,
     195  13,
     196  71, 71, ,
     197  , 58,
     198  58, 58, 58, 58, 58, 58, 58, 58, ,
     199  69, 77, 111, 102, 102, 102, 102, 102, 140};
     200
     201const [] = {
    202202  2, 1, 4, 2, 2, 2, 2, 2, 2, 0,
    203203  1, 1, 9, 2, 4, 0, 4, 4, 6, 6,
    204   4, 1, 3, 1, 1, 1, 2, 2, 2, 1,
    205   1, 1, 1, 1, 1, 1, 4, 4, 1, 1,
    206   1, 1, 1, 2, 1, 1, 1, 0, 2, 2,
    207   2, 6, 6, 1, 5, 1, 5, 3, 5, 0,
    208   1, 6, 8, 4, 2, 1, 5, 1, 1, 1,
    209   1, 1, 1, 1, 1, 6, 7, 1, 2, 2,
    210   1, 4, 3, 3, 1, 2, 5, 6, 4, 6,
    211   3, 5, 5, 3, 4, 4, 5, 2, 3, 2,
    212   2, 4, 5, 5, 7, 1, 1, 1, 1, 1,
     204  4, 1, 3, 1, 1, 1, 2, 2, 2, ,
     205  1, 1, 1, 1, 1, 1, , 1,
     206  1, 1, 1, , 2,
     207  2, ,
     208  , 1, 1,
     209  1, 1, 1, 1, 1, , 2,
     210  ,
     211  ,
     212  2, , 1, 1, 1, 1,
    213213  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    214214  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    215   2, 2, 2, 2, 1, 1, 1, 1, 1, 2,
    216   2, 3, 3, 2, 2, 2, 2, 1, 1, 1,
     215  ,
     216  2, , 1, 1,
    217217  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    218218  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    219   1, 1, 1, 1, 1, 2, 2, 3, 3, 2,
    220   2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
     219  1, 1, 1, 1, 1, ,
     220  2, 2, 2, , 1, 1, 1, 1, 1, 1,
    221221  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    222222  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
    223   1, 1, 2, 2, 3, 3, 2, 2, 2, 2,
    224   1, 1, 1, 1, 1, 1, 1, 1, 5, 0,
    225   1, 3, 1, 3, 2, 4, 3, 5, 1, 3,
    226   3, 3, 3, 4, 1, 1, 2, 2, 2, 4,
    227   2, 2, 2, 2, 2, 2, 2, 0, 1, 0,
    228   1, 1, 1, 1, 1, 1, 1, 1, 2};
    229 
    230 const int QXmlStreamReader_Table::action_default [] = {
    231   10, 258, 0, 2, 1, 0, 124, 116, 118, 119,
    232   126, 128, 122, 11, 113, 107, 0, 108, 127, 110,
    233   114, 112, 120, 123, 125, 106, 109, 111, 117, 115,
    234   130, 121, 239, 12, 253, 135, 249, 252, 0, 129,
    235   139, 256, 16, 251, 137, 136, 0, 255, 138, 258,
    236   230, 257, 254, 0, 0, 263, 0, 246, 245, 0,
    237   248, 247, 244, 240, 98, 262, 0, 235, 0, 0,
    238   259, 96, 97, 100, 0, 131, 133, 132, 134, 0,
    239   0, 260, 0, 0, 175, 0, 172, 164, 166, 167,
    240   141, 153, 170, 161, 155, 156, 152, 158, 162, 160,
    241   168, 171, 151, 154, 157, 159, 165, 163, 173, 169,
    242   149, 174, 0, 143, 147, 145, 150, 140, 148, 0,
    243   146, 142, 144, 0, 15, 14, 261, 0, 22, 21,
    244   260, 0, 0, 20, 0, 0, 31, 36, 30, 0,
    245   32, 260, 0, 33, 0, 24, 0, 34, 0, 26,
    246   35, 25, 0, 241, 40, 39, 260, 42, 48, 260,
    247   41, 0, 43, 260, 48, 260, 0, 260, 0, 48,
    248   0, 47, 45, 46, 50, 51, 260, 260, 0, 56,
    249   260, 53, 260, 0, 57, 0, 54, 260, 52, 260,
    250   0, 55, 64, 0, 260, 60, 260, 0, 58, 61,
    251   62, 0, 260, 0, 0, 59, 63, 44, 49, 65,
    252   0, 38, 0, 0, 260, 0, 93, 94, 0, 0,
    253   0, 0, 260, 0, 209, 200, 202, 204, 177, 189,
    254   207, 198, 192, 190, 193, 188, 195, 197, 205, 208,
    255   187, 191, 194, 196, 201, 199, 203, 206, 210, 212,
    256   211, 185, 0, 0, 242, 179, 183, 181, 0, 0,
    257   92, 186, 176, 184, 0, 182, 178, 180, 91, 0,
    258   95, 0, 0, 0, 0, 0, 260, 85, 260, 0,
    259   261, 0, 86, 0, 88, 68, 73, 72, 69, 70,
    260   71, 260, 74, 75, 0, 0, 0, 268, 267, 265,
    261   266, 264, 66, 260, 0, 260, 0, 0, 67, 76,
    262   260, 0, 260, 0, 0, 77, 0, 78, 0, 81,
    263   84, 0, 0, 214, 224, 223, 0, 226, 228, 227,
    264   225, 0, 243, 216, 220, 218, 222, 213, 221, 0,
    265   219, 215, 217, 0, 80, 79, 0, 82, 0, 83,
    266   87, 99, 0, 37, 0, 0, 0, 0, 90, 89,
    267   0, 102, 23, 27, 29, 28, 0, 0, 260, 261,
    268   0, 260, 0, 105, 104, 260, 0, 103, 101, 0,
    269   0, 18, 260, 17, 0, 19, 0, 0, 250, 0,
    270   260, 0, 238, 0, 231, 237, 0, 236, 233, 260,
    271   260, 261, 232, 234, 0, 260, 0, 229, 260, 0,
    272   260, 0, 230, 0, 0, 13, 269, 9, 5, 8,
    273   4, 0, 7, 258, 6, 0, 3};
    274 
    275 const int QXmlStreamReader_Table::goto_default [] = {
     223  1, 1, , 2, 2, 2,
     224  ,
     225  ,
     226  3, 3, 3, ,
     227  ,
     228  1, 1, 1, 1, 1, 1, 1, 1, 2};
     229
     230const t QXmlStreamReader_Table::action_default [] = {
     231  10, 25,
     232  12,
     233  11,
     234  13,
     235  1,
     236  23, 0,
     237  24, 0, 0,
     238  2, 0,
     239  0, 26,
     240  14,
     241  16,
     242  1, 0,
     243  14, 0, 22, 21,
     244  26, 0,
     245  3, 0, 26,
     246  3,
     247  4,
     248  0, 4,
     249  26,
     250  0, 5,
     251  6,
     252  0, 3, 0, 0,
     253  0, 0, 26,
     254  20,
     255  18,
     256  21, 0, 0,
     257  9, 0,
     258  9, 0,
     259  26,
     260  7,
     261  26,
     262  26,
     263  8,
     264  22, 0,
     265  2,
     266  8,
     267  0, 10,
     268  0, 26, 0,
     269  0, 18, 26, 0,
     270  26,
     271  26, 0,
     272  26, 9, 5, 8,
     273  4, 0, 7, 25, 6, 0, 3};
     274
     275const t QXmlStreamReader_Table::goto_default [] = {
    276276  2, 4, 3, 49, 388, 43, 37, 52, 47, 41,
    277277  249, 53, 127, 84, 393, 81, 85, 126, 42, 46,
     
    284284  50, 51, 59, 0};
    285285
    286 const int QXmlStreamReader_Table::action_index [] = {
     286const t QXmlStreamReader_Table::action_index [] = {
    287287  -21, -57, 33, 119, 960, 70, -57, -57, -57, -57,
    288288  -57, -57, -57, -57, -57, -57, 105, -57, -57, -57,
     
    373373  -84, -84, -84, 3, -84, 98, -84};
    374374
    375 const int QXmlStreamReader_Table::action_info [] = {
     375const t QXmlStreamReader_Table::action_info [] = {
    376376  65, 332, 65, 405, 392, 385, 377, 65, 414, 410,
    377377  415, 55, 397, 374, 373, 217, 206, 408, 65, 65,
     
    507507  0, 0, 0, 0, 0, 0, 0, 0};
    508508
    509 const int QXmlStreamReader_Table::action_check [] = {
     509const t QXmlStreamReader_Table::action_check [] = {
    510510  26, 18, 26, 14, 4, 4, 4, 26, 24, 14,
    511511  4, 26, 4, 4, 4, 4, 22, 55, 26, 26,
     
    653653            cap = qMax(tos + extraCapacity + 1, cap << 1 );
    654654            data = reinterpret_cast<T *>(qRealloc(data, cap * sizeof(T)));
     655
    655656        }
    656657    }
     
    738739
    739740class QXmlStreamEntityResolver;
    740 
     741#ifndef QT_NO_XMLSTREAMREADER
    741742class QXmlStreamReaderPrivate : public QXmlStreamReader_Table, public QXmlStreamPrivateTagStack{
    742743    QXmlStreamReader *q_ptr;
     
    13551356        break;
    13561357
    1357         case 36:
     1358        case 3:
    13581359            if (!scanString(spell[EMPTY], EMPTY, false)
    13591360                && !scanString(spell[ANY], ANY, false)
    13601361                && atEnd) {
    1361                 resume(36);
    1362                 return false;
    1363             }
    1364         break;
    1365 
    1366         case 42:
     1362                resume(3);
     1363                return false;
     1364            }
     1365        break;
     1366
     1367        case 4:
    13671368            if (!scanString(spell[PCDATA], PCDATA, false) && atEnd) {
    1368                 resume(42);
    1369                 return false;
    1370             }
    1371         break;
    1372 
    1373         case 67: {
     1369                resume(4);
     1370                return false;
     1371            }
     1372        break;
     1373
     1374        case 6: {
    13741375            lastAttributeIsCData = true;
    13751376        } break;
    13761377
    1377         case 77:
     1378        case 7:
    13781379            if (!scanAfterDefaultDecl() && atEnd) {
    1379                 resume(77);
    1380                 return false;
    1381             }
    1382         break;
    1383 
    1384         case 82:
     1380                resume(7);
     1381                return false;
     1382            }
     1383        break;
     1384
     1385        case 8:
    13851386                sym(1) = sym(2);
    13861387                lastAttributeValue.clear();
    13871388                lastAttributeIsCData = false;
    13881389                if (!scanAttType() && atEnd) {
    1389                     resume(82);
     1390                    resume(8);
    13901391                    return false;
    13911392                }
    13921393        break;
    13931394
    1394         case 83: {
     1395        case 8: {
    13951396            DtdAttribute &dtdAttribute = dtdAttributes.push();
    13961397            dtdAttribute.tagName.clear();
     
    14131414        } break;
    14141415
    1415         case 87: {
     1416        case 8: {
    14161417            if (referenceToUnparsedEntityDetected && !standalone)
    14171418                break;
     
    14331434        } break;
    14341435
    1435         case 88: {
     1436        case 8: {
    14361437            if (!scanPublicOrSystem() && atEnd) {
    1437                 resume(88);
     1438                resume(8);
    14381439                return false;
    14391440            }
     
    14431444        } break;
    14441445
    1445         case 89: {
     1446        case : {
    14461447            if (!scanPublicOrSystem() && atEnd) {
    1447                 resume(89);
     1448                resume();
    14481449                return false;
    14491450            }
     
    14541455        } break;
    14551456
    1456         case 90: {
     1457        case 9: {
    14571458            if (!scanNData() && atEnd) {
    1458                 resume(90);
     1459                resume(9);
    14591460                return false;
    14601461            }
     
    14641465        } break;
    14651466
    1466         case 91: {
     1467        case 9: {
    14671468            if (!scanNData() && atEnd) {
    1468                 resume(91);
     1469                resume(9);
    14691470                return false;
    14701471            }
     
    14751476        } break;
    14761477
    1477         case 92: {
     1478        case 9: {
    14781479            EntityDeclaration &entityDeclaration = entityDeclarations.top();
    14791480            entityDeclaration.notationName = symString(3);
     
    14831484        //fall through
    14841485
    1485         case 93:
    1486         case 94: {
     1486        case 9:
     1487        case 9: {
    14871488            if (referenceToUnparsedEntityDetected && !standalone) {
    14881489                entityDeclarations.pop();
     
    15021503        } break;
    15031504
    1504         case 95: {
     1505        case 9: {
    15051506            setType(QXmlStreamReader::ProcessingInstruction);
    15061507            int pos = sym(4).pos + sym(4).len;
     
    15151516                    raiseWellFormedError(QXmlStream::tr("%1 is an invalid processing instruction name.").arg(piTarget));
    15161517            } else if (type != QXmlStreamReader::Invalid){
    1517                 resume(95);
    1518                 return false;
    1519             }
    1520         } break;
    1521 
    1522         case 96:
     1518                resume(9);
     1519                return false;
     1520            }
     1521        } break;
     1522
     1523        case 9:
    15231524            setType(QXmlStreamReader::ProcessingInstruction);
    15241525            processingInstructionTarget = symString(3);
     
    15271528        break;
    15281529
    1529         case 97:
     1530        case 9:
    15301531            if (!scanAfterLangleBang() && atEnd) {
    1531                 resume(97);
    1532                 return false;
    1533             }
    1534         break;
    1535 
    1536         case 98:
     1532                resume(9);
     1533                return false;
     1534            }
     1535        break;
     1536
     1537        case 9:
    15371538            if (!scanUntil("--")) {
    1538                 resume(98);
    1539                 return false;
    1540             }
    1541         break;
    1542 
    1543         case 99: {
     1539                resume(9);
     1540                return false;
     1541            }
     1542        break;
     1543
     1544        case : {
    15441545            setType(QXmlStreamReader::Comment);
    15451546            int pos = sym(1).pos + 4;
     
    15471548        } break;
    15481549
    1549         case 100: {
     1550        case 10: {
    15501551            setType(QXmlStreamReader::Characters);
    15511552            isCDATA = true;
     
    15551556                text = QStringRef(&textBuffer, pos, textBuffer.size() - pos - 3);
    15561557            } else {
    1557                 resume(100);
    1558                 return false;
    1559             }
    1560         } break;
    1561 
    1562         case 101: {
     1558                resume(10);
     1559                return false;
     1560            }
     1561        } break;
     1562
     1563        case 10: {
    15631564            if (!scanPublicOrSystem() && atEnd) {
    1564                 resume(101);
     1565                resume(10);
    15651566                return false;
    15661567            }
     
    15691570        } break;
    15701571
    1571         case 102: {
     1572        case 10: {
    15721573            NotationDeclaration &notationDeclaration = notationDeclarations.top();
    15731574            notationDeclaration.systemId = symString(3);
     
    15751576        } break;
    15761577
    1577         case 103: {
     1578        case 10: {
    15781579            NotationDeclaration &notationDeclaration = notationDeclarations.top();
    15791580            notationDeclaration.systemId.clear();
     
    15811582        } break;
    15821583
    1583         case 104: {
     1584        case 10: {
    15841585            NotationDeclaration &notationDeclaration = notationDeclarations.top();
    15851586            checkPublicLiteral((notationDeclaration.publicId = symString(3)));
     
    15871588        } break;
    15881589
    1589         case 128:
     1590        case 12:
    15901591            isWhitespace = false;
    15911592            // fall through
    15921593
    1593         case 129:
     1594        case 1:
    15941595            sym(1).len += fastScanContentCharList();
    15951596            if (atEnd && !inParseEntity) {
    1596                 resume(129);
     1597                resume(1);
    15971598                return false;
    15981599            }
    15991600        break;
    16001601
    1601         case 138:
     1602        case 13:
    16021603            if (!textBuffer.isEmpty()) {
    16031604                setType(QXmlStreamReader::Characters);
     
    16061607        break;
    16071608
    1608         case 139:
    16091609        case 140:
     1610
    16101611            clearSym();
    16111612        break;
    16121613
    1613         case 141:
    16141614        case 142:
     1615
    16151616            sym(1) = sym(2);
    16161617        break;
    16171618
    1618         case 143:
    16191619        case 144:
    16201620        case 145:
    16211621        case 146:
     1622
    16221623            sym(1).len += sym(2).len;
    16231624        break;
    16241625
    1625         case 172:
     1626        case 17:
    16261627            if (normalizeLiterals)
    16271628                textBuffer.data()[textBuffer.size()-1] = QLatin1Char(' ');
    16281629        break;
    16291630
    1630         case 173:
     1631        case 17:
    16311632            sym(1).len += fastScanLiteralContent();
    16321633            if (atEnd) {
    1633                 resume(173);
    1634                 return false;
    1635             }
    1636         break;
    1637 
    1638         case 174: {
     1634                resume(17);
     1635                return false;
     1636            }
     1637        break;
     1638
     1639        case 17: {
    16391640            if (!QXmlUtils::isPublicID(symString(1).toString())) {
    16401641                raiseWellFormedError(QXmlStream::tr("%1 is an invalid PUBLIC identifier.").arg(symString(1).toString()));
    1641                 resume(174);
    1642                 return false;
    1643             }
    1644         } break;
    1645 
    1646         case 175:
     1642                resume(175);
     1643                return false;
     1644            }
     1645        } break;
     1646
    16471647        case 176:
     1648
    16481649            clearSym();
    16491650        break;
    16501651
    1651         case 177:
    16521652        case 178:
     1653
    16531654            sym(1) = sym(2);
    16541655        break;
    16551656
    1656         case 179:
    16571657        case 180:
    16581658        case 181:
    16591659        case 182:
     1660
    16601661            sym(1).len += sym(2).len;
    16611662        break;
    16621663
    1663         case 212:
    16641664        case 213:
     1665
    16651666            clearSym();
    16661667        break;
    16671668
    1668         case 214:
    16691669        case 215:
     1670
    16701671            sym(1) = sym(2);
    16711672            lastAttributeValue = symString(1);
    16721673        break;
    16731674
    1674         case 216:
    16751675        case 217:
    16761676        case 218:
    16771677        case 219:
     1678
    16781679            sym(1).len += sym(2).len;
    16791680        break;
    16801681
    1681         case 228: {
     1682        case 22: {
    16821683            QStringRef prefix = symPrefix(1);
    16831684            if (prefix.isEmpty() && symString(1) == QLatin1String("xmlns") && namespaceProcessing) {
     
    17491750        } break;
    17501751
    1751         case 234: {
     1752        case 23: {
    17521753            normalizeLiterals = true;
    17531754            Tag &tag = tagStack_push();
     
    17591760        } break;
    17601761
    1761         case 235:
     1762        case 23:
    17621763            isEmptyElement = true;
    17631764        // fall through
    17641765
    1765         case 236:
     1766        case 23:
    17661767            setType(QXmlStreamReader::StartElement);
    17671768            resolveTag();
     
    17711772        break;
    17721773
    1773         case 237: {
     1774        case 23: {
    17741775            setType(QXmlStreamReader::EndElement);
    17751776            Tag &tag = tagStack_pop();
     
    17821783        } break;
    17831784
    1784         case 238:
     1785        case 23:
    17851786            if (entitiesMustBeDeclared()) {
    17861787                raiseWellFormedError(QXmlStream::tr("Entity '%1' not declared.").arg(unresolvedEntity));
     
    17911792        break;
    17921793
    1793         case 239: {
     1794        case 2: {
    17941795            sym(1).len += sym(2).len + 1;
    17951796            QString reference = symString(2).toString();
     
    18301831        } break;
    18311832
    1832         case 240: {
     1833        case 24: {
    18331834            sym(1).len += sym(2).len + 1;
    18341835            QString reference = symString(2).toString();
     
    18491850        } break;
    18501851
    1851         case 241:
     1852        case 24:
    18521853            sym(1).len += sym(2).len + 1;
    18531854        break;
    18541855
    1855         case 242: {
     1856        case 24: {
    18561857            sym(1).len += sym(2).len + 1;
    18571858            QString reference = symString(2).toString();
     
    18891890        } break;
    18901891
    1891         case 243: {
     1892        case 24: {
    18921893            if (uint s = resolveCharRef(3)) {
    18931894                if (s >= 0xffff)
     
    19031904        } break;
    19041905
    1905         case 246:
    19061906        case 247:
     1907
    19071908            sym(1).len += sym(2).len;
    19081909        break;
    19091910
    1910         case 258:
     1911        case 25:
    19111912            sym(1).len += fastScanSpace();
    19121913            if (atEnd) {
    1913                 resume(258);
    1914                 return false;
    1915             }
    1916         break;
    1917 
    1918         case 261: {
     1914                resume(25);
     1915                return false;
     1916            }
     1917        break;
     1918
     1919        case 26: {
    19191920            sym(1).len += fastScanName(&sym(1).prefix);
    19201921            if (atEnd) {
    1921                 resume(261);
    1922                 return false;
    1923             }
    1924         } break;
    1925 
    1926         case 262:
     1922                resume(26);
     1923                return false;
     1924            }
     1925        } break;
     1926
     1927        case 26:
    19271928            sym(1).len += fastScanName();
    19281929            if (atEnd) {
    1929                 resume(262);
    1930                 return false;
    1931             }
    1932         break;
    1933 
    1934         case 263:
     1930                resume(263);
     1931                return false;
     1932            }
     1933        break;
     1934
    19351935        case 264:
    19361936        case 265:
    19371937        case 266:
    19381938        case 267:
     1939
    19391940            sym(1).len += fastScanNMTOKEN();
    19401941            if (atEnd) {
    1941                 resume(267);
     1942                resume(26);
    19421943                return false;
    19431944            }
     
    19581959    return false;
    19591960}
     1961
     1962
    19601963
    19611964#endif // QXMLSTREAM_P_H
  • trunk/src/corelib/xml/qxmlutils.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
    4040****************************************************************************/
    4141
    42 #include <QRegExp>
    43 #include <QString>
     42#include <>
     43#include <>
    4444
    4545#include "qxmlutils_p.h"
  • trunk/src/corelib/xml/qxmlutils_p.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5454//
    5555
    56 #include <QtCore/QString>
     56#include <QtCore/>
    5757
    5858QT_BEGIN_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.