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
QQmlJS::Dom::QmlFile Class Referencefinal

A QmlFile, when loaded in a DomEnvironment that has the DomCreationOption::WithSemanticAnalysis, will be lazily constructed. More...

#include <qqmldomexternalitems_p.h>

Inheritance diagram for QQmlJS::Dom::QmlFile:
Collaboration diagram for QQmlJS::Dom::QmlFile:

Public Types

enum  RecoveryOption { DisableParserRecovery , EnableParserRecovery }
Public Types inherited from QQmlJS::Dom::DomBase
using FilterT = function_ref<bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)>

Public Member Functions

DomType kind () const override
 QmlFile (const QString &filePath=QString(), const QString &code=QString(), const QDateTime &lastDataUpdate=QDateTime::fromMSecsSinceEpoch(0, QTimeZone::UTC), int derivedFrom=0, RecoveryOption option=DisableParserRecovery)
bool iterateDirectSubpaths (const DomItem &self, DirectVisitor) const override
DomItem field (const DomItem &self, QStringView name) const override
std::shared_ptr< QmlFilemakeCopy (const DomItem &self) const
void addError (const DomItem &self, ErrorMessage &&msg) override
const QMultiMap< QString, QmlComponent > & components () const &
void setComponents (const QMultiMap< QString, QmlComponent > &components)
Path addComponent (const QmlComponent &component, AddOption option=AddOption::Overwrite, QmlComponent **cPtr=nullptr)
void writeOut (const DomItem &self, OutWriter &lw) const override
AST::UiProgramast () const
const QList< Import > & imports () const &
void setImports (const QList< Import > &imports)
Path addImport (const Import &i)
std::shared_ptr< QQmlJS::Engineengine () const
RegionCommentscomments ()
std::shared_ptr< AstCommentsastComments () const
void setAstComments (const std::shared_ptr< AstComments > &comm)
FileLocations::Tree fileLocationsTree () const
void setFileLocationsTree (const FileLocations::Tree &v)
const QList< Pragma > & pragmas () const &
void setPragmas (QList< Pragma > pragmas)
Path addPragma (const Pragma &pragma)
ImportScopeimportScope ()
const ImportScopeimportScope () const
std::shared_ptr< QQmlJSTypeResolvertypeResolver () const
void setTypeResolverWithDependencies (const std::shared_ptr< QQmlJSTypeResolver > &typeResolver, const QQmlJSTypeResolverDependencies &dependencies)
DomCreationOption creationOption () const
QQmlJSScope::ConstPtr handleForPopulation () const
void setHandleForPopulation (const QQmlJSScope::ConstPtr &scope)
Public Member Functions inherited from QQmlJS::Dom::ExternalOwningItem
 ExternalOwningItem (const QString &filePath, const QDateTime &lastDataUpdateAt, const Path &pathFromTop, int derivedFrom=0, const QString &code=QString())
 ExternalOwningItem (const ExternalOwningItem &o)=default
QString canonicalFilePath (const DomItem &) const override
QString canonicalFilePath () const
Path canonicalPath (const DomItem &) const override
Path canonicalPath () const
bool iterateSubOwners (const DomItem &self, function_ref< bool(const DomItem &owner)> visitor) override
bool isValid () const
void setIsValid (bool val)
const QStringcode () const
Public Member Functions inherited from QQmlJS::Dom::OwningItem
 OwningItem (const OwningItem &o)
 OwningItem (int derivedFrom=0)
 OwningItem (int derivedFrom, const QDateTime &lastDataUpdateAt)
 OwningItem (const OwningItem &&)=delete
OwningItemoperator= (const OwningItem &&)=delete
std::shared_ptr< OwningItemmakeCopy (const DomItem &self) const
Path pathFromOwner () const override final
DomItem containingObject (const DomItem &self) const override
int derivedFrom () const
virtual int revision () const
QDateTime createdAt () const
virtual QDateTime lastDataUpdateAt () const
virtual void refreshedDataAt (QDateTime tNew)
virtual bool frozen () const
virtual bool freeze ()
QDateTime frozenAt () const
void addErrorLocal (ErrorMessage &&msg)
void clearErrors (const ErrorGroups &groups=ErrorGroups({}))
bool iterateErrors (const DomItem &self, function_ref< bool(const DomItem &source, const ErrorMessage &msg)> visitor, const Path &inPath=Path())
QMultiMap< Path, ErrorMessagelocalErrors () const
QBasicMutexmutex () const
Public Member Functions inherited from QQmlJS::Dom::DomBase
virtual ~DomBase ()=default
DomBasedomBase ()
const DomBasedomBase () const
virtual DomKind domKind () const
virtual void dump (const DomItem &, const Sink &sink, int indent, FilterT filter) const
virtual quintptr id () const
QString typeName () const
virtual QList< QStringfields (const DomItem &self) const
virtual index_type indexes (const DomItem &self) const
virtual DomItem index (const DomItem &self, index_type index) const
virtual QSet< QString > const keys (const DomItem &self) const
virtual DomItem key (const DomItem &self, const QString &name) const
virtual QCborValue value () const

