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::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(const DomItem &, const PathEls::PathComponent &, const 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 (const FileLocations::Tree &base) override
QQmlJS::SourceLocation mainRegionLocation () const
 All of the following overloads are only required for optimization purposes.
void setMainRegionLocation (const QQmlJS::SourceLocation &location)
void addLocation (FileLocationRegion region, QQmlJS::SourceLocation location)
Public Member Functions inherited from QQmlJS::Dom::ScriptElement
virtual void createFileLocations (const std::shared_ptr< FileLocations::Node > &fileLocationOfOwner)=0
QQmlJSScope::ConstPtr semanticScope ()
void setSemanticScope (const QQmlJSScope::ConstPtr &scope)
 DomElement (const Path &pathFromOwner=Path())
 DomElement (const DomElement &o)=default
Public Member Functions inherited from QQmlJS::Dom::DomElement
 DomElement (const Path &pathFromOwner=Path())
 DomElement (const DomElement &o)=default
Path pathFromOwner () const override
Path canonicalPath (const DomItem &self) const override
DomItem containingObject (const DomItem &self) const override
virtual void updatePathFromOwner (const Path &newPath)
Public Member Functions inherited from QQmlJS::Dom::DomBase
virtual ~DomBase ()=default
DomBasedomBase ()
const DomBasedomBase () const
virtual bool iterateDirectSubpaths (const DomItem &self, DirectVisitor visitor) const =0
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 DomItem field (const DomItem &self, QStringView name) 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 QString canonicalFilePath (const DomItem &self) const
virtual void writeOut (const 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

std::vector< std::pair< FileLocationRegion, QQmlJS::SourceLocation > > m_locations

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 37 of file qqmldomscriptelements_p.h.

Member Typedef Documentation

◆ BaseT

Definition at line 40 of file qqmldomscriptelements_p.h.

Constructor & Destructor Documentation

◆ ScriptElementBase() [1/2]

◆ ScriptElementBase() [2/2]

Member Function Documentation

◆ addLocation()

Definition at line 104 of file qqmldomscriptelements_p.h.

◆ createFileLocations()

template<DomType type>
void QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::createFileLocations ( const 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 55 of file qqmldomscriptelements_p.h.

◆ domKind()

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

Reimplemented from QQmlJS::Dom::DomBase.

Definition at line 53 of file qqmldomscriptelements_p.h.

◆ kind()

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

Implements QQmlJS::Dom::DomBase.

Definition at line 52 of file qqmldomscriptelements_p.h.

◆ mainRegionLocation()

template<DomType type>
QQmlJS::SourceLocation QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::mainRegionLocation ( ) const
inline

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 89 of file qqmldomscriptelements_p.h.

◆ setMainRegionLocation()

template<DomType type>
void QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::setMainRegionLocation ( const QQmlJS::SourceLocation & location)
inline

Definition at line 97 of file qqmldomscriptelements_p.h.

Member Data Documentation

◆ domKindValue

Definition at line 42 of file qqmldomscriptelements_p.h.

◆ kindValue

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

Definition at line 41 of file qqmldomscriptelements_p.h.

◆ m_locations

template<DomType type>
std::vector<std::pair<FileLocationRegion, QQmlJS::SourceLocation> > QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::m_locations
protected

Definition at line 112 of file qqmldomscriptelements_p.h.


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