- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 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/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();
Note:
See TracChangeset
for help on using the changeset viewer.