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< QmlFile > makeCopy (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::UiProgram * ast () const
const QList< Import > & imports () const &
void setImports (const QList< Import > &imports)
Path addImport (const Import &i)
std::shared_ptr< QQmlJS::Engine > engine () const
RegionComments & comments ()
std::shared_ptr< AstComments > astComments () 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)
std::shared_ptr< QQmlJSTypeResolver > typeResolver () 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 QString & code () 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
OwningItem & operator= (const OwningItem &&)=delete
std::shared_ptr< OwningItem > makeCopy (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, ErrorMessage > localErrors () const
QBasicMutex * mutex () const
Public Member Functions inherited from QQmlJS::Dom::DomBase
virtual ~DomBase ()=default
DomBase * domBase ()
const DomBase * domBase () 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< QString > fields (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< OwningItem > doCopy (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 219 of file qqmldomexternalitems_p.h.

Member Enumeration Documentation

◆ RecoveryOption

Enumerator
DisableParserRecovery 
EnableParserRecovery 

Definition at line 228 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 217 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 251 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 269 of file qqmldomexternalitems.cpp.

◆ addImport()

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

Definition at line 271 of file qqmldomexternalitems_p.h.

◆ addPragma()

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

Definition at line 286 of file qqmldomexternalitems_p.h.

◆ ast()

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

Definition at line 262 of file qqmldomexternalitems_p.h.

◆ astComments()

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

Definition at line 280 of file qqmldomexternalitems_p.h.

◆ comments()

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

Definition at line 279 of file qqmldomexternalitems_p.h.

◆ components()

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

Definition at line 243 of file qqmldomexternalitems_p.h.

◆ creationOption()

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

Definition at line 306 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 193 of file qqmldomexternalitems.cpp.

◆ engine()

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

Definition at line 278 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 261 of file qqmldomexternalitems.cpp.

◆ fileLocationsTree()

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

Definition at line 282 of file qqmldomexternalitems_p.h.

◆ handleForPopulation()

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

Definition at line 308 of file qqmldomexternalitems_p.h.

◆ imports()

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

Definition at line 266 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 247 of file qqmldomexternalitems.cpp.

◆ kind()

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

Implements QQmlJS::Dom::DomBase.

Definition at line 226 of file qqmldomexternalitems_p.h.

◆ makeCopy()

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

Definition at line 237 of file qqmldomexternalitems_p.h.

◆ myParsingErrors()

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

Definition at line 240 of file qqmldomexternalitems.cpp.

◆ pragmas()

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

Definition at line 284 of file qqmldomexternalitems_p.h.

◆ setAstComments()

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

Definition at line 281 of file qqmldomexternalitems_p.h.

◆ setComponents()

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

Definition at line 247 of file qqmldomexternalitems_p.h.

◆ setFileLocationsTree()

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

Definition at line 283 of file qqmldomexternalitems_p.h.

◆ setHandleForPopulation()

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

Definition at line 313 of file qqmldomexternalitems_p.h.

◆ setImports()

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

Definition at line 270 of file qqmldomexternalitems_p.h.

◆ setPragmas()

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

Definition at line 285 of file qqmldomexternalitems_p.h.

◆ setTypeResolverWithDependencies()

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

Definition at line 298 of file qqmldomexternalitems_p.h.

◆ typeResolver()

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

Definition at line 294 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 275 of file qqmldomexternalitems.cpp.

◆ QQmlDomAstCreatorBase

friend class QQmlDomAstCreatorBase
friend

Definition at line 337 of file qqmldomexternalitems_p.h.

Member Data Documentation

◆ kindValue

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

Definition at line 225 of file qqmldomexternalitems_p.h.


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