Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJS::Dom::ScriptElements::ScriptElementBase< type > Class Template Reference

#include <qqmldomscriptelements_p.h>

+ Inheritance diagram for QQmlJS::Dom::ScriptElements::ScriptElementBase< type >:
+ Collaboration diagram for QQmlJS::Dom::ScriptElements::ScriptElementBase< type >:

Public Types

using BaseT = ScriptElementBase< type >
 
- Public Types inherited from QQmlJS::Dom::ScriptElement
template<typename T >
using PointerType = std::shared_ptr< T >
 
- Public Types inherited from QQmlJS::Dom::DomBase
using FilterT = function_ref< bool(DomItem &, const PathEls::PathComponent &, DomItem &)>
 

Public Member Functions

 ScriptElementBase (QQmlJS::SourceLocation combinedLocation=QQmlJS::SourceLocation{})
 
 ScriptElementBase (QQmlJS::SourceLocation first, QQmlJS::SourceLocation last)
 
DomType kind () const override
 
DomKind domKind () const override
 
void createFileLocations (FileLocations::Tree base) override
 
- Public Member Functions inherited from QQmlJS::Dom::ScriptElement
virtual void createFileLocations (std::shared_ptr< AttachedInfoT< FileLocations > > fileLocationOfOwner)=0
 
std::optional< QQmlJSScope::PtrsemanticScope ()
 
void setSemanticScope (const QQmlJSScope::Ptr &scope)
 
 DomElement (Path pathFromOwner=Path())
 
 DomElement (const DomElement &o)=default
 
- Public Member Functions inherited from QQmlJS::Dom::DomElement
 DomElement (Path pathFromOwner=Path())
 
 DomElement (const DomElement &o)=default
 
Path pathFromOwner (DomItem &self) const override
 
Path pathFromOwner () const
 
Path canonicalPath (DomItem &self) const override
 
DomItem containingObject (DomItem &self) const override
 
virtual void updatePathFromOwner (Path newPath)
 
- Public Member Functions inherited from QQmlJS::Dom::DomBase
virtual ~DomBase ()=default
 
DomBasedomBase ()
 
virtual DomType kind () const =0
 
virtual DomKind domKind () const
 
virtual Path pathFromOwner (DomItem &self) const =0
 
virtual Path canonicalPath (DomItem &self) const =0
 
virtual bool iterateDirectSubpaths (DomItem &self, DirectVisitor visitor)=0
 
bool iterateDirectSubpathsConst (DomItem &self, DirectVisitor) const
 
virtual DomItem containingObject (DomItem &self) const
 
virtual void dump (DomItem &, Sink sink, int indent, FilterT filter) const
 
virtual quintptr id () const
 
QString typeName () const
 
virtual QList< QStringfields (DomItem &self) const
 
virtual DomItem field (DomItem &self, QStringView name) const
 
virtual index_type indexes (DomItem &self) const
 
virtual DomItem index (DomItem &self, index_type index) const
 
virtual QSet< QString > const keys (DomItem &self) const
 
virtual DomItem key (DomItem &self, QString name) const
 
virtual QString canonicalFilePath (DomItem &self) const
 
virtual void writeOut (DomItem &self, OutWriter &lw) const
 
virtual QCborValue value () const
 

Static Public Attributes

static constexpr DomType kindValue = type
 
static constexpr DomKind domKindValue = DomKind::ScriptElement
 

Protected Attributes

QQmlJS::SourceLocation m_combinedLocation
 All of the following overloads are only required for optimization purposes.
 

Additional Inherited Members

- Protected Member Functions inherited from QQmlJS::Dom::DomElement
DomElementoperator= (const DomElement &)=default
 

Detailed Description

template<DomType type>
class QQmlJS::Dom::ScriptElements::ScriptElementBase< type >

Definition at line 35 of file qqmldomscriptelements_p.h.

Member Typedef Documentation

◆ BaseT

Definition at line 38 of file qqmldomscriptelements_p.h.

Constructor & Destructor Documentation

◆ ScriptElementBase() [1/2]

◆ ScriptElementBase() [2/2]

Member Function Documentation

◆ createFileLocations()

template<DomType type>
ScriptElementBase::createFileLocations ( FileLocations::Tree  base)
inlineoverride

Usually, all the visits/recursive calls to DOM elements can be done using the DomItem interface, once all the DOM has been constructed.

During construction, createFileLocations can be used to annotate the DOM representation with the corresponding source locations, which are needed, e.g., to find the corresponding DOM element from a certain text position. When called, createFileLocations sets an entry for itself in the FileLocationsTree.

Derived classes should call the base implemenatation and recursively call createFileLocations on all their children.

Usually, only the root of the script DOM element requires one createFileLocations call after construction {and} after a pathFromOwner was set using updatePathFromOwner.

Definition at line 53 of file qqmldomscriptelements_p.h.

References QQmlJS::Dom::FileLocations::addRegion(), base, QQmlJS::Dom::FileLocations::ensure(), QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::m_combinedLocation, QQmlJS::Dom::DomElement::pathFromOwner(), and QQmlJS::Dom::AttachedInfo::Relative.

Referenced by QQmlJS::Dom::ScriptElements::ScriptList::createFileLocations(), QQmlJS::Dom::ScriptElements::GenericScriptElement::createFileLocations(), QQmlJS::Dom::ScriptElements::BlockStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::ForStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::IfStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::ReturnStatement::createFileLocations(), QQmlJS::Dom::ScriptElements::BinaryExpression::createFileLocations(), QQmlJS::Dom::ScriptElements::VariableDeclarationEntry::createFileLocations(), and QQmlJS::Dom::ScriptElements::VariableDeclaration::createFileLocations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ domKind()

template<DomType type>
DomKind QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::domKind ( ) const
inlineoverridevirtual

◆ kind()

template<DomType type>
DomType QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::kind ( ) const
inlineoverridevirtual

Implements QQmlJS::Dom::DomBase.

Definition at line 50 of file qqmldomscriptelements_p.h.

Member Data Documentation

◆ domKindValue

◆ kindValue

template<DomType type>
constexpr DomType QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::kindValue = type
staticconstexpr

Definition at line 39 of file qqmldomscriptelements_p.h.

◆ m_combinedLocation

template<DomType type>
QQmlJS::SourceLocation QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::m_combinedLocation
protected

All of the following overloads are only required for optimization purposes.

The base implementation will work fine, but might be slightly slower. You can override dump(), fields(), field(), indexes(), index(), keys() or key() if the performance of the base class becomes problematic.

Definition at line 86 of file qqmldomscriptelements_p.h.

Referenced by QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::createFileLocations().


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