Changeset 561 for trunk/src/xml
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/xml/dom/qdom.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtXml module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 57 57 #include <qvariant.h> 58 58 #include <qmap.h> 59 #include <qshareddata.h> 59 60 #include <qdebug.h> 60 61 #include <stdio.h> … … 125 126 { 126 127 public: 127 QDomImplementationPrivate() { ref = 1; } 128 inline QDomImplementationPrivate() {} 129 128 130 QDomImplementationPrivate* clone(); 129 131 QAtomicInt ref; … … 513 515 514 516 // Attributes 515 QDomDocumentTypePrivate* doctype() { return type ; };516 QDomImplementationPrivate* implementation() { return impl ; };517 QDomDocumentTypePrivate* doctype() { return type.data(); } 518 QDomImplementationPrivate* implementation() { return impl.data(); } 517 519 QDomElementPrivate* documentElement(); 518 520 … … 538 540 539 541 // Variables 540 Q DomImplementationPrivate*impl;541 Q DomDocumentTypePrivate*type;542 QExplicitlySharedDataPointer<QDomImplementationPrivate> impl; 543 QExplicitlySharedDataPointer<QDomDocumentTypePrivate> type; 542 544 543 545 void saveDocument(QTextStream& stream, const int indent, QDomNode::EncodingPolicy encUsed) const; … … 865 867 QDomImplementationPrivate* QDomImplementationPrivate::clone() 866 868 { 867 QDomImplementationPrivate* p = new QDomImplementationPrivate; 868 // We are not interested in this node 869 p->ref.deref(); 870 return p; 869 return new QDomImplementationPrivate; 871 870 } 872 871 … … 1846 1845 1847 1846 // We are no longer interested in the old node 1848 if (oldChild) 1849 oldChild->ref.deref(); 1847 oldChild->ref.deref(); 1850 1848 1851 1849 return oldChild; … … 1940 1938 \inmodule QtXml 1941 1939 \ingroup xml-tools 1942 \mainclass 1940 1943 1941 1944 1942 Many functions in the DOM return a QDomNode. … … 2695 2693 encoded in the given encoding, the result and behavior is undefined. 2696 2694 2697 \since 4.22695 \since 4.2 2698 2696 */ 2699 2697 void QDomNode::save(QTextStream& str, int indent, EncodingPolicy encodingPolicy) const … … 3061 3059 QDomNamedNodeMapPrivate* QDomNamedNodeMapPrivate::clone(QDomNodePrivate* p) 3062 3060 { 3063 Q DomNamedNodeMapPrivate* m = new QDomNamedNodeMapPrivate(p);3061 QScopedPointer<QDomNamedNodeMapPrivate> m(new QDomNamedNodeMapPrivate(p)); 3064 3062 m->readonly = readonly; 3065 3063 m->appendToParent = appendToParent; … … 3074 3072 // we are no longer interested in ownership 3075 3073 m->ref.deref(); 3076 return m ;3074 return m.take(); 3077 3075 } 3078 3076 … … 3500 3498 { 3501 3499 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 } 3509 3512 } 3510 3513 … … 4356 4359 { 4357 4360 Q_ASSERT(impl->parent()); 4358 if (!impl || !impl->parent()->isElement())4361 if (!impl->parent()->isElement()) 4359 4362 return QDomElement(); 4360 4363 return QDomElement((QDomElementPrivate*)(impl->parent())); … … 4590 4593 nsDecl = QLatin1String(" xmlns:") + prefix; 4591 4594 } 4592 nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1 String("\"");4595 nsDecl += QLatin1String("=\"") + encodeText(namespaceURI, s) + QLatin1Char('\"'); 4593 4596 } 4594 4597 s << '<' << qName << nsDecl; … … 4598 4601 /* Write out attributes. */ 4599 4602 if (!m_attr->map.isEmpty()) { 4600 s << ' ';4601 4603 QHash<QString, QDomNodePrivate *>::const_iterator it = m_attr->map.constBegin(); 4602 4604 for (; it != m_attr->map.constEnd(); ++it) { 4605 s << ' '; 4603 4606 if (it.value()->namespaceURI.isNull()) { 4604 4607 s << it.value()->name << "=\"" << encodeText(it.value()->value, s, true, true) << '\"'; … … 4623 4626 } 4624 4627 } 4625 s << ' ';4626 4628 } 4627 4629 } … … 6147 6149 QDomDocumentPrivate::QDomDocumentPrivate() 6148 6150 : QDomNodePrivate(0), 6151 impl(new QDomImplementationPrivate), 6149 6152 nodeListTime(1) 6150 6153 { 6151 impl = new QDomImplementationPrivate;6152 6154 type = new QDomDocumentTypePrivate(this, this); 6155 type->ref.deref(); 6153 6156 6154 6157 name = QLatin1String("#document"); … … 6157 6160 QDomDocumentPrivate::QDomDocumentPrivate(const QString& aname) 6158 6161 : QDomNodePrivate(0), 6162 impl(new QDomImplementationPrivate), 6159 6163 nodeListTime(1) 6160 6164 { 6161 impl = new QDomImplementationPrivate;6162 6165 type = new QDomDocumentTypePrivate(this, this); 6166 type->ref.deref(); 6163 6167 type->name = aname; 6164 6168 … … 6168 6172 QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentTypePrivate* dt) 6169 6173 : QDomNodePrivate(0), 6174 impl(new QDomImplementationPrivate), 6170 6175 nodeListTime(1) 6171 6176 { 6172 impl = new QDomImplementationPrivate;6173 6177 if (dt != 0) { 6174 6178 type = dt; 6175 type->ref.ref();6176 6179 } else { 6177 6180 type = new QDomDocumentTypePrivate(this, this); 6181 type->ref.deref(); 6178 6182 } 6179 6183 … … 6183 6187 QDomDocumentPrivate::QDomDocumentPrivate(QDomDocumentPrivate* n, bool deep) 6184 6188 : QDomNodePrivate(n, deep), 6189 impl(n->impl->clone()), 6185 6190 nodeListTime(1) 6186 6191 { 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()); 6191 6193 type->setParent(this); 6192 // Reference count is down to 0, so we set it to 1 here.6193 type->ref.ref();6194 6194 } 6195 6195 6196 6196 QDomDocumentPrivate::~QDomDocumentPrivate() 6197 6197 { 6198 if (!impl->ref.deref())6199 delete impl;6200 if (!type->ref.deref())6201 delete type;6202 6198 } 6203 6199 6204 6200 void QDomDocumentPrivate::clear() 6205 6201 { 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(); 6212 6204 QDomNodePrivate::clear(); 6213 6205 } … … 6232 6224 impl = new QDomImplementationPrivate; 6233 6225 type = new QDomDocumentTypePrivate(this, this); 6226 type->ref.deref(); 6234 6227 6235 6228 bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces")) … … 6446 6439 const QDomNodePrivate* n = first; 6447 6440 6441 QTextCodec *codec = 0; 6442 6448 6443 if (n && n->isProcessingInstruction() && n->nodeName() == QLatin1String("xml")) { 6449 6444 // we have an XML declaration … … 6452 6447 encoding.indexIn(data); 6453 6448 QString enc = encoding.cap(3); 6454 if (enc.isEmpty()) {6449 if (enc.isEmpty()) 6455 6450 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()); 6463 6453 } 6454 if (!codec) 6455 codec = QTextCodec::codecForName("UTF-8"); 6456 if (codec) 6457 s.setCodec(codec); 6464 6458 #endif 6465 6459 bool doc = false; … … 6525 6519 6526 6520 \inmodule QtXml 6527 \mainclass 6521 6528 6522 \ingroup xml-tools 6529 6523 … … 7380 7374 7381 7375 QDomHandler::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 { 7387 7379 } 7388 7380 … … 7416 7408 n = doc->createElement(qName); 7417 7409 } 7418 n->setLocation(locator->lineNumber(), locator->columnNumber()); 7410 7411 if (n) 7412 n->setLocation(locator->lineNumber(), locator->columnNumber()); 7419 7413 7420 7414 node->appendChild(n); … … 7436 7430 bool QDomHandler::endElement(const QString&, const QString&, const QString&) 7437 7431 { 7438 if ( node == doc)7432 if (!node || node == doc) 7439 7433 return false; 7440 7434 node = node->parent(); … … 7449 7443 return false; 7450 7444 7451 Q DomNodePrivate *n;7445 QScopedPointer<QDomNodePrivate> n; 7452 7446 if (cdata) { 7453 n = doc->createCDATASection(ch);7447 n.reset(doc->createCDATASection(ch)); 7454 7448 } else if (!entityName.isEmpty()) { 7455 Q DomEntityPrivate* e =new QDomEntityPrivate(doc, 0, entityName,7456 QString(), QString(), QString()) ;7449 QScopedPointer<QDomEntityPrivate> e(new QDomEntityPrivate(doc, 0, entityName, 7450 QString(), QString(), QString())); 7457 7451 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)); 7460 7455 } else { 7461 n = doc->createTextNode(ch);7456 n.reset(doc->createTextNode(ch)); 7462 7457 } 7463 7458 n->setLocation(locator->lineNumber(), locator->columnNumber()); 7464 node->appendChild(n); 7459 node->appendChild(n.data()); 7460 n.take(); 7465 7461 7466 7462 return true; -
trunk/src/xml/dom/qdom.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtXml module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/xml/sax/qxml.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtXml module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 245 245 { 246 246 public: 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 247 257 QString msg; 248 258 int column; … … 263 273 class QXmlSimpleReaderPrivate 264 274 { 275 public: 276 ~QXmlSimpleReaderPrivate(); 265 277 private: 266 278 // functions 267 QXmlSimpleReaderPrivate(); 268 ~QXmlSimpleReaderPrivate(); 279 QXmlSimpleReaderPrivate(QXmlSimpleReader *reader); 269 280 void initIncrementalParsing(); 270 281 … … 303 314 // used for parsing of entity references 304 315 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) 306 319 : name(_name), value(_value), index(0) {} 307 320 bool isEmpty() const { return index == value.length(); } … … 349 362 350 363 // helper classes 351 Q XmlLocator *locator;364 QScopedPointer<QXmlLocator> locator; 352 365 QXmlNamespaceSupport namespaceSupport; 353 366 … … 544 557 QXmlParseException::QXmlParseException(const QString& name, int c, int l, 545 558 const QString& p, const QString& s) 546 { 547 d = new QXmlParseExceptionPrivate; 559 : d(new QXmlParseExceptionPrivate) 560 { 548 561 d->msg = name; 549 562 d->column = c; … … 554 567 555 568 /*! 569 Creates a copy of \a other. 570 */ 571 QXmlParseException::QXmlParseException(const QXmlParseException& other) : 572 d(new QXmlParseExceptionPrivate(*other.d)) 573 { 574 575 } 576 577 /*! 556 578 Destroys the QXmlParseException. 557 579 */ 558 580 QXmlParseException::~QXmlParseException() 559 581 { 560 delete d;561 582 } 562 583 … … 927 948 void QXmlNamespaceSupport::reset() 928 949 { 950 QXmlNamespaceSupportPrivate *newD = new QXmlNamespaceSupportPrivate; 929 951 delete d; 930 d = new QXmlNamespaceSupportPrivate;952 d = newD; 931 953 } 932 954 … … 1259 1281 d = new QXmlInputSourcePrivate; 1260 1282 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()); 1265 1288 #ifndef QT_NO_TEXTCODEC 1266 d->encMapper = 0;1289 d->encMapper = 0; 1267 1290 #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 } 1273 1300 } 1274 1301 … … 2108 2135 QXmlReader::setLexicalHandler(). 2109 2136 2110 This interface's design is based on the theSAX2 extension2137 This interface's design is based on the SAX2 extension 2111 2138 LexicalHandler. 2112 2139 … … 2404 2431 \reimp 2405 2432 2406 Does nothing.2433 This reimplementation does nothing. 2407 2434 */ 2408 2435 void QXmlDefaultHandler::setDocumentLocator(QXmlLocator*) … … 2413 2440 \reimp 2414 2441 2415 Does nothing.2442 This reimplementation does nothing. 2416 2443 */ 2417 2444 bool QXmlDefaultHandler::startDocument() … … 2423 2450 \reimp 2424 2451 2425 Does nothing.2452 This reimplementation does nothing. 2426 2453 */ 2427 2454 bool QXmlDefaultHandler::endDocument() … … 2433 2460 \reimp 2434 2461 2435 Does nothing.2462 This reimplementation does nothing. 2436 2463 */ 2437 2464 bool QXmlDefaultHandler::startPrefixMapping(const QString&, const QString&) … … 2443 2470 \reimp 2444 2471 2445 Does nothing.2472 This reimplementation does nothing. 2446 2473 */ 2447 2474 bool QXmlDefaultHandler::endPrefixMapping(const QString&) … … 2453 2480 \reimp 2454 2481 2455 Does nothing.2482 This reimplementation does nothing. 2456 2483 */ 2457 2484 bool QXmlDefaultHandler::startElement(const QString&, const QString&, … … 2464 2491 \reimp 2465 2492 2466 Does nothing.2493 This reimplementation does nothing. 2467 2494 */ 2468 2495 bool QXmlDefaultHandler::endElement(const QString&, const QString&, … … 2475 2502 \reimp 2476 2503 2477 Does nothing.2504 This reimplementation does nothing. 2478 2505 */ 2479 2506 bool QXmlDefaultHandler::characters(const QString&) … … 2485 2512 \reimp 2486 2513 2487 Does nothing.2514 This reimplementation does nothing. 2488 2515 */ 2489 2516 bool QXmlDefaultHandler::ignorableWhitespace(const QString&) … … 2495 2522 \reimp 2496 2523 2497 Does nothing.2524 This reimplementation does nothing. 2498 2525 */ 2499 2526 bool QXmlDefaultHandler::processingInstruction(const QString&, … … 2506 2533 \reimp 2507 2534 2508 Does nothing.2535 This reimplementation does nothing. 2509 2536 */ 2510 2537 bool QXmlDefaultHandler::skippedEntity(const QString&) … … 2516 2543 \reimp 2517 2544 2518 Does nothing.2545 This reimplementation does nothing. 2519 2546 */ 2520 2547 bool QXmlDefaultHandler::warning(const QXmlParseException&) … … 2526 2553 \reimp 2527 2554 2528 Does nothing.2555 This reimplementation does nothing. 2529 2556 */ 2530 2557 bool QXmlDefaultHandler::error(const QXmlParseException&) … … 2536 2563 \reimp 2537 2564 2538 Does nothing.2565 This reimplementation does nothing. 2539 2566 */ 2540 2567 bool QXmlDefaultHandler::fatalError(const QXmlParseException&) … … 2546 2573 \reimp 2547 2574 2548 Does nothing.2575 This reimplementation does nothing. 2549 2576 */ 2550 2577 bool QXmlDefaultHandler::notationDecl(const QString&, const QString&, … … 2557 2584 \reimp 2558 2585 2559 Does nothing.2586 This reimplementation does nothing. 2560 2587 */ 2561 2588 bool QXmlDefaultHandler::unparsedEntityDecl(const QString&, const QString&, … … 2591 2618 \reimp 2592 2619 2593 Does nothing.2620 This reimplementation does nothing. 2594 2621 */ 2595 2622 bool QXmlDefaultHandler::startDTD(const QString&, const QString&, const QString&) … … 2601 2628 \reimp 2602 2629 2603 Does nothing.2630 This reimplementation does nothing. 2604 2631 */ 2605 2632 bool QXmlDefaultHandler::endDTD() … … 2611 2638 \reimp 2612 2639 2613 Does nothing.2640 This reimplementation does nothing. 2614 2641 */ 2615 2642 bool QXmlDefaultHandler::startEntity(const QString&) … … 2621 2648 \reimp 2622 2649 2623 Does nothing.2650 This reimplementation does nothing. 2624 2651 */ 2625 2652 bool QXmlDefaultHandler::endEntity(const QString&) … … 2631 2658 \reimp 2632 2659 2633 Does nothing.2660 This reimplementation does nothing. 2634 2661 */ 2635 2662 bool QXmlDefaultHandler::startCDATA() … … 2641 2668 \reimp 2642 2669 2643 Does nothing.2670 This reimplementation does nothing. 2644 2671 */ 2645 2672 bool QXmlDefaultHandler::endCDATA() … … 2651 2678 \reimp 2652 2679 2653 Does nothing.2680 This reimplementation does nothing. 2654 2681 */ 2655 2682 bool QXmlDefaultHandler::comment(const QString&) … … 2661 2688 \reimp 2662 2689 2663 Does nothing.2690 This reimplementation does nothing. 2664 2691 */ 2665 2692 bool QXmlDefaultHandler::attributeDecl(const QString&, const QString&, const QString&, const QString&, const QString&) … … 2671 2698 \reimp 2672 2699 2673 Does nothing.2700 This reimplementation does nothing. 2674 2701 */ 2675 2702 bool QXmlDefaultHandler::internalEntityDecl(const QString&, const QString&) … … 2681 2708 \reimp 2682 2709 2683 Does nothing.2710 This reimplementation does nothing. 2684 2711 */ 2685 2712 bool QXmlDefaultHandler::externalEntityDecl(const QString&, const QString&, const QString&) … … 2714 2741 } 2715 2742 2716 QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate() 2717 { 2743 QXmlSimpleReaderPrivate::QXmlSimpleReaderPrivate(QXmlSimpleReader *reader) 2744 { 2745 q_ptr = reader; 2718 2746 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; 2719 2761 } 2720 2762 … … 2726 2768 void QXmlSimpleReaderPrivate::initIncrementalParsing() 2727 2769 { 2728 delete parseStack; 2729 parseStack = new QStack<ParseState>; 2770 if(parseStack) 2771 parseStack->clear(); 2772 else 2773 parseStack = new QStack<ParseState>; 2730 2774 } 2731 2775 … … 2969 3013 \inmodule QtXml 2970 3014 \ingroup xml-tools 2971 \mainclass 3015 2972 3016 2973 3017 This XML reader is suitable for a wide range of applications. It … … 3013 3057 parseContinue() function, until all the data has been processed. 3014 3058 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 3024 3063 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 3027 3067 3028 3068 QXmlSimpleReader is not reentrant. If you want to use the class 3029 3069 in threaded code, lock the code using QXmlSimpleReader with a 3030 3070 locking mechanism, such as a QMutex. 3031 3032 \snippet doc/src/snippets/code/src_xml_sax_qxml.cpp 03033 3071 */ 3034 3072 … … 3100 3138 */ 3101 3139 QXmlSimpleReader::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 { 3121 3142 } 3122 3143 … … 3126 3147 QXmlSimpleReader::~QXmlSimpleReader() 3127 3148 { 3128 Q_D(QXmlSimpleReader);3129 delete d->locator;3130 delete d;3131 3149 } 3132 3150 … … 3138 3156 const QXmlSimpleReaderPrivate *d = d_func(); 3139 3157 3140 // Qt5 ###: Change these strings to qt software.com3158 // Qt5 ###: Change these strings to qt.nokia.com 3141 3159 if (ok != 0) 3142 3160 *ok = true; … … 3193 3211 { 3194 3212 Q_D(QXmlSimpleReader); 3195 // Qt5 ###: Change these strings to qt software.com3213 // Qt5 ###: Change these strings to qt.nokia.com 3196 3214 if (name == QLatin1String("http://xml.org/sax/features/namespaces")) { 3197 3215 d->useNamespaces = enable; … … 3211 3229 bool QXmlSimpleReader::hasFeature(const QString& name) const 3212 3230 { 3213 // Qt5 ###: Change these strings to qt software.com3231 // Qt5 ###: Change these strings to qt.nokia.com 3214 3232 if (name == QLatin1String("http://xml.org/sax/features/namespaces") 3215 3233 || name == QLatin1String("http://xml.org/sax/features/namespace-prefixes") … … 3411 3429 // call the handler 3412 3430 if (d->contentHnd) { 3413 d->contentHnd->setDocumentLocator(d->locator );3431 d->contentHnd->setDocumentLocator(d->locator.data()); 3414 3432 if (!d->contentHnd->startDocument()) { 3415 3433 d->reportParseError(d->contentHnd->errorString()); … … 5465 5483 if (skipIt) { 5466 5484 if (contentHnd) { 5467 if (!contentHnd->skippedEntity(Q String::fromLatin1("%") + ref())) {5485 if (!contentHnd->skippedEntity(QLatin1Char('%') + ref())) { 5468 5486 reportParseError(contentHnd->errorString()); 5469 5487 return false; … … 5477 5495 } else if (parsePEReference_context == InDTD) { 5478 5496 // Included as PE 5479 if (!insertXmlRef(Q String::fromLatin1(" ")+xmlRefString+QString::fromLatin1(" "), ref(), false))5497 if (!insertXmlRef(QLatin1Char(' ') + xmlRefString + QLatin1Char(' '), ref(), false)) 5480 5498 return false; 5481 5499 } … … 6729 6747 parameterEntities.insert(name(), string()); 6730 6748 if (declHnd) { 6731 if (!declHnd->internalEntityDecl(Q String::fromLatin1("%")+name(), string())) {6749 if (!declHnd->internalEntityDecl(QLatin1Char('%') + name(), string())) { 6732 6750 reportParseError(declHnd->errorString()); 6733 6751 return false; … … 6741 6759 externParameterEntities.insert(name(), QXmlSimpleReaderPrivate::ExternParameterEntity(publicId, systemId)); 6742 6760 if (declHnd) { 6743 if (!declHnd->externalEntityDecl(Q String::fromLatin1("%")+name(), publicId, systemId)) {6761 if (!declHnd->externalEntityDecl(QLatin1Char('%') + name(), publicId, systemId)) { 6744 6762 reportParseError(declHnd->errorString()); 6745 6763 return false; … … 7865 7883 if (inLiteral) { 7866 7884 QString tmp = data; 7867 xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1 String("\""),7868 QLatin1String(""")).replace(QLatin1 String("'"), QLatin1String("'"))));7885 xmlRefStack.push(XmlRef(name, tmp.replace(QLatin1Char('\"'), 7886 QLatin1String(""")).replace(QLatin1Char('\''), QLatin1String("'")))); 7869 7887 } else { 7870 7888 xmlRefStack.push(XmlRef(name, data)); -
trunk/src/xml/sax/qxml.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtXml module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 48 48 #include <QtCore/qstringlist.h> 49 49 #include <QtCore/qlist.h> 50 #include <QtCore/qscopedpointer.h> 50 51 51 52 QT_BEGIN_HEADER … … 194 195 explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1, 195 196 const QString &p = QString(), const QString &s = QString()); 197 QXmlParseException(const QXmlParseException &other); 196 198 ~QXmlParseException(); 197 199 … … 203 205 204 206 private: 205 Q XmlParseExceptionPrivate *d;207 QScopedPointer<QXmlParseExceptionPrivate> d; 206 208 }; 207 209 … … 272 274 Q_DISABLE_COPY(QXmlSimpleReader) 273 275 Q_DECLARE_PRIVATE(QXmlSimpleReader) 274 Q XmlSimpleReaderPrivate*d_ptr;276 QScopedPointer<QXmlSimpleReaderPrivate> d_ptr; 275 277 276 278 friend class QXmlSimpleReaderLocator; -
trunk/src/xml/stream/qxmlstream.h
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtXml module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** -
trunk/src/xml/xml.pro
r2 r561 19 19 include(sax/sax.pri) 20 20 include(stream/stream.pri) 21 22 symbian:TARGET.UID3=0x2001B2E0
Note:
See TracChangeset
for help on using the changeset viewer.