Changeset 561 for trunk/src/xmlpatterns/acceltree
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 11 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/xmlpatterns/acceltree/qacceliterators.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 QtXmlPatterns 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/xmlpatterns/acceltree/qacceliterators_p.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 QtXmlPatterns 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 ** … … 66 66 * contains common functions and members. 67 67 * 68 * @author Frans Englich<f englich@trolltech.com>68 * @author Frans Englich<frans.englich@nokia.com> 69 69 */ 70 70 class AccelIterator : public QXmlNodeModelIndex::Iterator … … 111 111 * @short Iterates along the @c ancestor or @c ancestor-or-self axis in an AccelTree. 112 112 * 113 * @author Frans Englich<f englich@trolltech.com>113 * @author Frans Englich<frans.englich@nokia.com> 114 114 */ 115 115 template<const bool IncludeSelf> … … 152 152 * @short Iterates along the @c child axis in an AccelTree. 153 153 * 154 * @author Frans Englich<f englich@trolltech.com>154 * @author Frans Englich<frans.englich@nokia.com> 155 155 */ 156 156 class ChildIterator : public AccelIterator … … 191 191 * @short Iterates along the sibling axes in an AccelTree. 192 192 * 193 * @author Frans Englich<f englich@trolltech.com>193 * @author Frans Englich<frans.englich@nokia.com> 194 194 */ 195 195 template<const bool IsFollowing> … … 263 263 * AccelTree. 264 264 * 265 * @author Frans Englich <f englich@trolltech.com>265 * @author Frans Englich <frans.englich@nokia.com> 266 266 */ 267 267 template<const bool IncludeSelf> … … 343 343 * @short Implements axis @c following for the AccelTree. 344 344 * 345 * @author Frans Englich <f englich@trolltech.com>345 * @author Frans Englich <frans.englich@nokia.com> 346 346 */ 347 347 class FollowingIterator : public AccelIterator … … 363 363 * @short Implements axis @c preceding for the AccelTree. 364 364 * 365 * @author Frans Englich <f englich@trolltech.com>365 * @author Frans Englich <frans.englich@nokia.com> 366 366 */ 367 367 class PrecedingIterator : public AccelIterator … … 388 388 * @short Implements axis @c attribute for the AccelTree. 389 389 * 390 * @author Frans Englich <f englich@trolltech.com>390 * @author Frans Englich <frans.englich@nokia.com> 391 391 */ 392 392 class AttributeIterator : public AccelIterator -
trunk/src/xmlpatterns/acceltree/qacceltree.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 QtXmlPatterns 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 ** … … 43 43 44 44 #include "qabstractxmlreceiver.h" 45 #include "qabstractxmlnodemodel_p.h" 45 46 #include "qacceliterators_p.h" 46 47 #include "qacceltree_p.h" … … 56 57 using namespace QPatternist; 57 58 59 namespace QPatternist { 60 61 class AccelTreePrivate : public QAbstractXmlNodeModelPrivate 62 { 63 public: 64 AccelTreePrivate(AccelTree *accelTree) 65 : m_accelTree(accelTree) 66 { 67 } 68 69 virtual QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const 70 { 71 return m_accelTree->sourceLocation(index); 72 } 73 74 private: 75 AccelTree *m_accelTree; 76 }; 77 } 78 79 AccelTree::AccelTree(const QUrl &docURI, const QUrl &bURI) 80 : QAbstractXmlNodeModel(new AccelTreePrivate(this)) 81 , m_documentURI(docURI) 82 , m_baseURI(bURI) 83 { 84 /* Pre-allocate at least a little bit. */ 85 // TODO. Do it according to what an average 4 KB doc contains. 86 basicData.reserve(100); 87 data.reserve(30); 88 } 89 58 90 void AccelTree::printStats(const NamePool::Ptr &np) const 59 91 { … … 72 104 { 73 105 const BasicNodeData &v = basicData.at(i); 74 pDebug() << "|"<< i106 pDebug() << '|' << i 75 107 << "\t\t|" << v.depth() 76 108 << "\t|" << v.size() … … 82 114 << "\t|"; 83 115 /* 84 pDebug() << "|"<< QString().arg(i, 14)85 << "|"<< QString().arg(v.depth(), 6)86 << "|"<< QString().arg(v.size(), 6)87 << "|"<< QString().arg(postNumber(i), 14)88 << "|"<< QString().arg(v.kind(), 6)89 << "|";116 pDebug() << '|' << QString().arg(i, 14) 117 << '|' << QString().arg(v.depth(), 6) 118 << '|' << QString().arg(v.size(), 6) 119 << '|' << QString().arg(postNumber(i), 14) 120 << '|' << QString().arg(v.kind(), 6) 121 << '|'; 90 122 */ 91 123 } … … 675 707 } 676 708 709 QSourceLocation AccelTree::sourceLocation(const QXmlNodeModelIndex &index) const 710 { 711 const PreNumber key = toPreNumber(index); 712 if (sourcePositions.contains(key)) { 713 const QPair<qint64, qint64> position = sourcePositions.value(key); 714 return QSourceLocation(m_documentURI, position.first, position.second); 715 } else { 716 return QSourceLocation(); 717 } 718 } 719 677 720 void AccelTree::copyChildren(const QXmlNodeModelIndex &node, 678 721 QAbstractXmlReceiver *const receiver, -
trunk/src/xmlpatterns/acceltree/qacceltree_p.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 QtXmlPatterns 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 ** … … 77 77 * of staircase join, although that is only due to time constraints. 78 78 * 79 * @author Frans Englich <f englich@trolltech.com>79 * @author Frans Englich <frans.englich@nokia.com> 80 80 * @see <a href="http://www.pathfinder-xquery.org/?q=research/xpath-accel">XPath 81 81 * Accelerator</a> … … 90 90 * XPath Evaluation in Any RDBMS, Torsten Grust</a> 91 91 */ 92 class AccelTree : public QAbstractXmlNodeModel92 class Q_AUTOTEST_EXPORT AccelTree : public QAbstractXmlNodeModel 93 93 { 94 friend class AccelTreePrivate; 94 95 public: 95 96 using QAbstractXmlNodeModel::createIndex; … … 100 101 typedef qint8 Depth; 101 102 102 inline AccelTree(const QUrl &docURI, 103 const QUrl &bURI) : m_documentURI(docURI), 104 m_baseURI(bURI) 105 { 106 /* Pre-allocate at least a little bit. */ 107 // TODO. Do it according to what an average 4 KB doc contains. 108 basicData.reserve(100); 109 data.reserve(30); 110 } 103 AccelTree(const QUrl &docURI, const QUrl &bURI); 111 104 112 105 /** … … 116 109 * only used by those classes. 117 110 * 118 * @author Frans Englich <f englich@trolltech.com>111 * @author Frans Englich <frans.englich@nokia.com> 119 112 * @todo Can't m_kind be coded somewhere else? If m_name is invalid, 120 113 * its bits can be used to distinguish the node types that doesn't have … … 129 122 { 130 123 public: 124 /* No need to initialize the members. See AccelTreeBuilder. */ 131 125 inline BasicNodeData() 132 126 { … … 217 211 218 212 /** 219 * Technically it is sufficient with 8bits. However, at least MSVC213 * Technically it is sufficient with 7 bits. However, at least MSVC 220 214 * 2005 miscompiles it such that QXmlNodeModelIndex::Text becomes 221 215 * -64 instead of 64 with hilarious crashes as result. … … 281 275 282 276 QVector<BasicNodeData> basicData; 277 QHash<PreNumber, QPair<qint64, qint64> > sourcePositions; 283 278 284 279 inline QUrl documentUri() const … … 382 377 private: 383 378 /** 379 * Returns the source location for the object with the given @p index. 380 */ 381 QSourceLocation sourceLocation(const QXmlNodeModelIndex &index) const; 382 383 /** 384 384 * Copies the children of @p node to @p receiver. 385 385 */ -
trunk/src/xmlpatterns/acceltree/qacceltreebuilder.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 QtXmlPatterns 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 ** … … 50 50 const QUrl &baseURI, 51 51 const NamePool::Ptr &np, 52 ReportContext *const context) : m_preNumber(-1) 53 , m_isPreviousAtomic(false) 54 , m_hasCharacters(false) 55 , m_isCharactersCompressed(false) 56 , m_namePool(np) 57 , m_document(new AccelTree(docURI, baseURI)) 58 , m_skippedDocumentNodes(0) 59 , m_documentURI(docURI) 60 , m_context(context) 52 ReportContext *const context, 53 Features features) : m_preNumber(-1) 54 , m_isPreviousAtomic(false) 55 , m_hasCharacters(false) 56 , m_isCharactersCompressed(false) 57 , m_namePool(np) 58 , m_document(new AccelTree(docURI, baseURI)) 59 , m_skippedDocumentNodes(0) 60 , m_documentURI(docURI) 61 , m_context(context) 62 , m_features(features) 61 63 { 62 64 Q_ASSERT(m_namePool); … … 127 129 void AccelTreeBuilder<FromDocument>::startElement(const QXmlName &name) 128 130 { 131 startElement(name, 1, 1); 132 } 133 134 template <bool FromDocument> 135 void AccelTreeBuilder<FromDocument>::startElement(const QXmlName &name, qint64 line, qint64 column) 136 { 129 137 startStructure(); 130 138 131 m_document->basicData.append(AccelTree::BasicNodeData(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name)); 139 AccelTree::BasicNodeData data(currentDepth(), currentParent(), QXmlNodeModelIndex::Element, -1, name); 140 m_document->basicData.append(data); 141 if (m_features & SourceLocationsFeature) 142 m_document->sourcePositions.insert(m_document->maximumPreNumber(), qMakePair(line, column)); 132 143 133 144 ++m_preNumber; -
trunk/src/xmlpatterns/acceltree/qacceltreebuilder_p.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 QtXmlPatterns 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 ** … … 81 81 * are from node constructor expressions. 82 82 * 83 * @author Frans Englich <f englich@trolltech.com>83 * @author Frans Englich <frans.englich@nokia.com> 84 84 */ 85 85 template<bool FromDocument> … … 91 91 92 92 /** 93 * Describes the memory relevant features the builder shall support. 94 */ 95 enum Feature 96 { 97 NoneFeature, ///< No special features are enabled. 98 SourceLocationsFeature = 1 ///< The accel tree builder will store source locations for each start element. 99 }; 100 Q_DECLARE_FLAGS(Features, Feature) 101 102 /** 93 103 * @param context may be @c null. 94 104 */ … … 96 106 const QUrl &baseURI, 97 107 const NamePool::Ptr &np, 98 ReportContext *const context); 108 ReportContext *const context, 109 Features features = NoneFeature); 99 110 virtual void startDocument(); 100 111 virtual void endDocument(); 101 112 virtual void startElement(const QXmlName &name); 113 void startElement(const QXmlName &name, qint64 line, qint64 column); 102 114 virtual void endElement(); 103 115 virtual void attribute(const QXmlName &name, const QStringRef &value); … … 176 188 */ 177 189 ReportContext *const m_context; 190 191 Features m_features; 178 192 }; 193 194 Q_DECLARE_OPERATORS_FOR_FLAGS(AccelTreeBuilder<true>::Features) 195 Q_DECLARE_OPERATORS_FOR_FLAGS(AccelTreeBuilder<false>::Features) 179 196 180 197 #include "qacceltreebuilder.cpp" -
trunk/src/xmlpatterns/acceltree/qacceltreeresourceloader.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 QtXmlPatterns 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 ** … … 47 47 #include <QtNetwork/QNetworkRequest> 48 48 49 #include "qacceltreebuilder_p.h"50 49 #include "qatomicstring_p.h" 51 50 #include "qautoptr_p.h" … … 58 57 using namespace QPatternist; 59 58 60 static inline uint qHash(const QUrl &uri)61 {62 return qHash(uri.toString());63 }64 65 59 AccelTreeResourceLoader::AccelTreeResourceLoader(const NamePool::Ptr &np, 66 const NetworkAccessDelegator::Ptr &manager) : m_namePool(np) 67 , m_networkAccessDelegator(manager) 60 const NetworkAccessDelegator::Ptr &manager, 61 AccelTreeBuilder<true>::Features features) 62 : m_namePool(np) 63 , m_networkAccessDelegator(manager) 64 , m_features(features) 68 65 { 69 66 Q_ASSERT(m_namePool); … … 75 72 { 76 73 Q_ASSERT(uri.isValid()); 77 AccelTreeBuilder<true> builder(uri, uri, m_namePool, context.data() );74 AccelTreeBuilder<true> builder(uri, uri, m_namePool, context.data(), m_features); 78 75 79 76 const AutoPtr<QNetworkReply> reply(load(uri, m_networkAccessDelegator, context)); … … 89 86 } 90 87 88 bool AccelTreeResourceLoader::retrieveDocument(QIODevice *source, const QUrl &documentUri, const ReportContext::Ptr &context) 89 { 90 Q_ASSERT(source); 91 Q_ASSERT(source->isReadable()); 92 Q_ASSERT(documentUri.isValid()); 93 94 AccelTreeBuilder<true> builder(documentUri, documentUri, m_namePool, context.data(), m_features); 95 96 bool success = false; 97 success = streamToReceiver(source, &builder, m_namePool, context, documentUri); 98 99 m_loadedDocuments.insert(documentUri, builder.builtDocument()); 100 101 return success; 102 } 103 91 104 QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri, 92 105 const NetworkAccessDelegator::Ptr &networkDelegator, 93 const ReportContext::Ptr &context )106 const ReportContext::Ptr &context, ErrorHandling errorHandling) 94 107 { 95 108 return load(uri, 96 109 networkDelegator->managerFor(uri), 97 context );110 context, errorHandling); 98 111 } 99 112 100 113 QNetworkReply *AccelTreeResourceLoader::load(const QUrl &uri, 101 114 QNetworkAccessManager *const networkManager, 102 const ReportContext::Ptr &context) 115 const ReportContext::Ptr &context, ErrorHandling errorHandling) 116 103 117 { 104 118 Q_ASSERT(networkManager); … … 112 126 networkLoop.connect(reply, SIGNAL(finished()), SLOT(finished())); 113 127 114 if(networkLoop.exec( ))128 if(networkLoop.exec(QEventLoop::ExcludeUserInputEvents)) 115 129 { 116 130 const QString errorMessage(escape(reply->errorString())); … … 121 135 const QSourceLocation location(uri); 122 136 123 if(context )137 if(context && (errorHandling == FailOnError)) 124 138 context->error(errorMessage, ReportContext::FODC0002, location); 125 139 … … 131 145 132 146 bool AccelTreeResourceLoader::streamToReceiver(QIODevice *const dev, 133 QAbstractXmlReceiver*const receiver,147 AccelTreeBuilder<true> *const receiver, 134 148 const NamePool::Ptr &np, 135 149 const ReportContext::Ptr &context, … … 155 169 /* Send the name. */ 156 170 receiver->startElement(np->allocateQName(reader.namespaceUri().toString(), reader.name().toString(), 157 reader.prefix().toString()) );171 reader.prefix().toString()), reader.lineNumber(), reader.columnNumber()); 158 172 159 173 /* Send namespace declarations. */ … … 259 273 if(retrieveDocument(uri, context)) 260 274 return m_loadedDocuments.value(uri)->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */ 275 else 276 return Item(); 277 } 278 } 279 280 Item AccelTreeResourceLoader::openDocument(QIODevice *source, const QUrl &documentUri, 281 const ReportContext::Ptr &context) 282 { 283 const AccelTree::Ptr doc(m_loadedDocuments.value(documentUri)); 284 285 if(doc) 286 return doc->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */ 287 else 288 { 289 if(retrieveDocument(source, documentUri, context)) 290 return m_loadedDocuments.value(documentUri)->root(QXmlNodeModelIndex()); /* Pass in dummy object. We know AccelTree doesn't use it. */ 261 291 else 262 292 return Item(); -
trunk/src/xmlpatterns/acceltree/qacceltreeresourceloader_p.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 QtXmlPatterns 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 ** … … 53 53 #define Patternist_AccelTreeResourceLoader_H 54 54 55 #include <QtCore/QHash>56 55 #include <QtCore/QEventLoop> 57 56 #include <QtNetwork/QNetworkReply> … … 59 58 #include "qabstractxmlreceiver.h" 60 59 #include "qacceltree_p.h" 60 #include "qacceltreebuilder_p.h" 61 61 #include "qdeviceresourceloader_p.h" 62 62 #include "qnamepool_p.h" … … 77 77 * 78 78 * @see AccelTreeResourceLoader::load() 79 * @author Frans Englich <f englich@trolltech.com>79 * @author Frans Englich <frans.englich@nokia.com> 80 80 */ 81 81 class NetworkLoop : public QEventLoop … … 110 110 * them as AccelTree instances. 111 111 * 112 * @author Frans Englich <f englich@trolltech.com>112 * @author Frans Englich <frans.englich@nokia.com> 113 113 */ 114 114 class Q_AUTOTEST_EXPORT AccelTreeResourceLoader : public DeviceResourceLoader … … 116 116 public: 117 117 /** 118 * Describes the behaviour of the resource loader in case of an 119 * error. 120 */ 121 enum ErrorHandling 122 { 123 FailOnError, ///< The resource loader will report the error via the report context. 124 ContinueOnError ///< The resource loader will report no error and return an empty QNetworkReply. 125 }; 126 127 /** 118 128 * AccelTreeResourceLoader does not own @p context. 119 129 */ 120 130 AccelTreeResourceLoader(const NamePool::Ptr &np, 121 const NetworkAccessDelegator::Ptr &networkDelegator );131 const NetworkAccessDelegator::Ptr &networkDelegator, AccelTreeBuilder<true>::Features = AccelTreeBuilder<true>::NoneFeature); 122 132 123 133 virtual Item openDocument(const QUrl &uri, 134 const ReportContext::Ptr &context); 135 virtual Item openDocument(QIODevice *source, const QUrl &documentUri, 124 136 const ReportContext::Ptr &context); 125 137 virtual SequenceType::Ptr announceDocument(const QUrl &uri, const Usage usageHint); … … 134 146 const SourceLocationReflection *const where); 135 147 136 137 148 /** 138 149 * @short Helper function that do NetworkAccessDelegator::get(), but … … 150 161 static QNetworkReply *load(const QUrl &uri, 151 162 QNetworkAccessManager *const networkManager, 152 const ReportContext::Ptr &context );163 const ReportContext::Ptr &context, ErrorHandling handling = FailOnError); 153 164 154 165 /** … … 157 168 static QNetworkReply *load(const QUrl &uri, 158 169 const NetworkAccessDelegator::Ptr &networkDelegator, 159 const ReportContext::Ptr &context );170 const ReportContext::Ptr &context, ErrorHandling handling = FailOnError); 160 171 161 172 /** … … 166 177 167 178 virtual void clear(const QUrl &uri); 179 168 180 private: 169 181 static bool streamToReceiver(QIODevice *const dev, 170 QAbstractXmlReceiver*const receiver,182 AccelTreeBuilder<true> *const receiver, 171 183 const NamePool::Ptr &np, 172 184 const ReportContext::Ptr &context, … … 174 186 bool retrieveDocument(const QUrl &uri, 175 187 const ReportContext::Ptr &context); 188 bool retrieveDocument(QIODevice *source, const QUrl &documentUri, 189 const ReportContext::Ptr &context); 176 190 /** 177 191 * If @p context is @c null, no error reporting should be done. … … 186 200 const NetworkAccessDelegator::Ptr m_networkAccessDelegator; 187 201 QHash<QPair<QUrl, QString>, QString> m_unparsedTexts; 202 AccelTreeBuilder<true>::Features m_features; 188 203 }; 189 204 } -
trunk/src/xmlpatterns/acceltree/qcompressedwhitespace.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 QtXmlPatterns 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/xmlpatterns/acceltree/qcompressedwhitespace_p.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 QtXmlPatterns 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 ** … … 83 83 * The compression scheme originates from Saxon, by Michael Kay. 84 84 * 85 * @author Frans Englich <f englich@trolltech.com>85 * @author Frans Englich <frans.englich@nokia.com> 86 86 */ 87 class CompressedWhitespace87 class Q_AUTOTEST_EXPORT CompressedWhitespace 88 88 { 89 89 public:
Note:
See TracChangeset
for help on using the changeset viewer.