![]() |
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 43 of file qqmltypeloader_p.h.
Definition at line 47 of file qqmltypeloader_p.h.
enum QQmlTypeLoader::Mode |
Enumerator | |
---|---|
PreferSynchronous | |
Asynchronous | |
Synchronous |
Definition at line 48 of file qqmltypeloader_p.h.
QQmlTypeLoader::QQmlTypeLoader | ( | QV4::ExecutionEngine * | engine | ) |
Constructs a new type loader that uses the given engine.
Definition at line 1217 of file qqmltypeloader.cpp.
QQmlTypeLoader::~QQmlTypeLoader | ( | ) |
Destroys the type loader, first clearing the cache of any information about loaded files.
Definition at line 1296 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 1506 of file qqmltypeloader.cpp.
Definition at line 535 of file qqmltypeloader.cpp.
Definition at line 600 of file qqmltypeloader.cpp.
void QQmlTypeLoader::addUrlInterceptor | ( | QQmlAbstractUrlInterceptor * | urlInterceptor | ) |
Definition at line 93 of file qqmltypeloader.cpp.
void QQmlTypeLoader::clearCache | ( | ) |
Clears cached information about loaded files, including any type data, scripts and qmldir information.
Definition at line 1809 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 1679 of file qqmltypeloader.cpp.
void QQmlTypeLoader::drop | ( | const QQmlDataBlob::Ptr & | blob | ) |
Definition at line 270 of file qqmltypeloader.cpp.
Definition at line 1578 of file qqmltypeloader.cpp.
|
inline |
Definition at line 197 of file qqmltypeloader_p.h.
|
inlinestatic |
Definition at line 139 of file qqmltypeloader_p.h.
|
inlinestatic |
Definition at line 147 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 1474 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 1437 of file qqmltypeloader.cpp.
QQmlRefPointer< QQmlScriptBlob > QQmlTypeLoader::getScript | ( | const QUrl & | unNormalizedUrl, |
Mode | mode = PreferSynchronous ) |
Definition at line 1388 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 1373 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 1339 of file qqmltypeloader.cpp.
|
inline |
Definition at line 167 of file qqmltypeloader_p.h.
bool QQmlTypeLoader::hasUrlInterceptors | ( | ) | const |
Definition at line 132 of file qqmltypeloader.cpp.
|
inline |
Definition at line 245 of file qqmltypeloader_p.h.
void QQmlTypeLoader::initializeEngine | ( | QQmlEngineExtensionInterface * | iface, |
const char * | uri ) |
Definition at line 423 of file qqmltypeloader.cpp.
void QQmlTypeLoader::initializeEngine | ( | QQmlExtensionInterface * | iface, |
const char * | uri ) |
Definition at line 429 of file qqmltypeloader.cpp.
QQmlRefPointer< QV4::CompiledData::CompilationUnit > QQmlTypeLoader::injectModule | ( | const QUrl & | relativeUrl, |
const QV4::CompiledData::Unit * | unit ) |
Definition at line 1414 of file qqmltypeloader.cpp.
QUrl QQmlTypeLoader::interceptUrl | ( | const QUrl & | url, |
QQmlAbstractUrlInterceptor::DataType | type ) const |
Definition at line 124 of file qqmltypeloader.cpp.
void QQmlTypeLoader::invalidate | ( | ) |
Definition at line 78 of file qqmltypeloader.cpp.
bool QQmlTypeLoader::isDebugging | ( | ) |
Definition at line 1156 of file qqmltypeloader.cpp.
|
inline |
Definition at line 277 of file qqmltypeloader_p.h.
|
inline |
Definition at line 266 of file qqmltypeloader_p.h.
bool QQmlTypeLoader::isScriptLoaded | ( | const QUrl & | url | ) | const |
Definition at line 1913 of file qqmltypeloader.cpp.
bool QQmlTypeLoader::isTypeLoaded | ( | const QUrl & | url | ) | const |
Definition at line 1907 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 256 of file qqmltypeloader.cpp.
|
inline |
Definition at line 253 of file qqmltypeloader_p.h.
|
inline |
Definition at line 234 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 1723 of file qqmltypeloader.cpp.
bool QQmlTypeLoader::readCacheFile | ( | ) |
Definition at line 1161 of file qqmltypeloader.cpp.
void QQmlTypeLoader::removeUrlInterceptor | ( | QQmlAbstractUrlInterceptor * | urlInterceptor | ) |
Definition at line 100 of file qqmltypeloader.cpp.
Definition at line 152 of file qqmltypeloader_p.h.
void QQmlTypeLoader::setImportPathList | ( | const QStringList & | paths | ) |
Definition at line 573 of file qqmltypeloader.cpp.
Definition at line 272 of file qqmltypeloader_p.h.
Definition at line 261 of file qqmltypeloader_p.h.
void QQmlTypeLoader::setPluginPathList | ( | const QStringList & | paths | ) |
Definition at line 590 of file qqmltypeloader.cpp.
Definition at line 235 of file qqmltypeloader_p.h.
Definition at line 1778 of file qqmltypeloader.cpp.
void QQmlTypeLoader::trimCache | ( | ) |
Definition at line 1835 of file qqmltypeloader.cpp.
QList< QQmlAbstractUrlInterceptor * > QQmlTypeLoader::urlInterceptors | ( | ) | const |
Definition at line 107 of file qqmltypeloader.cpp.
bool QQmlTypeLoader::writeCacheFile | ( | ) |
Definition at line 1166 of file qqmltypeloader.cpp.
|
friend |
Definition at line 295 of file qqmltypeloader_p.h.
|
friend |
Definition at line 294 of file qqmltypeloader_p.h.
|
friend |
Definition at line 298 of file qqmltypeloader_p.h.
|
friend |
Definition at line 299 of file qqmltypeloader_p.h.
|
friend |
Definition at line 296 of file qqmltypeloader_p.h.