![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
The QQmlTypeLoader class abstracts loading files and their dependencies over the network. More...
#include <qqmltypeloader_p.h>
Classes | |
| class | Blob |
Public Types | |
| enum | Mode { PreferSynchronous , Asynchronous , Synchronous } |
| using | ChecksumCache = QQmlTypeLoaderThreadData::ChecksumCache |
Static Public Member Functions | |
| template<typename Engine, typename EnginePrivate = QQmlEnginePrivate, typename = std::enable_if_t<std::is_base_of_v<QJSEngine, Engine>>> | |
| static QQmlTypeLoader * | get (Engine *engine) |
| template<typename Engine, typename = std::enable_if_t<std::is_base_of_v<QJSEnginePrivate, Engine>>> | |
| static QQmlTypeLoader * | get (Engine *engine) |
| static void | sanitizeUNCPath (QString *path) |
Friends | |
| struct | PlainLoader |
| struct | CachedLoader |
| struct | StaticLoader |
| class | QQmlDataBlob |
| class | QQmlTypeLoaderThread |
The QQmlTypeLoader class abstracts loading files and their dependencies over the network.
The QQmlTypeLoader class is provided for the exclusive use of the QQmlTypeLoader class.
Clients create QQmlDataBlob instances and submit them to the QQmlTypeLoader class through the QQmlTypeLoader::load() or QQmlTypeLoader::loadWithStaticData() methods. The loader then fetches the data over the network or from the local file system in an efficient way. QQmlDataBlob is an abstract class, so should always be specialized.
Once data is received, the QQmlDataBlob::dataReceived() method is invoked on the blob. The derived class should use this callback to process the received data. Processing of the data can result in an error being set (QQmlDataBlob::setError()), or one or more dependencies being created (QQmlDataBlob::addDependency()). Dependencies are other QQmlDataBlob's that are required before processing can fully complete.
To complete processing, the QQmlDataBlob::done() callback is invoked. done() is called when one of these three preconditions are met.
\list 1
Thus QQmlDataBlob::done() will always eventually be called, even if the blob has an error set.
Definition at line 44 of file qqmltypeloader_p.h.
Definition at line 48 of file qqmltypeloader_p.h.
| enum QQmlTypeLoader::Mode |
| Enumerator | |
|---|---|
| PreferSynchronous | |
| Asynchronous | |
| Synchronous | |
Definition at line 49 of file qqmltypeloader_p.h.
| QQmlTypeLoader::QQmlTypeLoader | ( | QV4::ExecutionEngine * | engine | ) |
Constructs a new type loader that uses the given engine.
Definition at line 1229 of file qqmltypeloader.cpp.
| QQmlTypeLoader::~QQmlTypeLoader | ( | ) |
Destroys the type loader, first clearing the cache of any information about loaded files.
Definition at line 1308 of file qqmltypeloader.cpp.
Returns the absolute filename of path via a directory cache.
Returns a empty string if the path does not exist.
Why a directory cache? QML checks for files in many paths with invalid directories. By caching whether a directory exists we avoid many stats. We also cache the files' existence in the directory, for the same reason.
Definition at line 1518 of file qqmltypeloader.cpp.
Definition at line 536 of file qqmltypeloader.cpp.
Definition at line 601 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::addUrlInterceptor | ( | QQmlAbstractUrlInterceptor * | urlInterceptor | ) |
Definition at line 94 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::clearCache | ( | ) |
Clears cached information about loaded files, including any type data, scripts and qmldir information.
Definition at line 1821 of file qqmltypeloader.cpp.
Referenced by QQmlPreviewServiceImpl::messageReceived().
| bool QQmlTypeLoader::directoryExists | ( | const QString & | path | ) |
Returns true if the path is a directory via a directory cache.
Cache is shared with absoluteFilePath().
Definition at line 1691 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::drop | ( | const QQmlDataBlob::Ptr & | blob | ) |
Definition at line 271 of file qqmltypeloader.cpp.
Definition at line 1590 of file qqmltypeloader.cpp.
|
inline |
Definition at line 198 of file qqmltypeloader_p.h.
|
inlinestatic |
Definition at line 148 of file qqmltypeloader_p.h.
|
inlinestatic |
Definition at line 140 of file qqmltypeloader_p.h.
| QQmlRefPointer< QQmlQmldirData > QQmlTypeLoader::getQmldir | ( | const QUrl & | url | ) |
Returns a QQmlQmldirData for url.
The QQmlQmldirData may be cached.
Definition at line 1486 of file qqmltypeloader.cpp.
| QQmlRefPointer< QQmlScriptBlob > QQmlTypeLoader::getScript | ( | const QUrl & | unNormalizedUrl, |
| const QUrl & | relativeUrl ) |
Return a QQmlScriptBlob for unNormalizedUrl or relativeUrl.
This assumes PreferSynchronous, and therefore the result may not be ready yet.
Definition at line 1449 of file qqmltypeloader.cpp.
| QQmlRefPointer< QQmlScriptBlob > QQmlTypeLoader::getScript | ( | const QUrl & | unNormalizedUrl, |
| Mode | mode = PreferSynchronous ) |
Definition at line 1400 of file qqmltypeloader.cpp.
| QQmlRefPointer< QQmlTypeData > QQmlTypeLoader::getType | ( | const QByteArray & | data, |
| const QUrl & | url, | ||
| Mode | mode = PreferSynchronous ) |
Returns a QQmlTypeData for the given data with the provided base url.
The QQmlTypeData will not be cached.
Definition at line 1385 of file qqmltypeloader.cpp.
| QQmlRefPointer< QQmlTypeData > QQmlTypeLoader::getType | ( | const QUrl & | unNormalizedUrl, |
| Mode | mode = PreferSynchronous ) |
Returns a QQmlTypeData for the specified url.
The QQmlTypeData may be cached.
Definition at line 1351 of file qqmltypeloader.cpp.
|
inline |
Definition at line 168 of file qqmltypeloader_p.h.
| bool QQmlTypeLoader::hasUrlInterceptors | ( | ) | const |
Definition at line 133 of file qqmltypeloader.cpp.
|
inline |
Definition at line 246 of file qqmltypeloader_p.h.
| void QQmlTypeLoader::initializeEngine | ( | QQmlEngineExtensionInterface * | iface, |
| const char * | uri ) |
Definition at line 424 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::initializeEngine | ( | QQmlExtensionInterface * | iface, |
| const char * | uri ) |
Definition at line 430 of file qqmltypeloader.cpp.
| QQmlRefPointer< QV4::CompiledData::CompilationUnit > QQmlTypeLoader::injectModule | ( | const QUrl & | relativeUrl, |
| const QV4::CompiledData::Unit * | unit ) |
Definition at line 1426 of file qqmltypeloader.cpp.
| QUrl QQmlTypeLoader::interceptUrl | ( | const QUrl & | url, |
| QQmlAbstractUrlInterceptor::DataType | type ) const |
Definition at line 125 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::invalidate | ( | ) |
Definition at line 79 of file qqmltypeloader.cpp.
| bool QQmlTypeLoader::isDebugging | ( | ) |
Definition at line 1168 of file qqmltypeloader.cpp.
|
inline |
Definition at line 278 of file qqmltypeloader_p.h.
|
inline |
Definition at line 267 of file qqmltypeloader_p.h.
| bool QQmlTypeLoader::isScriptLoaded | ( | const QUrl & | url | ) | const |
Definition at line 1925 of file qqmltypeloader.cpp.
| bool QQmlTypeLoader::isTypeLoaded | ( | const QUrl & | url | ) | const |
Definition at line 1919 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::loadWithStaticData | ( | const QQmlDataBlob::Ptr & | blob, |
| const QByteArray & | data, | ||
| Mode | mode = PreferSynchronous ) |
Load the provided blob with data.
The blob's URL is not used by the data loader in this case.
The loader must be locked.
Definition at line 257 of file qqmltypeloader.cpp.
|
inline |
Definition at line 254 of file qqmltypeloader_p.h.
|
inline |
Definition at line 235 of file qqmltypeloader_p.h.
| const QQmlTypeLoaderQmldirContent QQmlTypeLoader::qmldirContent | ( | const QString & | filePathIn | ) |
Return a QQmlTypeLoaderQmldirContent for absoluteFilePath.
The QQmlTypeLoaderQmldirContent may be cached.
filePath is a local file path.
It can also be a remote path for a remote directory import, but it will have been cached by now in this case.
Definition at line 1735 of file qqmltypeloader.cpp.
| bool QQmlTypeLoader::readCacheFile | ( | ) |
Definition at line 1173 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::removeUrlInterceptor | ( | QQmlAbstractUrlInterceptor * | urlInterceptor | ) |
Definition at line 101 of file qqmltypeloader.cpp.
Definition at line 153 of file qqmltypeloader_p.h.
| void QQmlTypeLoader::setImportPathList | ( | const QStringList & | paths | ) |
Definition at line 574 of file qqmltypeloader.cpp.
Definition at line 273 of file qqmltypeloader_p.h.
Definition at line 262 of file qqmltypeloader_p.h.
| void QQmlTypeLoader::setPluginPathList | ( | const QStringList & | paths | ) |
Definition at line 591 of file qqmltypeloader.cpp.
Definition at line 236 of file qqmltypeloader_p.h.
Definition at line 1790 of file qqmltypeloader.cpp.
| void QQmlTypeLoader::trimCache | ( | ) |
Definition at line 1847 of file qqmltypeloader.cpp.
| QList< QQmlAbstractUrlInterceptor * > QQmlTypeLoader::urlInterceptors | ( | ) | const |
Definition at line 108 of file qqmltypeloader.cpp.
| bool QQmlTypeLoader::writeCacheFile | ( | ) |
Definition at line 1178 of file qqmltypeloader.cpp.
|
friend |
Definition at line 296 of file qqmltypeloader_p.h.
|
friend |
Definition at line 295 of file qqmltypeloader_p.h.
|
friend |
Definition at line 299 of file qqmltypeloader_p.h.
|
friend |
Definition at line 300 of file qqmltypeloader_p.h.
|
friend |
Definition at line 297 of file qqmltypeloader_p.h.