Static Public Member Functions

static ErrorGroups myParsingErrors ()
Static Public Member Functions inherited from QQmlJS::Dom::OwningItem
static int nextRevision ()

Static Public Attributes

static constexpr DomType kindValue = DomType::QmlFile

Protected Member Functions

std::shared_ptr< OwningItemdoCopy (const DomItem &self) const override

Friends

class QQmlDomAstCreatorBase

Additional Inherited Members

Protected Attributes inherited from QQmlJS::Dom::ExternalOwningItem
QString m_canonicalFilePath
QString m_code
Path m_path
bool m_isValid = false

Detailed Description

A QmlFile, when loaded in a DomEnvironment that has the DomCreationOption::WithSemanticAnalysis, will be lazily constructed.

That means that its member m_lazyMembers is uninitialized, and will only be populated when it is accessed (through a getter, a setter or the DomItem interface).

The reason for the laziness is that the qqmljsscopes are created lazily and at the same time as the Dom QmlFile representations. So instead of eagerly generating all qqmljsscopes when constructing the Dom, the QmlFile itself becomes lazy and will only be populated on demand at the same time as the corresponding qqmljsscopes.

The QDeferredFactory<QQmlJSScope> will, when the qqmljsscope is populated, take care of populating all fields of the QmlFile. Therefore, population of the QmlFile is done by populating the qqmljsscope.

Definition at line 323 of file qqmldomexternalitems_p.h.

Member Enumeration Documentation

◆ RecoveryOption

Enumerator
DisableParserRecovery 
EnableParserRecovery 

Definition at line 332 of file qqmldomexternalitems_p.h.

Constructor & Destructor Documentation

◆ QmlFile()

QQmlJS::Dom::QmlFile::QmlFile ( const QString & filePath = QString(),
const QString & code = QString(),
const QDateTime & lastDataUpdate = QDateTime::fromMSecsSinceEpoch(0, QTimeZone::UTC),
int derivedFrom = 0,
RecoveryOption option = DisableParserRecovery )

Definition at line 444 of file qqmldomexternalitems.cpp.

Member Function Documentation

◆ addComponent()

Path QQmlJS::Dom::QmlFile::addComponent ( const QmlComponent & component,
AddOption option = AddOption::Overwrite,
QmlComponent ** cPtr = nullptr )
inline

Definition at line 355 of file qqmldomexternalitems_p.h.

◆ addError()

void QQmlJS::Dom::QmlFile::addError ( const DomItem & self,
ErrorMessage && msg )
overridevirtual

Reimplemented from QQmlJS::Dom::OwningItem.

Definition at line 497 of file qqmldomexternalitems.cpp.

◆ addImport()

Path QQmlJS::Dom::QmlFile::addImport ( const Import & i)
inline

Definition at line 375 of file qqmldomexternalitems_p.h.

◆ addPragma()

Path QQmlJS::Dom::QmlFile::addPragma ( const Pragma & pragma)
inline

Definition at line 403 of file qqmldomexternalitems_p.h.

◆ ast()

AST::UiProgram * QQmlJS::Dom::QmlFile::ast ( ) const
inline

Definition at line 366 of file qqmldomexternalitems_p.h.

◆ astComments()

std::shared_ptr< AstComments > QQmlJS::Dom::QmlFile::astComments ( ) const
inline

Definition at line 397 of file qqmldomexternalitems_p.h.

◆ comments()

RegionComments & QQmlJS::Dom::QmlFile::comments ( )
inline

Definition at line 396 of file qqmldomexternalitems_p.h.

◆ components()

const QMultiMap< QString, QmlComponent > & QQmlJS::Dom::QmlFile::components ( ) const &
inline

Definition at line 347 of file qqmldomexternalitems_p.h.

◆ creationOption()

DomCreationOption QQmlJS::Dom::QmlFile::creationOption ( ) const
inline

Definition at line 425 of file qqmldomexternalitems_p.h.

◆ doCopy()

std::shared_ptr< OwningItem > QQmlJS::Dom::QmlFile::doCopy ( const DomItem & self) const
overrideprotectedvirtual

Implements QQmlJS::Dom::OwningItem.

Definition at line 420 of file qqmldomexternalitems.cpp.

◆ engine()

std::shared_ptr< QQmlJS::Engine > QQmlJS::Dom::QmlFile::engine ( ) const
inline

Definition at line 395 of file qqmldomexternalitems_p.h.

◆ field()

DomItem QQmlJS::Dom::QmlFile::field ( const DomItem & self,
QStringView name ) const
overridevirtual

