Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQmlScriptBlob Class Reference

#include <qqmlscriptblob_p.h>

+ Inheritance diagram for QQmlScriptBlob:
+ Collaboration diagram for QQmlScriptBlob:

Classes

struct  ScriptReference
 

Public Member Functions

 ~QQmlScriptBlob () override
 
QQmlRefPointer< QQmlScriptDatascriptData () const
 
bool isNative () const
 
- 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)
 
- 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
 
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.
 
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.
 
- 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 dataReceived (const SourceCodeData &) override
 Invoked when data for the blob is received.
 
void initializeFromCachedUnit (const QQmlPrivate::CachedQmlUnit *unit) override
 
void done () override
 Invoked once data has either been received or a network error occurred, and all dependencies are complete.
 
QString stringAt (int index) const override
 
- Protected Member Functions inherited from QQmlTypeLoader::Blob
bool addImport (const QV4::CompiledData::Import *import, QQmlImports::ImportFlags, QList< QQmlError > *errors)
 
bool addImport (PendingImportPtr import, QList< QQmlError > *errors)
 
bool fetchQmldir (const QUrl &url, PendingImportPtr import, int priority, QList< QQmlError > *errors)
 
bool updateQmldir (const QQmlRefPointer< QQmlQmldirData > &data, const PendingImportPtr &import, QList< QQmlError > *errors)
 
bool loadDependentImports (const QList< QQmlDirParser::Import > &imports, const QString &qualifier, QTypeRevision version, quint16 precedence, QQmlImports::ImportFlags flags, QList< QQmlError > *errors)
 
bool isDebugging () const
 
bool readCacheFile () const
 
bool writeCacheFile () const
 
QQmlMetaType::CacheMode aotCacheMode () 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 (QQmlDataBlob *)
 Wait for blob to become complete or to error.
 
virtual void dependencyError (QQmlDataBlob *)
 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.
 
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 ()
 

Private Member Functions

void scriptImported (const QQmlRefPointer< QQmlScriptBlob > &blob, const QV4::CompiledData::Location &location, const QString &qualifier, const QString &nameSpace) override
 

Friends

class QQmlTypeLoader
 

Additional Inherited Members

- 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>
 
- 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 23 of file qqmlscriptblob_p.h.

Constructor & Destructor Documentation

◆ ~QQmlScriptBlob()

QQmlScriptBlob::~QQmlScriptBlob ( )
override

Definition at line 26 of file qqmlscriptblob.cpp.

Member Function Documentation

◆ dataReceived()

void QQmlScriptBlob::dataReceived ( const SourceCodeData & )
overrideprotectedvirtual

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 40 of file qqmlscriptblob.cpp.

References QV4::Compiler::Codegen::compileModule(), error, QQmlDataBlob::errors(), QQmlDataBlob::finalUrlString(), QmlIR::QmlUnitGenerator::generate(), QQmlTypeLoader::Blob::isDebugging(), QList< T >::isEmpty(), QQmlTypeLoader::Blob::m_cachedUnitStatus, QV4::Script::precompile(), qCDebug, QQmlEnginePrivate::qmlErrorFromDiagnostics(), QQmlTypeLoader::Blob::readCacheFile(), QV4::Compiler::ScriptImportedByQML, QQmlDataBlob::setError(), QQmlDataBlob::url(), QQmlDataBlob::urlString(), QQmlMetaType::VersionMismatch, and QQmlTypeLoader::Blob::writeCacheFile().

+ Here is the call graph for this function:

◆ done()

void QQmlScriptBlob::done ( )
overrideprotectedvirtual

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 125 of file qqmlscriptblob.cpp.

References QQmlTypeNameCache::add(), QQmlRefPointer< T >::adopt(), arg, QV4::CompiledData::Location::column(), QQmlRefPointer< T >::data(), error, QQmlDataBlob::errors(), QQmlDataBlob::isCompleteOrError(), QQmlDataBlob::isError(), QString::isNull(), QV4::CompiledData::Location::line(), QQmlScriptBlob::ScriptReference::location, QQmlTypeLoader::Blob::m_importCache, QQmlScriptBlob::ScriptReference::nameSpace, QQmlImports::populateCache(), QList< T >::prepend(), Q_ASSERT, QQmlScriptBlob::ScriptReference::qualifier, QQmlScriptBlob::ScriptReference::script, QQmlScriptData::scripts, QQmlDataBlob::setError(), QQmlScriptData::typeNameCache, QQmlDataBlob::url(), and QQmlDataBlob::urlString().

+ Here is the call graph for this function:

◆ initializeFromCachedUnit()

void QQmlScriptBlob::initializeFromCachedUnit ( const QQmlPrivate::CachedQmlUnit * unit)
overrideprotectedvirtual

Implements QQmlDataBlob.

Definition at line 119 of file qqmlscriptblob.cpp.

References QQmlDataBlob::finalUrlString(), and QQmlDataBlob::urlString().

+ Here is the call graph for this function:

◆ isNative()

bool QQmlScriptBlob::isNative ( ) const

Definition at line 35 of file qqmlscriptblob.cpp.

References QV4::PersistentValue::isEmpty().

+ Here is the call graph for this function:

◆ scriptData()

QQmlRefPointer< QQmlScriptData > QQmlScriptBlob::scriptData ( ) const

Definition at line 30 of file qqmlscriptblob.cpp.

Referenced by QQmlTypeData::done().

+ Here is the caller graph for this function:

◆ scriptImported()

void QQmlScriptBlob::scriptImported ( const QQmlRefPointer< QQmlScriptBlob > & blob,
const QV4::CompiledData::Location & location,
const QString & qualifier,
const QString & nameSpace )
overrideprivatevirtual

Reimplemented from QQmlTypeLoader::Blob.

Definition at line 176 of file qqmlscriptblob.cpp.

References QQmlScriptBlob::ScriptReference::script.

◆ stringAt()

QString QQmlScriptBlob::stringAt ( int index) const
overrideprotectedvirtual

Reimplemented from QQmlTypeLoader::Blob.

Definition at line 171 of file qqmlscriptblob.cpp.

References QV4::CompiledData::CompilationUnit::stringAt().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ QQmlTypeLoader

friend class QQmlTypeLoader
friend

Definition at line 26 of file qqmlscriptblob_p.h.


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