![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QQmlDataBlob encapsulates a data request that can be issued to a QQmlTypeLoader. More...
#include <qqmldatablob_p.h>
Classes | |
| class | SourceCodeData |
Public Types | |
| enum | Status { Null , Loading , WaitingForDependencies , ResolvingDependencies , Complete , Error } |
| This enum describes the status of the data blob. More... | |
| enum | Type { QmlFile = QQmlAbstractUrlInterceptor::QmlFile , JavaScriptFile = QQmlAbstractUrlInterceptor::JavaScriptFile , QmldirFile = QQmlAbstractUrlInterceptor::QmldirFile } |
| This enum describes the type of the data blob. More... | |
| using | Ptr = QQmlRefPointer<QQmlDataBlob> |
Public Member Functions | |
| QQmlDataBlob (const QUrl &, Type, QQmlTypeLoader *manager) | |
| Create a new QQmlDataBlob for url and of the provided type. | |
| virtual | ~QQmlDataBlob () |
| void | startLoading () |
| Must be called before loading can occur. | |
| QQmlTypeLoader * | typeLoader () const |
| void | resetTypeLoader () |
| Type | type () const |
| Returns the type provided to the constructor. | |
| Status | status () const |
| Returns the blob's status. | |
| bool | isNull () const |
| Returns true if the status is Null. | |
| bool | isLoading () const |
| Returns true if the status is Loading. | |
| bool | isWaiting () const |
| Returns true if the status is WaitingForDependencies. | |
| bool | isComplete () const |
| Returns true if the status is Complete. | |
| bool | isError () const |
| Returns true if the status is Error. | |
| bool | isCompleteOrError () const |
| Returns true if the status is Complete or Error. | |
| bool | isAsync () const |
| qreal | progress () const |
| Returns the data download progress from 0 to 1. | |
| QUrl | url () const |
| Returns the physical url of the data. | |
| QString | urlString () const |
| QUrl | finalUrl () const |
| Returns the logical URL to be used for resolving further URLs referred to in the code. | |
| QString | finalUrlString () const |
| Returns the finalUrl() as a string. | |
| QList< QQmlError > | errors () const |
| Return the errors on this blob. | |
| template<typename Loader = QQmlTypeLoader> | |
| void | assertTypeLoaderThreadIfRunning () const |
| template<typename Loader = QQmlTypeLoader> | |
| void | assertTypeLoaderThread () const |
| template<typename Loader = QQmlTypeLoader> | |
| void | assertEngineThreadIfRunning () const |
| template<typename Loader = QQmlTypeLoader> | |
| void | assertEngineThread () const |
| Public Member Functions inherited from QQmlRefCounted< QQmlDataBlob > | |
| void | release () const |
| Public Member Functions inherited from QQmlRefCount | |
| QQmlRefCount () | |
| void | addref () const |
| int | count () const |
Protected Member Functions | |
| void | setError (const QQmlError &) |
| Mark this blob as having errors. | |
| void | setError (const QList< QQmlError > &errors) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| void | setError (const QQmlJS::DiagnosticMessage &error) |
| void | setError (const QString &description) |
| void | addDependency (const QQmlDataBlob::Ptr &) |
| Wait for blob to become complete or to error. | |
| virtual void | dataReceived (const SourceCodeData &)=0 |
| Invoked when data for the blob is received. | |
| virtual void | initializeFromCachedUnit (const QQmlPrivate::CachedQmlUnit *)=0 |
| virtual void | done () |
| Invoked once data has either been received or a network error occurred, and all dependencies are complete. | |
| virtual void | dependencyError (const QQmlDataBlob::Ptr &) |
| Called if blob, which was previously waited for, has an error. | |
| virtual void | dependencyComplete (const QQmlDataBlob::Ptr &) |
| Called if blob, which was previously waited for, has completed. | |
| virtual void | allDependenciesDone () |
| Called when all blobs waited for have completed. | |
| virtual void | downloadProgressChanged (qreal) |
| Called when the download progress of this blob changes. | |
| virtual void | completed () |
| Invoked on the main thread sometime after done() was called on the load thread. | |
| Protected Member Functions inherited from QQmlRefCounted< QQmlDataBlob > | |
| ~QQmlRefCounted () | |
Protected Attributes | |
| QQmlTypeLoader * | m_typeLoader |
| QList< QQmlDataBlob * > | m_waitingOnMe |
Friends | |
| class | QQmlTypeLoader |
| class | QQmlTypeLoaderThread |
The QQmlDataBlob encapsulates a data request that can be issued to a QQmlTypeLoader.
QQmlDataBlob's are loaded by a QQmlTypeLoader. The user creates the QQmlDataBlob and then calls QQmlTypeLoader::load() or QQmlTypeLoader::loadWithStaticData() to load it. The QQmlTypeLoader invokes callbacks on the QQmlDataBlob as data becomes available.
Definition at line 38 of file qqmldatablob_p.h.
| using QQmlDataBlob::Ptr = QQmlRefPointer<QQmlDataBlob> |
Definition at line 41 of file qqmldatablob_p.h.
| enum QQmlDataBlob::Status |
This enum describes the status of the data blob.
\value Null The blob has not yet been loaded by a QQmlTypeLoader \value Loading The blob is loading network data. The QQmlDataBlob::setData() callback has not yet been invoked or has not yet returned. \value WaitingForDependencies The blob is waiting for dependencies to be done before continuing. This status only occurs after the QQmlDataBlob::setData() callback has been made, and when the blob has outstanding dependencies. \value Complete The blob's data has been loaded and all dependencies are done. \value Error An error has been set on this blob.
| Enumerator | |
|---|---|
| Null | |
| Loading | |
| WaitingForDependencies | |
| ResolvingDependencies | |
| Complete | |
| Error | |
Definition at line 43 of file qqmldatablob_p.h.
| enum QQmlDataBlob::Type |
This enum describes the type of the data blob.
\value QmlFile This is a QQmlTypeData \value JavaScriptFile This is a QQmlScriptData \value QmldirFile This is a QQmlQmldirData
| Enumerator | |
|---|---|
| QmlFile | |
| JavaScriptFile | |
| QmldirFile | |
Definition at line 52 of file qqmldatablob_p.h.
| QQmlDataBlob::QQmlDataBlob | ( | const QUrl & | url, |
| Type | type, | ||
| QQmlTypeLoader * | manager ) |
Create a new QQmlDataBlob for url and of the provided type.
Definition at line 59 of file qqmldatablob.cpp.
|
virtual |
Definition at line 71 of file qqmldatablob.cpp.
|
protected |
Wait for blob to become complete or to error.
If blob is already complete or in error, or this blob is already complete, this has no effect.
The setError() method may only be called from within a QQmlDataBlob callback.
Definition at line 327 of file qqmldatablob.cpp.
|
protectedvirtual |
Called when all blobs waited for have completed.
This occurs regardless of whether they are in error, or complete state.
The default implementation does nothing.
Reimplemented in QQmlTypeData.
Definition at line 470 of file qqmldatablob.cpp.
|
inline |
Definition at line 129 of file qqmldatablob_p.h.
|
inline |
Definition at line 122 of file qqmldatablob_p.h.
|
inline |
Definition at line 115 of file qqmldatablob_p.h.
|
inline |
Definition at line 108 of file qqmldatablob_p.h.
|
protectedvirtual |
Invoked on the main thread sometime after done() was called on the load thread.
You cannot modify the blobs state at all in this callback and cannot depend on the order or timeliness of these callbacks. Implementors should use this callback to notify dependencies on the main thread that the blob is done and not a lot else.
This callback is only invoked if an asynchronous load for this blob is made. An asynchronous load is one in which the Asynchronous mode is specified explicitly, or one that is implicitly delayed due to a network operation.
The default implementation does nothing.
Reimplemented in LoadHelper, and QQmlNotifyingBlob.
Definition at line 507 of file qqmldatablob.cpp.
|
protectedpure virtual |
Invoked when data for the blob is received.
Implementors should use this callback to determine a blob's dependencies. Within this callback you may call setError() or addDependency().
Implemented in LoadHelper, QQmlQmldirData, QQmlScriptBlob, and QQmlTypeData.
|
protectedvirtual |
Called if blob, which was previously waited for, has completed.
The default implementation does nothing.
Reimplemented in QQmlTypeLoader::Blob.
Definition at line 458 of file qqmldatablob.cpp.
|
protectedvirtual |
Called if blob, which was previously waited for, has an error.
The default implementation does nothing.
Definition at line 447 of file qqmldatablob.cpp.
|
protectedvirtual |
Invoked once data has either been received or a network error occurred, and all dependencies are complete.
You can set an error in this method, but you cannot add new dependencies. Implementors should use this callback to finalize processing of data.
The default implementation does nothing.
XXX Rename processData() or some such to avoid confusion between done() (processing thread) and completed() (main thread)
Reimplemented in LoadHelper, QQmlScriptBlob, and QQmlTypeData.
Definition at line 380 of file qqmldatablob.cpp.
Called when the download progress of this blob changes.
progress goes from 0 to 1.
This callback is only invoked if an asynchronous load for this blob is made. An asynchronous load is one in which the Asynchronous mode is specified explicitly, or one that is implicitly delayed due to a network operation.
The default implementation does nothing.
Reimplemented in QQmlNotifyingBlob.
Definition at line 487 of file qqmldatablob.cpp.
Return the errors on this blob.
May only be called from the load thread, or after the blob isCompleteOrError().
Definition at line 240 of file qqmldatablob.cpp.
| QUrl QQmlDataBlob::finalUrl | ( | ) | const |
Returns the logical URL to be used for resolving further URLs referred to in the code.
This is the blob url passed to the constructor. If a URL interceptor rewrites the URL, this one stays the same. If a network redirect happens while fetching the data, this url is updated to reflect the new location. Therefore, if both an interception and a redirection happen, the final url will indirectly incorporate the result of the interception, potentially breaking further lookups.
Definition at line 217 of file qqmldatablob.cpp.
| QString QQmlDataBlob::finalUrlString | ( | ) | const |
Returns the finalUrl() as a string.
Definition at line 225 of file qqmldatablob.cpp.
|
protectedpure virtual |
Implemented in LoadHelper, QQmlQmldirData, QQmlScriptBlob, and QQmlTypeData.
| bool QQmlDataBlob::isAsync | ( | ) | const |
Definition at line 170 of file qqmldatablob.cpp.
| bool QQmlDataBlob::isComplete | ( | ) | const |
Returns true if the status is Complete.
Definition at line 148 of file qqmldatablob.cpp.
| bool QQmlDataBlob::isCompleteOrError | ( | ) | const |
Returns true if the status is Complete or Error.
Definition at line 164 of file qqmldatablob.cpp.
| bool QQmlDataBlob::isError | ( | ) | const |
Returns true if the status is Error.
Definition at line 156 of file qqmldatablob.cpp.
| bool QQmlDataBlob::isLoading | ( | ) | const |
Returns true if the status is Loading.
Definition at line 131 of file qqmldatablob.cpp.
| bool QQmlDataBlob::isNull | ( | ) | const |
Returns true if the status is Null.
Definition at line 123 of file qqmldatablob.cpp.
| bool QQmlDataBlob::isWaiting | ( | ) | const |
Returns true if the status is WaitingForDependencies.
Definition at line 139 of file qqmldatablob.cpp.
| qreal QQmlDataBlob::progress | ( | ) | const |
Returns the data download progress from 0 to 1.
Definition at line 178 of file qqmldatablob.cpp.
|
inline |
Definition at line 64 of file qqmldatablob_p.h.
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 269 of file qqmldatablob.cpp.
Mark this blob as having errors.
All outstanding dependencies will be cancelled. Requests to add new dependencies will be ignored. Entry into the Error state is irreversable.
The setError() method may only be called from within a QQmlDataBlob callback.
Definition at line 257 of file qqmldatablob.cpp.
|
protected |
Definition at line 301 of file qqmldatablob.cpp.
Definition at line 312 of file qqmldatablob.cpp.
| void QQmlDataBlob::startLoading | ( | ) |
Must be called before loading can occur.
Definition at line 96 of file qqmldatablob.cpp.
| QQmlDataBlob::Status QQmlDataBlob::status | ( | ) | const |
Returns the blob's status.
Definition at line 115 of file qqmldatablob.cpp.
| QQmlDataBlob::Type QQmlDataBlob::type | ( | ) | const |
Returns the type provided to the constructor.
Definition at line 107 of file qqmldatablob.cpp.
|
inline |
Definition at line 63 of file qqmldatablob_p.h.
| QUrl QQmlDataBlob::url | ( | ) | const |
Returns the physical url of the data.
Initially this is the same as finalUrl(), but if a URL interceptor is set, it will work on this URL and leave finalUrl() alone.
Definition at line 190 of file qqmldatablob.cpp.
| QString QQmlDataBlob::urlString | ( | ) | const |
Definition at line 195 of file qqmldatablob.cpp.
|
friend |
Definition at line 163 of file qqmldatablob_p.h.
|
friend |
Definition at line 164 of file qqmldatablob_p.h.
|
protected |
Definition at line 160 of file qqmldatablob_p.h.
|
protected |
Definition at line 274 of file qqmldatablob_p.h.