Reimplemented from QQmlJS::Dom::DomBase.

Definition at line 489 of file qqmldomexternalitems.cpp.

◆ fileLocationsTree()

FileLocations::Tree QQmlJS::Dom::QmlFile::fileLocationsTree ( ) const
inline

Definition at line 399 of file qqmldomexternalitems_p.h.

◆ handleForPopulation()

QQmlJSScope::ConstPtr QQmlJS::Dom::QmlFile::handleForPopulation ( ) const
inline

Definition at line 427 of file qqmldomexternalitems_p.h.

◆ imports()

const QList< Import > & QQmlJS::Dom::QmlFile::imports ( ) const &
inline

Definition at line 370 of file qqmldomexternalitems_p.h.

◆ importScope() [1/2]

ImportScope & QQmlJS::Dom::QmlFile::importScope ( )
inline

Definition at line 410 of file qqmldomexternalitems_p.h.

◆ importScope() [2/2]

const ImportScope & QQmlJS::Dom::QmlFile::importScope ( ) const
inline

Definition at line 411 of file qqmldomexternalitems_p.h.

◆ iterateDirectSubpaths()

bool QQmlJS::Dom::QmlFile::iterateDirectSubpaths ( const DomItem & self,
DirectVisitor visitor ) const
overridevirtual

Reimplemented from QQmlJS::Dom::ExternalOwningItem.

Definition at line 474 of file qqmldomexternalitems.cpp.

◆ kind()

DomType QQmlJS::Dom::QmlFile::kind ( ) const
inlineoverridevirtual

Implements QQmlJS::Dom::DomBase.

Definition at line 330 of file qqmldomexternalitems_p.h.

◆ makeCopy()

std::shared_ptr< QmlFile > QQmlJS::Dom::QmlFile::makeCopy ( const DomItem & self) const
inline

Definition at line 341 of file qqmldomexternalitems_p.h.

◆ myParsingErrors()

ErrorGroups QQmlJS::Dom::QmlFile::myParsingErrors ( )
static

Definition at line 467 of file qqmldomexternalitems.cpp.

◆ pragmas()

const QList< Pragma > & QQmlJS::Dom::QmlFile::pragmas ( ) const &
inline

Definition at line 401 of file qqmldomexternalitems_p.h.

◆ setAstComments()

void QQmlJS::Dom::QmlFile::setAstComments ( const std::shared_ptr< AstComments > & comm)
inline

Definition at line 398 of file qqmldomexternalitems_p.h.

◆ setComponents()

void QQmlJS::Dom::QmlFile::setComponents ( const QMultiMap< QString, QmlComponent > & components)
inline

Definition at line 351 of file qqmldomexternalitems_p.h.

◆ setFileLocationsTree()

void QQmlJS::Dom::QmlFile::setFileLocationsTree ( const FileLocations::Tree & v)
inline

Definition at line 400 of file qqmldomexternalitems_p.h.

◆ setHandleForPopulation()

void QQmlJS::Dom::QmlFile::setHandleForPopulation ( const QQmlJSScope::ConstPtr & scope)
inline

Definition at line 432 of file qqmldomexternalitems_p.h.

◆ setImports()

void QQmlJS::Dom::QmlFile::setImports ( const QList< Import > & imports)
inline

Definition at line 374 of file qqmldomexternalitems_p.h.

◆ setPragmas()

void QQmlJS::Dom::QmlFile::setPragmas ( QList< Pragma > pragmas)
inline

Definition at line 402 of file qqmldomexternalitems_p.h.

◆ setTypeResolverWithDependencies()

void QQmlJS::Dom::QmlFile::setTypeResolverWithDependencies ( const std::shared_ptr< QQmlJSTypeResolver > & typeResolver,
const QQmlJSTypeResolverDependencies & dependencies )
inline

Definition at line 417 of file qqmldomexternalitems_p.h.

◆ typeResolver()

std::shared_ptr< QQmlJSTypeResolver > QQmlJS::Dom::QmlFile::typeResolver ( ) const
inline

Definition at line 413 of file qqmldomexternalitems_p.h.

◆ writeOut()

void QQmlJS::Dom::QmlFile::writeOut ( const DomItem & self,
OutWriter & lw ) const
overridevirtual

Reimplemented from QQmlJS::Dom::DomBase.

Definition at line 502 of file qqmldomexternalitems.cpp.

◆ QQmlDomAstCreatorBase

friend class QQmlDomAstCreatorBase
friend

Definition at line 457 of file qqmldomexternalitems_p.h.

Member Data Documentation

◆ kindValue

DomType QQmlJS::Dom::QmlFile::kindValue = DomType::QmlFile
staticconstexpr

Definition at line 329 of file qqmldomexternalitems_p.h.


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