Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
LoadHelper Struct Referencefinal

#include <qqmlengine_p.h>

Inheritance diagram for LoadHelper:
Collaboration diagram for LoadHelper:

Public Types

enum class  ResolveTypeResult { NoSuchModule , ModuleFound }
Public Types inherited from QQmlTypeLoader::Blob
using PendingImportPtr = std::shared_ptr<PendingImport>
Public Types inherited from QQmlDataBlob
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

 LoadHelper (QQmlTypeLoader *loader, QAnyStringView uri, QAnyStringView typeName, QQmlTypeLoader::Mode mode)
QQmlType type () const
QQmlTypeLoader::Mode mode () const
ResolveTypeResult resolveTypeResult () const
void registerCallback (QQmlComponentPrivate *callback)
void unregisterCallback (QQmlComponentPrivate *callback)
Public Member Functions inherited from QQmlTypeLoader::Blob
 Blob (const QUrl &url, QQmlDataBlob::Type type, QQmlTypeLoader *loader)
 ~Blob () override
const QQmlImportsimports () const
void setCachedUnitStatus (QQmlMetaType::CachedUnitLookupError status)
void importQmldirScripts (const PendingImportPtr &import, const QQmlTypeLoaderQmldirContent &qmldir, const QUrl &qmldirUrl)
bool handleLocalQmldirForImport (const PendingImportPtr &import, const QString &qmldirFilePath, const QString &qmldirUrl, QList< QQmlError > *errors)
Public Member Functions inherited from QQmlDataBlob
 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.
QQmlTypeLoadertypeLoader () 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< QQmlErrorerrors () 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 done () final
 Invoked once data has either been received or a network error occurred, and all dependencies are complete.
void completed () final
 Invoked on the main thread sometime after done() was called on the load thread.
void dataReceived (const SourceCodeData &) final
 Invoked when data for the blob is received.
void initializeFromCachedUnit (const QQmlPrivate::CachedQmlUnit *) final
Protected Member Functions inherited from QQmlTypeLoader::Blob
bool addImport (const QV4::CompiledData::Import *import, QQmlImports::ImportFlags, QList< QQmlError > *errors)
bool addImport (const PendingImportPtr &import, QList< QQmlError > *errors)
bool fetchQmldir (const QUrl &url, const PendingImportPtr &import, int priority, QList< QQmlError > *errors)
bool updateQmldir (const QQmlRefPointer< QQmlQmldirData > &data, const PendingImportPtr &import, QList< QQmlError > *errors)
bool registerPendingTypes (const PendingImportPtr &import)
bool loadDependentImports (const QList< QQmlDirParser::Import > &imports, const QString &qualifier, QTypeRevision version, quint8 precedence, QQmlImports::ImportFlags flags, QList< QQmlError > *errors)
virtual QString stringAt (int) const
Protected Member Functions inherited from QQmlDataBlob
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 dependencyError (const QQmlDataBlob::Ptr &)
 Called if blob, which was previously waited for, has an error.
virtual void allDependenciesDone ()
 Called when all blobs waited for have completed.
virtual void downloadProgressChanged (qreal)
 Called when the download progress of this blob changes.
Protected Member Functions inherited from QQmlRefCounted< QQmlDataBlob >
 ~QQmlRefCounted ()

Additional Inherited Members

Protected Attributes inherited from QQmlTypeLoader::Blob
QQmlRefPointer< QQmlImportsm_importCache
QVector< PendingImportPtrm_unresolvedImports
QVector< QQmlRefPointer< QQmlQmldirData > > m_qmldirs
QQmlMetaType::CachedUnitLookupError m_cachedUnitStatus = QQmlMetaType::CachedUnitLookupError::NoError
Protected Attributes inherited from QQmlDataBlob
QQmlTypeLoaderm_typeLoader
QList< QQmlDataBlob * > m_waitingOnMe

Detailed Description

Definition at line 369 of file qqmlengine_p.h.

Member Enumeration Documentation

◆ ResolveTypeResult

enum class LoadHelper::ResolveTypeResult
strong
Enumerator
NoSuchModule 
ModuleFound 

Definition at line 372 of file qqmlengine_p.h.

Constructor & Destructor Documentation

◆ LoadHelper()

LoadHelper::LoadHelper ( QQmlTypeLoader * loader,
QAnyStringView uri,
QAnyStringView typeName,
QQmlTypeLoader::Mode mode )

Definition at line 2038 of file qqmlengine.cpp.

References LoadHelper().

Referenced by LoadHelper().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ completed()

void LoadHelper::completed ( )
finalprotectedvirtual

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 from QQmlDataBlob.

Definition at line 2088 of file qqmlengine.cpp.

◆ dataReceived()

void LoadHelper::dataReceived ( const SourceCodeData & )
finalprotectedvirtual

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().

Implements QQmlDataBlob.

Definition at line 2098 of file qqmlengine.cpp.

◆ done()

void LoadHelper::done ( )
finalprotectedvirtual

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 from QQmlDataBlob.

Definition at line 2062 of file qqmlengine.cpp.

References ModuleFound, and NoSuchModule.

◆ initializeFromCachedUnit()

void LoadHelper::initializeFromCachedUnit ( const QQmlPrivate::CachedQmlUnit * )
inlinefinalprotectedvirtual

Implements QQmlDataBlob.

Definition at line 392 of file qqmlengine_p.h.

◆ mode()

QQmlTypeLoader::Mode LoadHelper::mode ( ) const
inline

Definition at line 382 of file qqmlengine_p.h.

◆ registerCallback()

void LoadHelper::registerCallback ( QQmlComponentPrivate * callback)

Definition at line 2049 of file qqmlengine.cpp.

◆ resolveTypeResult()

ResolveTypeResult LoadHelper::resolveTypeResult ( ) const
inline

Definition at line 383 of file qqmlengine_p.h.

◆ type()

QQmlType LoadHelper::type ( ) const
inline

Definition at line 381 of file qqmlengine_p.h.

◆ unregisterCallback()

void LoadHelper::unregisterCallback ( QQmlComponentPrivate * callback)

Definition at line 2054 of file qqmlengine.cpp.


The documentation for this struct was generated from the following files: