Changeset 561 for trunk/src/xml


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

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/xml/dom/qdom.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtXml 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5757#include <qvariant.h>
    5858#include <qmap.h>
     59#include <qshareddata.h>
    5960#include <qdebug.h>
    6061#include <stdio.h>
     
    125126{
    126127public:
    127     QDomImplementationPrivate() { ref = 1; }
     128    inline QDomImplementationPrivate() {}
     129
    128130    QDomImplementationPrivate* clone();
    129131    QAtomicInt ref;
     
    513515
    514516    // Attributes
    515     QDomDocumentTypePrivate* doctype() { return type; };
    516     QDomImplementationPrivate* implementation() { return impl; };
     517    QDomDocumentTypePrivate* doctype() { return type.data(); }
     518    QDomImplementationPrivate* implementation() { return impl.data(); }
    517519    QDomElementPrivate* documentElement();
    518520
     
    538540
    539541    // Variables
    540     QDomImplementationPrivate* impl;
    541     QDomDocumentTypePrivate* type;
     542    QExplicitlySharedDataPointer<QDomImplementationPrivate> impl;
     543    QExplicitlySharedDataPointer<QDomDocumentTypePrivate> type;
    542544
    543545    void saveDocument(QTextStream& stream, const int indent, QDomNode::EncodingPolicy encUsed) const;
     
    865867QDomImplementationPrivate* QDomImplementationPrivate::clone()
    866868{
    867     QDomImplementationPrivate* p = new QDomImplementationPrivate;
    868     // We are not interested in this node
    869     p->ref.deref();
    870     return p;
     869    return new QDomImplementationPrivate;
    871870}
    872871
     
    18461845
    18471846    // We are no longer interested in the old node
    1848     if (oldChild)
    1849         oldChild->ref.deref();
     1847    oldChild->ref.deref();
    18501848
    18511849    return oldChild;
     
    19401938    \inmodule QtXml
    19411939    \ingroup xml-tools
    1942     \mainclass
     1940
    19431941
    19441942    Many functions in the DOM return a QDomNode.
     
    26952693    encoded in the given encoding, the result and behavior is undefined.
    26962694
    2697  \since 4.2
     2695    \since 4.2
    26982696 */
    26992697void QDomNode::save(QTextStream& str, int indent, EncodingPolicy encodingPolicy) const
     
    30613059QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p)
    30623060{
    3063     QDomNamedNodeMapPrivate* m = new QDomNamedNodeMapPrivate(p);
     3061    QScopedPointer<QDomNamedNodeMapPrivate> m(new QDomNamedNodeMapPrivate(p));
    30643062    m->readonly = readonly;
    30653063    m->appendToParent = appendToParent;
     
    30743072    // we are no longer interested in ownership
    30753073    m->ref.deref();
    3076     return m;
     3074    return m.take();
    30773075}
    30783076
     
    35003498{
    35013499    entities = new QDomNamedNodeMapPrivate(this);
    3502     notations = new QDomNamedNodeMapPrivate(this);
    3503     publicId.clear();
    3504     systemId.clear();
    3505     internalSubset.clear();
    3506 
    3507     entities->setAppendToParent(true);
    3508     notations->setAppendToParent(true);
     3500    QT_TRY {
     3501        notations = new QDomNamedNodeMapPrivate(this);
     3502        publicId.clear();
     3503        systemId.clear();
     3504        internalSubset.clear();
     3505
     3506        entities->setAppendToParent(true);
     3507        notations->setAppendToParent(true);
     3508    } QT_CATCH(...) {
     3509        delete entities;
     3510        QT_RETHROW;
     3511    }
    35093512}
    35103513
     
    43564359{
    43574360    Q_ASSERT(impl->parent());
    4358     if (!impl || !impl->parent()->isElement())
     4361    if (!impl->parent()->isElement())
    43594362        return QDomElement();
    43604363    return QDomElement((QDomElementPrivate*)(impl->parent()));
     
    45904593            nsDecl = QLatin1String(" xmlns:") + prefix;
    45914594        }
    4592         nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1String("\"");
     4595        nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1Char('\"');
    45934596    }
    45944597    s << '<' << qName << nsDecl;
     
    45984601    /* Write out attributes. */
    45994602    if (!m_attr->map.isEmpty()) {
    4600         s << ' ';
    46014603        QHash<QString, QDomNodePrivate *>::const_iterator it = m_attr->map.constBegin();
    46024604        for (; it != m_attr->map.constEnd(); ++it) {
     4605            s << ' ';
    46034606            if (it.value()->namespaceURI.isNull()) {
    46044607                s << it.value()->name << "=\"" << encodeText(it.value()->value, s, true, true) << '\"';
     
    46234626                }
    46244627            }
    4625             s << ' ';
    46264628        }
    46274629    }
     
    61476149QDomDocumentPrivate::QDomDocumentPrivate()
    61486150    : QDomNodePrivate(0),
     6151      impl(new QDomImplementationPrivate),
    61496152      nodeListTime(1)
    61506153{
    6151     impl = new QDomImplementationPrivate;
    61526154    type = new QDomDocumentTypePrivate(this, this);
     6155    type->ref.deref();
    61536156
    61546157    name = QLatin1String("#document");
     
    61576160QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname)
    61586161    : QDomNodePrivate(0),
     6162      impl(new QDomImplementationPrivate),
    61596163      nodeListTime(1)
    61606164{
    6161     impl = new QDomImplementationPrivate;
    61626165    type = new QDomDocumentTypePrivate(this, this);
     6166    type->ref.deref();
    61636167    type->name = aname;
    61646168
     
    61686172QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt)
    61696173    : QDomNodePrivate(0),
     6174      impl(new QDomImplementationPrivate),
    61706175      nodeListTime(1)
    61716176{
    6172     impl = new QDomImplementationPrivate;
    61736177    if (dt != 0) {
    61746178        type = dt;
    6175         type->ref.ref();
    61766179    } else {
    61776180        type = new QDomDocumentTypePrivate(this, this);
     6181        type->ref.deref();
    61786182    }
    61796183
     
    61836187QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep)
    61846188    : QDomNodePrivate(n, deep),
     6189      impl(n->impl->clone()),
    61856190      nodeListTime(1)
    61866191{
    6187     impl = n->impl->clone();
    6188     // Reference count is down to 0, so we set it to 1 here.
    6189     impl->ref.ref();
    6190     type = (QDomDocumentTypePrivate*)n->type->cloneNode();
     6192    type = static_cast<QDomDocumentTypePrivate*>(n->type->cloneNode());
    61916193    type->setParent(this);
    6192     // Reference count is down to 0, so we set it to 1 here.
    6193     type->ref.ref();
    61946194}
    61956195
    61966196QDomDocumentPrivate::~QDomDocumentPrivate()
    61976197{
    6198     if (!impl->ref.deref())
    6199         delete impl;
    6200     if (!type->ref.deref())
    6201         delete type;
    62026198}
    62036199
    62046200void QDomDocumentPrivate::clear()
    62056201{
    6206     if (!impl->ref.deref())
    6207         delete impl;
    6208     if (!type->ref.deref())
    6209         delete type;
    6210     impl = 0;
    6211     type = 0;
     6202    impl.reset();
     6203    type.reset();
    62126204    QDomNodePrivate::clear();
    62136205}
     
    62326224    impl = new QDomImplementationPrivate;
    62336225    type = new QDomDocumentTypePrivate(this, this);
     6226    type->ref.deref();
    62346227
    62356228    bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces"))
     
    64466439        const QDomNodePrivate* n = first;
    64476440
     6441        QTextCodec *codec = 0;
     6442
    64486443        if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) {
    64496444            // we have an XML declaration
     
    64526447            encoding.indexIn(data);
    64536448            QString enc = encoding.cap(3);
    6454             if (enc.isEmpty()) {
     6449            if (enc.isEmpty())
    64556450                enc = encoding.cap(5);
    6456             }
    6457             if (enc.isEmpty())
    6458                 s.setCodec(QTextCodec::codecForName("UTF-8"));
    6459             else
    6460                 s.setCodec(QTextCodec::codecForName(enc.toLatin1().data()));
    6461         } else {
    6462             s.setCodec(QTextCodec::codecForName("UTF-8"));
     6451            if (!enc.isEmpty())
     6452                codec = QTextCodec::codecForName(enc.toLatin1().data());
    64636453        }
     6454        if (!codec)
     6455            codec = QTextCodec::codecForName("UTF-8");
     6456        if (codec)
     6457            s.setCodec(codec);
    64646458#endif
    64656459        bool doc = false;
     
    65256519
    65266520    \inmodule QtXml
    6527     \mainclass
     6521
    65286522    \ingroup xml-tools
    65296523
     
    73807374
    73817375QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, bool namespaceProcessing)
    7382 {
    7383     doc = adoc;
    7384     node = doc;
    7385     cdata = false;
    7386     nsProcessing = namespaceProcessing;
     7376    : errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false),
     7377        nsProcessing(namespaceProcessing), locator(0)
     7378{
    73877379}
    73887380
     
    74167408        n = doc->createElement(qName);
    74177409    }
    7418     n->setLocation(locator->lineNumber(), locator->columnNumber());
     7410
     7411    if (n)
     7412        n->setLocation(locator->lineNumber(), locator->columnNumber());
    74197413
    74207414    node->appendChild(n);
     
    74367430bool QDomHandler::endElement(const QString&, const QString&, const QString&)
    74377431{
    7438     if (node == doc)
     7432    if (!node || node == doc)
    74397433        return false;
    74407434    node = node->parent();
     
    74497443        return false;
    74507444
    7451     QDomNodePrivate *n;
     7445    QScopedPointer<QDomNodePrivate> n;
    74527446    if (cdata) {
    7453         n = doc->createCDATASection(ch);
     7447        n.reset(doc->createCDATASection(ch));
    74547448    } else if (!entityName.isEmpty()) {
    7455         QDomEntityPrivate* e = new QDomEntityPrivate(doc, 0, entityName,
    7456                 QString(), QString(), QString());
     7449        QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName,
     7450                QString(), QString(), QString()));
    74577451        e->value = ch;
    7458         doc->doctype()->appendChild(e);
    7459         n = doc->createEntityReference(entityName);
     7452        doc->doctype()->appendChild(e.data());
     7453        e.take();
     7454        n.reset(doc->createEntityReference(entityName));
    74607455    } else {
    7461         n = doc->createTextNode(ch);
     7456        n.reset(doc->createTextNode(ch));
    74627457    }
    74637458    n->setLocation(locator->lineNumber(), locator->columnNumber());
    7464     node->appendChild(n);
     7459    node->appendChild(n.data());
     7460    n.take();
    74657461
    74667462    return true;
  • trunk/src/xml/dom/qdom.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtXml 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/xml/sax/qxml.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtXml 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    245245{
    246246public:
     247    QXmlParseExceptionPrivate()
     248        : column(-1), line(-1)
     249    {
     250    }
     251    QXmlParseExceptionPrivate(const QXmlParseExceptionPrivate &other)
     252        : msg(other.msg), column(other.column), line(other.line),
     253          pub(other.pub), sys(other.sys)
     254    {
     255    }
     256
    247257    QString msg;
    248258    int column;
     
    263273class QXmlSimpleReaderPrivate
    264274{
     275public:
     276    ~QXmlSimpleReaderPrivate();
    265277private:
    266278    // functions
    267     QXmlSimpleReaderPrivate();
    268     ~QXmlSimpleReaderPrivate();
     279    QXmlSimpleReaderPrivate(QXmlSimpleReader *reader);
    269280    void initIncrementalParsing();
    270281
     
    303314    // used for parsing of entity references
    304315    struct XmlRef {
    305         XmlRef(const QString &_name = QString(), const QString &_value = QString())
     316        XmlRef()
     317            : index(0) {}
     318        XmlRef(const QString &_name, const QString &_value)
    306319            : name(_name), value(_value), index(0) {}
    307320        bool isEmpty() const { return index == value.length(); }
     
    349362
    350363    // helper classes
    351     QXmlLocator *locator;
     364    QScopedPointer<QXmlLocator> locator;
    352365    QXmlNamespaceSupport namespaceSupport;
    353366
     
    544557QXmlParseException::QXmlParseException(const QString& name, int c, int l,
    545558                                       const QString& p, const QString& s)
    546 {
    547     d = new QXmlParseExceptionPrivate;
     559    : d(new QXmlParseExceptionPrivate)
     560{
    548561    d->msg = name;
    549562    d->column = c;
     
    554567
    555568/*!
     569    Creates a copy of \a other.
     570*/
     571QXmlParseException::QXmlParseException(const QXmlParseException& other) :
     572     d(new QXmlParseExceptionPrivate(*other.d))
     573{
     574
     575}
     576
     577/*!
    556578    Destroys the QXmlParseException.
    557579*/
    558580QXmlParseException::~QXmlParseException()
    559581{
    560     delete d;
    561582}
    562583
     
    927948void QXmlNamespaceSupport::reset()
    928949{
     950    QXmlNamespaceSupportPrivate *newD = new QXmlNamespaceSupportPrivate;
    929951    delete d;
    930     d = new QXmlNamespaceSupportPrivate;
     952    d = newD;
    931953}
    932954
     
    12591281    d = new QXmlInputSourcePrivate;
    12601282
    1261     d->inputDevice = 0;
    1262     d->inputStream = 0;
    1263 
    1264     setData(QString());
     1283    QT_TRY {
     1284        d->inputDevice = 0;
     1285        d->inputStream = 0;
     1286
     1287        setData(QString());
    12651288#ifndef QT_NO_TEXTCODEC
    1266     d->encMapper = 0;
     1289        d->encMapper = 0;
    12671290#endif
    1268     d->nextReturnedEndOfData = true; // first call to next() will call fetchData()
    1269 
    1270     d->encodingDeclBytes.clear();
    1271     d->encodingDeclChars.clear();
    1272     d->lookingForEncodingDecl = true;
     1291        d->nextReturnedEndOfData = true; // first call to next() will call fetchData()
     1292
     1293        d->encodingDeclBytes.clear();
     1294        d->encodingDeclChars.clear();
     1295        d->lookingForEncodingDecl = true;
     1296    } QT_CATCH(...) {
     1297        delete(d);
     1298        QT_RETHROW;
     1299    }
    12731300}
    12741301
     
    21082135    QXmlReader::setLexicalHandler().
    21092136
    2110     This interface's design is based on the the SAX2 extension
     2137    This interface's design is based on the SAX2 extension
    21112138    LexicalHandler.
    21122139
     
    24042431    \reimp
    24052432
    2406     Does nothing.
     2433    This reimplementation does nothing.
    24072434*/
    24082435void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*)
     
    24132440    \reimp
    24142441
    2415     Does nothing.
     2442    This reimplementation does nothing.
    24162443*/
    24172444bool QXmlDefaultHandler::startDocument()
     
    24232450    \reimp
    24242451
    2425     Does nothing.
     2452    This reimplementation does nothing.
    24262453*/
    24272454bool QXmlDefaultHandler::endDocument()
     
    24332460    \reimp
    24342461
    2435     Does nothing.
     2462    This reimplementation does nothing.
    24362463*/
    24372464bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&)
     
    24432470    \reimp
    24442471
    2445     Does nothing.
     2472    This reimplementation does nothing.
    24462473*/
    24472474bool QXmlDefaultHandler::endPrefixMapping(const QString&)
     
    24532480    \reimp
    24542481
    2455     Does nothing.
     2482    This reimplementation does nothing.
    24562483*/
    24572484bool QXmlDefaultHandler::startElement(const QString&, const QString&,
     
    24642491    \reimp
    24652492
    2466     Does nothing.
     2493    This reimplementation does nothing.
    24672494*/
    24682495bool QXmlDefaultHandler::endElement(const QString&, const QString&,
     
    24752502    \reimp
    24762503
    2477     Does nothing.
     2504    This reimplementation does nothing.
    24782505*/
    24792506bool QXmlDefaultHandler::characters(const QString&)
     
    24852512    \reimp
    24862513
    2487     Does nothing.
     2514    This reimplementation does nothing.
    24882515*/
    24892516bool QXmlDefaultHandler::ignorableWhitespace(const QString&)
     
    24952522    \reimp
    24962523
    2497     Does nothing.
     2524    This reimplementation does nothing.
    24982525*/
    24992526bool QXmlDefaultHandler::processingInstruction(const QString&,
     
    25062533    \reimp
    25072534
    2508     Does nothing.
     2535    This reimplementation does nothing.
    25092536*/
    25102537bool QXmlDefaultHandler::skippedEntity(const QString&)
     
    25162543    \reimp
    25172544
    2518     Does nothing.
     2545    This reimplementation does nothing.
    25192546*/
    25202547bool QXmlDefaultHandler::warning(const QXmlParseException&)
     
    25262553    \reimp
    25272554
    2528     Does nothing.
     2555    This reimplementation does nothing.
    25292556*/
    25302557bool QXmlDefaultHandler::error(const QXmlParseException&)
     
    25362563    \reimp
    25372564
    2538     Does nothing.
     2565    This reimplementation does nothing.
    25392566*/
    25402567bool QXmlDefaultHandler::fatalError(const QXmlParseException&)
     
    25462573    \reimp
    25472574
    2548     Does nothing.
     2575    This reimplementation does nothing.
    25492576*/
    25502577bool QXmlDefaultHandler::notationDecl(const QString&, const QString&,
     
    25572584    \reimp
    25582585
    2559     Does nothing.
     2586    This reimplementation does nothing.
    25602587*/
    25612588bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&,
     
    25912618    \reimp
    25922619
    2593     Does nothing.
     2620    This reimplementation does nothing.
    25942621*/
    25952622bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString&)
     
    26012628    \reimp
    26022629
    2603     Does nothing.
     2630    This reimplementation does nothing.
    26042631*/
    26052632bool QXmlDefaultHandler::endDTD()
     
    26112638    \reimp
    26122639
    2613     Does nothing.
     2640    This reimplementation does nothing.
    26142641*/
    26152642bool QXmlDefaultHandler::startEntity(const QString&)
     
    26212648    \reimp
    26222649
    2623     Does nothing.
     2650    This reimplementation does nothing.
    26242651*/
    26252652bool QXmlDefaultHandler::endEntity(const QString&)
     
    26312658    \reimp
    26322659
    2633     Does nothing.
     2660    This reimplementation does nothing.
    26342661*/
    26352662bool QXmlDefaultHandler::startCDATA()
     
    26412668    \reimp
    26422669
    2643     Does nothing.
     2670    This reimplementation does nothing.
    26442671*/
    26452672bool QXmlDefaultHandler::endCDATA()
     
    26512678    \reimp
    26522679
    2653     Does nothing.
     2680    This reimplementation does nothing.
    26542681*/
    26552682bool QXmlDefaultHandler::comment(const QString&)
     
    26612688    \reimp
    26622689
    2663     Does nothing.
     2690    This reimplementation does nothing.
    26642691*/
    26652692bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QString&, const QString&, const QString&)
     
    26712698    \reimp
    26722699
    2673     Does nothing.
     2700    This reimplementation does nothing.
    26742701*/
    26752702bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&)
     
    26812708    \reimp
    26822709
    2683     Does nothing.
     2710    This reimplementation does nothing.
    26842711*/
    26852712bool QXmlDefaultHandler::externalEntityDecl(const QString&, const QString&, const QString&)
     
    27142741}
    27152742
    2716 QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate()
    2717 {
     2743QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader)
     2744{
     2745    q_ptr = reader;
    27182746    parseStack = 0;
     2747
     2748    locator.reset(new QXmlSimpleReaderLocator(reader));
     2749    entityRes  = 0;
     2750    dtdHnd     = 0;
     2751    contentHnd = 0;
     2752    errorHnd   = 0;
     2753    lexicalHnd = 0;
     2754    declHnd    = 0;
     2755
     2756    // default feature settings
     2757    useNamespaces = true;
     2758    useNamespacePrefixes = false;
     2759    reportWhitespaceCharData = true;
     2760    reportEntities = false;
    27192761}
    27202762
     
    27262768void QXmlSimpleReaderPrivate::initIncrementalParsing()
    27272769{
    2728     delete parseStack;
    2729     parseStack = new QStack<ParseState>;
     2770    if(parseStack)
     2771        parseStack->clear();
     2772    else
     2773        parseStack = new QStack<ParseState>;
    27302774}
    27312775
     
    29693013    \inmodule QtXml
    29703014    \ingroup xml-tools
    2971     \mainclass
     3015
    29723016
    29733017    This XML reader is suitable for a wide range of applications. It
     
    30133057    parseContinue() function, until all the data has been processed.
    30143058
    3015     A common way to perform incremental parsing is to connect the
    3016     \c readyRead() signal of the input source to a slot, and handle the
    3017     incoming data there. For example, the following code shows how a
    3018     parser for \l{http://web.resource.org/rss/1.0/}{RSS feeds} can be
    3019     used to incrementally parse data that it receives from a QHttp
    3020     object:
    3021 
    3022     \snippet doc/src/snippets/xml/rsslisting/rsslisting.cpp 1
    3023 
     3059    A common way to perform incremental parsing is to connect the \c
     3060    readyRead() signal of a \l{QNetworkReply} {network reply} a slot,
     3061    and handle the incoming data there. See QNetworkAccessManager.
     3062   
    30243063    Aspects of the parsing behavior can be adapted using setFeature()
    3025     and setProperty(). For example, the following code could be used
    3026     to enable reporting of namespace prefixes to the content handler:
     3064    and setProperty().
     3065   
     3066    \snippet doc/src/snippets/code/src_xml_sax_qxml.cpp 0
    30273067
    30283068    QXmlSimpleReader is not reentrant. If you want to use the class
    30293069    in threaded code, lock the code using QXmlSimpleReader with a
    30303070    locking mechanism, such as a QMutex.
    3031 
    3032     \snippet doc/src/snippets/code/src_xml_sax_qxml.cpp 0
    30333071*/
    30343072
     
    31003138*/
    31013139QXmlSimpleReader::QXmlSimpleReader()
    3102 {
    3103     d_ptr = new QXmlSimpleReaderPrivate();
    3104     Q_D(QXmlSimpleReader);
    3105     d->q_ptr = this;
    3106 
    3107     d->locator = new QXmlSimpleReaderLocator(this);
    3108 
    3109     d->entityRes  = 0;
    3110     d->dtdHnd     = 0;
    3111     d->contentHnd = 0;
    3112     d->errorHnd   = 0;
    3113     d->lexicalHnd = 0;
    3114     d->declHnd    = 0;
    3115 
    3116     // default feature settings
    3117     d->useNamespaces = true;
    3118     d->useNamespacePrefixes = false;
    3119     d->reportWhitespaceCharData = true;
    3120     d->reportEntities = false;
     3140    : d_ptr(new QXmlSimpleReaderPrivate(this))
     3141{
    31213142}
    31223143
     
    31263147QXmlSimpleReader::~QXmlSimpleReader()
    31273148{
    3128     Q_D(QXmlSimpleReader);
    3129     delete d->locator;
    3130     delete d;
    31313149}
    31323150
     
    31383156    const QXmlSimpleReaderPrivate *d = d_func();
    31393157
    3140     // Qt5 ###: Change these strings to qtsoftware.com
     3158    // Qt5 ###: Change these strings to qt.nokia.com
    31413159    if (ok != 0)
    31423160        *ok = true;
     
    31933211{
    31943212    Q_D(QXmlSimpleReader);
    3195     // Qt5 ###: Change these strings to qtsoftware.com
     3213    // Qt5 ###: Change these strings to qt.nokia.com
    31963214    if (name == QLatin1String("http://xml.org/sax/features/namespaces")) {
    31973215        d->useNamespaces = enable;
     
    32113229bool QXmlSimpleReader::hasFeature(const QString& name) const
    32123230{
    3213     // Qt5 ###: Change these strings to qtsoftware.com
     3231    // Qt5 ###: Change these strings to qt.nokia.com
    32143232    if (name == QLatin1String("http://xml.org/sax/features/namespaces")
    32153233        || name == QLatin1String("http://xml.org/sax/features/namespace-prefixes")
     
    34113429    // call the handler
    34123430    if (d->contentHnd) {
    3413         d->contentHnd->setDocumentLocator(d->locator);
     3431        d->contentHnd->setDocumentLocator(d->locator.data());
    34143432        if (!d->contentHnd->startDocument()) {
    34153433            d->reportParseError(d->contentHnd->errorString());
     
    54655483                    if (skipIt) {
    54665484                        if (contentHnd) {
    5467                             if (!contentHnd->skippedEntity(QString::fromLatin1("%") + ref())) {
     5485                            if (!contentHnd->skippedEntity(QLatin1Char('%') + ref())) {
    54685486                                reportParseError(contentHnd->errorString());
    54695487                                return false;
     
    54775495                        } else if (parsePEReference_context == InDTD) {
    54785496                            // Included as PE
    5479                             if (!insertXmlRef(QString::fromLatin1(" ")+xmlRefString+QString::fromLatin1(" "), ref(), false))
     5497                            if (!insertXmlRef(QLatin1Char(' ') + xmlRefString + QLatin1Char(' '), ref(), false))
    54805498                                return false;
    54815499                        }
     
    67296747                    parameterEntities.insert(name(), string());
    67306748                    if (declHnd) {
    6731                         if (!declHnd->internalEntityDecl(QString::fromLatin1("%")+name(), string())) {
     6749                        if (!declHnd->internalEntityDecl(QLatin1Char('%') + name(), string())) {
    67326750                            reportParseError(declHnd->errorString());
    67336751                            return false;
     
    67416759                    externParameterEntities.insert(name(), QXmlSimpleReaderPrivate::ExternParameterEntity(publicId, systemId));
    67426760                    if (declHnd) {
    6743                         if (!declHnd->externalEntityDecl(QString::fromLatin1("%")+name(), publicId, systemId)) {
     6761                        if (!declHnd->externalEntityDecl(QLatin1Char('%') + name(), publicId, systemId)) {
    67446762                            reportParseError(declHnd->errorString());
    67456763                            return false;
     
    78657883    if (inLiteral) {
    78667884        QString tmp = data;
    7867         xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1String("\""),
    7868                             QLatin1String("&quot;")).replace(QLatin1String("'"), QLatin1String("&apos;"))));
     7885        xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1Char('\"'),
     7886                            QLatin1String("&quot;")).replace(QLatin1Char('\''), QLatin1String("&apos;"))));
    78697887    } else {
    78707888        xmlRefStack.push(XmlRef(name, data));
  • trunk/src/xml/sax/qxml.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtXml 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4848#include <QtCore/qstringlist.h>
    4949#include <QtCore/qlist.h>
     50#include <QtCore/qscopedpointer.h>
    5051
    5152QT_BEGIN_HEADER
     
    194195    explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1,
    195196                                const QString &p = QString(), const QString &s = QString());
     197    QXmlParseException(const QXmlParseException &other);
    196198    ~QXmlParseException();
    197199
     
    203205
    204206private:
    205     QXmlParseExceptionPrivate *d;
     207    QScopedPointer<QXmlParseExceptionPrivate> d;
    206208};
    207209
     
    272274    Q_DISABLE_COPY(QXmlSimpleReader)
    273275    Q_DECLARE_PRIVATE(QXmlSimpleReader)
    274     QXmlSimpleReaderPrivate* d_ptr;
     276    QScopedPointer<QXmlSimpleReaderPrivate> d_ptr;
    275277
    276278    friend class QXmlSimpleReaderLocator;
  • trunk/src/xml/stream/qxmlstream.h

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the QtXml 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 have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
  • trunk/src/xml/xml.pro

    r2 r561  
    1919include(sax/sax.pri)
    2020include(stream/stream.pri)
     21
     22symbian:TARGET.UID3=0x2001B2E0
Note: See TracChangeset for help on using the changeset viewer.