Qt 4.8
|
Handles requests for documents, and instantiates them as AccelTree instances. More...
#include <qacceltreeresourceloader_p.h>
Public Types | |
enum | ErrorHandling { FailOnError, ContinueOnError } |
Public Types inherited from QPatternist::DeviceResourceLoader | |
typedef QExplicitlySharedDataPointer< DeviceResourceLoader > | Ptr |
Public Types inherited from QPatternist::ResourceLoader | |
typedef QExplicitlySharedDataPointer< ResourceLoader > | Ptr |
enum | Usage { MayUse, WillUse } |
Public Functions | |
AccelTreeResourceLoader (const NamePool::Ptr &np, const NetworkAccessDelegator::Ptr &networkDelegator, AccelTreeBuilder< true >::Features=AccelTreeBuilder< true >::NoneFeature) | |
virtual SequenceType::Ptr | announceDocument (const QUrl &uri, const Usage usageHint) |
May be called by the compilation framework at compile time to report that an XML document referenced by uri will be loaded at runtime. More... | |
virtual void | clear (const QUrl &uri) |
Asks to unload uri from its document pool, such that a subsequent request will require a new read. More... | |
virtual QSet< QUrl > | deviceURIs () const |
Returns the URIs this AccelTreeResourceLoader has loaded which are for devices through variable bindings. More... | |
virtual bool | isDocumentAvailable (const QUrl &uri) |
Calls to this function are generated by calls to the fn:doc-available() function. More... | |
virtual bool | isUnparsedTextAvailable (const QUrl &uri, const QString &encoding) |
Calls to this function are generated by calls to the fn:unparsed-text-available() function. More... | |
virtual Item | openDocument (const QUrl &uri, const ReportContext::Ptr &context) |
Calls to this function are generated by calls to the fn:document() or fn:doc() function. More... | |
virtual Item | openDocument (QIODevice *source, const QUrl &documentUri, const ReportContext::Ptr &context) |
virtual Item | openUnparsedText (const QUrl &uri, const QString &encoding, const ReportContext::Ptr &context, const SourceLocationReflection *const where) |
Calls to this function are generated by calls to the fn:unparsed-text() function. More... | |
Public Functions inherited from QPatternist::ResourceLoader | |
virtual SequenceType::Ptr | announceCollection (const QUrl &uri) |
May be called by the compilation framework at compile time to report that an node collection referenced by uri will be loaded at runtime. More... | |
virtual ItemType::Ptr | announceUnparsedText (const QUrl &uri) |
May be called by the compilation framework at compile time to report that an unparsed text(plain text) file referenced by uri will be loaded at runtime. More... | |
virtual Item::Iterator::Ptr | openCollection (const QUrl &uri) |
Calls to this function are generated by calls to the fn:collection() function. More... | |
ResourceLoader () | |
virtual | ~ResourceLoader () |
Public Functions inherited from QSharedData | |
QSharedData () | |
Constructs a QSharedData object with a reference count of 0. More... | |
QSharedData (const QSharedData &) | |
Constructs a QSharedData object with reference count 0. More... | |
Static Public Functions | |
static QNetworkReply * | load (const QUrl &uri, QNetworkAccessManager *const networkManager, const ReportContext::Ptr &context, ErrorHandling handling=FailOnError) |
Helper function that do NetworkAccessDelegator::get(), but does it blocked. More... | |
static QNetworkReply * | load (const QUrl &uri, const NetworkAccessDelegator::Ptr &networkDelegator, const ReportContext::Ptr &context, ErrorHandling handling=FailOnError) |
Private Functions | |
bool | retrieveDocument (const QUrl &uri, const ReportContext::Ptr &context) |
bool | retrieveDocument (QIODevice *source, const QUrl &documentUri, const ReportContext::Ptr &context) |
bool | retrieveUnparsedText (const QUrl &uri, const QString &encoding, const ReportContext::Ptr &context, const SourceLocationReflection *const where) |
Static Private Functions | |
static bool | streamToReceiver (QIODevice *const dev, AccelTreeBuilder< true > *const receiver, const NamePool::Ptr &np, const ReportContext::Ptr &context, const QUrl &uri) |
Properties | |
AccelTreeBuilder< true >::Features | m_features |
QHash< QUrl, AccelTree::Ptr > | m_loadedDocuments |
const NamePool::Ptr | m_namePool |
const NetworkAccessDelegator::Ptr | m_networkAccessDelegator |
QHash< QPair< QUrl, QString >, QString > | m_unparsedTexts |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Handles requests for documents, and instantiates them as AccelTree instances.
Definition at line 114 of file qacceltreeresourceloader_p.h.
Describes the behaviour of the resource loader in case of an error.
Enumerator | |
---|---|
FailOnError | The resource loader will report the error via the report context. |
ContinueOnError | The resource loader will report no error and return an empty QNetworkReply. |
Definition at line 121 of file qacceltreeresourceloader_p.h.
AccelTreeResourceLoader::AccelTreeResourceLoader | ( | const NamePool::Ptr & | np, |
const NetworkAccessDelegator::Ptr & | networkDelegator, | ||
AccelTreeBuilder< true >::Features | features = AccelTreeBuilder<true>::NoneFeature |
||
) |
AccelTreeResourceLoader does not own context
.
Definition at line 59 of file qacceltreeresourceloader.cpp.
|
virtual |
May be called by the compilation framework at compile time to report that an XML document referenced by uri
will be loaded at runtime.
This function can be called an arbitrary amount of times for the same URI, but different usageHint
values. How many times it is called for a URI has no meaning(beyond the first call, that is). For what queries the compilation framework can determine what always will be loaded is generally undefined. It depends on factors such as the complexity of the query, what information that is statically available and subsequently what optimizations that can be applied.
Calls to this function are generated by calls to the fn:document()
or fn:doc()
function.
uri | A URI identifying the resource to retrieve. The URI is guaranteed to be valid(QUrl::isValid() returns true ) and to be absolute(QUrl::isRelative() returns false ). |
usageHint | A hint to how the URI will be used. |
null
if the ResourceLoader can determine at this stage that no document referenced by uri
will ever be possible to load.uri
succeeds at runtime. This must be CommonSequenceTypes::zeroOrOneDocument, CommonSequenceTypes::exactlyOneDocument or a sequence type that is a sub type of it. Reimplemented from QPatternist::ResourceLoader.
Definition at line 296 of file qacceltreeresourceloader.cpp.
|
virtual |
Asks to unload uri
from its document pool, such that a subsequent request will require a new read.
The default implementation does nothing.
Reimplemented from QPatternist::ResourceLoader.
Definition at line 435 of file qacceltreeresourceloader.cpp.
Returns the URIs this AccelTreeResourceLoader has loaded which are for devices through variable bindings.
Implements QPatternist::DeviceResourceLoader.
Definition at line 418 of file qacceltreeresourceloader.cpp.
|
virtual |
Calls to this function are generated by calls to the fn:doc-available()
function.
uri | A URI identifying the resource to retrieve. The URI is guaranteed to be valid(QUrl::isValid() returns true ) and to be absolute(QUrl::isRelative() returns false ). |
true
if calling openDocument() while passing uri
will successfully load the document. Reimplemented from QPatternist::ResourceLoader.
Definition at line 306 of file qacceltreeresourceloader.cpp.
|
virtual |
Calls to this function are generated by calls to the fn:unparsed-text-available()
function.
uri | A URI identifying the resource to retrieve. The URI is guaranteed to be valid(QUrl::isValid() returns true ) and to be absolute(QUrl::isRelative() returns false ). |
true
if calling openUnparsedText() while passing uri
will successfully load the document. Reimplemented from QPatternist::ResourceLoader.
Definition at line 394 of file qacceltreeresourceloader.cpp.
|
static |
Helper function that do NetworkAccessDelegator::get(), but does it blocked.
The returned QNetworkReply has emitted QNetworkReply::finished().
The caller owns the return QIODevice instance.
context
may be null
or valid. If null
, no error reporting is done and null
is returned.
Definition at line 113 of file qacceltreeresourceloader.cpp.
Referenced by QXmlSchemaPrivate::load(), load(), QPatternist::XsdValidatingInstanceReader::loadSchema(), QPatternist::XsdSchemaParser::parseImport(), QPatternist::XsdSchemaParser::parseInclude(), QPatternist::XsdSchemaParser::parseRedefine(), retrieveDocument(), retrieveUnparsedText(), QXmlQuery::setQuery(), and QXmlSchemaValidator::validate().
|
static |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 104 of file qacceltreeresourceloader.cpp.
|
virtual |
Calls to this function are generated by calls to the fn:document()
or fn:doc()
function.
uri | A URI identifying the resource to retrieve. The URI is guaranteed to be valid(QUrl::isValid() returns true ) and to be absolute(QUrl::isRelative() returns false ). |
null
if no document can be loaded for uri
uri
. Remember that the QXmlNodeModelIndex must match the sequence type returned by announceDocument() Reimplemented from QPatternist::ResourceLoader.
Definition at line 264 of file qacceltreeresourceloader.cpp.
|
virtual |
Definition at line 280 of file qacceltreeresourceloader.cpp.
|
virtual |
Calls to this function are generated by calls to the fn:unparsed-text()
function.
uri | A URI identifying the resource to retrieve. The URI is guaranteed to be valid(QUrl::isValid() returns true ) and to be absolute(QUrl::isRelative() returns false ). |
encoding | the encoding to use. If empty, the user hasn't expressed any encoding to use. |
null
if no unparsed file can be loaded for uri
xs:string
value(or subtype) containing the content of the file identified by uri
as text. Remember that its type must match the sequence type returned by announceUnparsedText() Reimplemented from QPatternist::ResourceLoader.
Definition at line 400 of file qacceltreeresourceloader.cpp.
|
private |
Definition at line 70 of file qacceltreeresourceloader.cpp.
Referenced by isDocumentAvailable(), and openDocument().
|
private |
Definition at line 88 of file qacceltreeresourceloader.cpp.
|
private |
If context
is null
, no error reporting should be done.
Definition at line 317 of file qacceltreeresourceloader.cpp.
Referenced by isUnparsedTextAvailable(), and openUnparsedText().
|
staticprivate |
Definition at line 146 of file qacceltreeresourceloader.cpp.
Referenced by retrieveDocument().
|
private |
Definition at line 202 of file qacceltreeresourceloader_p.h.
Referenced by retrieveDocument().
|
private |
Definition at line 198 of file qacceltreeresourceloader_p.h.
Referenced by clear(), deviceURIs(), openDocument(), and retrieveDocument().
|
private |
Definition at line 199 of file qacceltreeresourceloader_p.h.
Referenced by AccelTreeResourceLoader(), and retrieveDocument().
|
private |
Definition at line 200 of file qacceltreeresourceloader_p.h.
Referenced by AccelTreeResourceLoader(), retrieveDocument(), and retrieveUnparsedText().
Definition at line 201 of file qacceltreeresourceloader_p.h.
Referenced by openUnparsedText(), and retrieveUnparsedText().