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::DomItem Class Reference

A value type that references any element of the Dom. More...

#include <qqmldomitem_p.h>

Collaboration diagram for QQmlJS::Dom::DomItem:

Public Types

enum class  CopyOption { EnvConnected , EnvDisconnected }
using Callback = function<void(const Path &, const DomItem &, const DomItem &)>
using InternalKind = DomType
using Visitor = function_ref<bool(const Path &, const DomItem &)>
using ChildrenVisitor = function_ref<bool(const Path &, const DomItem &, bool)>

Public Member Functions

template<typename F>
auto visitEl (F f) const
 operator bool () const
InternalKind internalKind () const
QString internalKindStr () const
DomKind domKind () const
Path canonicalPath () const
DomItem filterUp (function_ref< bool(DomType k, const DomItem &)> filter, FilterUpOptions options) const
DomItem containingObject () const
DomItem container () const
DomItem owner () const
 The owner of an element, for an qmlObject this is the containing qml file.
DomItem top () const
DomItem environment () const
DomItem universe () const
DomItem containingFile () const
DomItem containingScriptExpression () const
DomItem goToFile (const QString &filePath) const
DomItem goUp (int) const
DomItem directParent () const
DomItem qmlObject (GoTo option=GoTo::Strict, FilterUpOptions options=FilterUpOptions::ReturnOuter) const
 Returns the QmlObject that this belongs to.
DomItem fileObject (GoTo option=GoTo::Strict) const
DomItem rootQmlObject (GoTo option=GoTo::Strict) const
DomItem globalScope () const
DomItem component (GoTo option=GoTo::Strict) const
DomItem scope (FilterUpOptions options=FilterUpOptions::ReturnOuter) const
QQmlJSScope::ConstPtr nearestSemanticScope () const
QQmlJSScope::ConstPtr semanticScope () const
DomItem get (const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
QList< DomItemgetAll (const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
bool isOwningItem () const
bool isExternalItem () const
bool isTopItem () const
bool isContainer () const
bool isScope () const
bool isCanonicalChild (const DomItem &child) const
bool hasAnnotations () const
QString name () const
DomItem pragmas () const
DomItem ids () const
QString idStr () const
DomItem propertyInfos () const
PropertyInfo propertyInfoWithName (const QString &name) const
QSet< QStringpropertyInfoNames () const
DomItem propertyDefs () const
DomItem bindings () const
DomItem methods () const
DomItem enumerations () const
DomItem children () const
DomItem child (index_type i) const
DomItem annotations () const
bool resolve (const Path &path, Visitor visitor, const ErrorHandler &errorHandler, ResolveOptions options=ResolveOption::None, const Path &fullPath=Path(), QList< Path > *visitedRefs=nullptr) const
DomItem operator[] (const Path &path) const
DomItem operator[] (QStringView component) const
DomItem operator[] (const QString &component) const
DomItem operator[] (const char16_t *component) const
DomItem operator[] (index_type i) const
DomItem operator[] (int i) const
index_type size () const
index_type length () const
DomItem path (const Path &p, const ErrorHandler &h=&defaultErrorHandler) const
DomItem path (const QString &p, const ErrorHandler &h=&defaultErrorHandler) const
DomItem path (QStringView p, const ErrorHandler &h=&defaultErrorHandler) const
QList< QStringfields () const
DomItem field (QStringView name) const
index_type indexes () const
DomItem index (index_type) const
bool visitIndexes (function_ref< bool(const DomItem &)> visitor) const
QSet< QStringkeys () const
QStringList sortedKeys () const
DomItem key (const QString &name) const
DomItem key (QStringView name) const
bool visitKeys (function_ref< bool(const QString &, const DomItem &)> visitor) const
QList< DomItemvalues () const
void writeOutPre (OutWriter &lw) const
void writeOut (OutWriter &lw) const
void writeOutPost (OutWriter &lw) const
bool writeOutForFile (OutWriter &ow, WriteOutChecks extraChecks) const
bool writeOut (const QString &path, int nBackups=2, const LineWriterOptions &opt=LineWriterOptions(), FileWriter *fw=nullptr, WriteOutChecks extraChecks=WriteOutCheck::Default) const
bool visitTree (const Path &basePath, ChildrenVisitor visitor, VisitOptions options=VisitOption::Default, ChildrenVisitor openingVisitor=emptyChildrenVisitor, ChildrenVisitor closingVisitor=emptyChildrenVisitor, const FieldFilter &filter=FieldFilter::noFilter()) const
 Visits recursively all the children of this item using the given visitors.
bool visitPrototypeChain (function_ref< bool(const DomItem &)> visitor, VisitPrototypesOptions options=VisitPrototypesOption::Normal, const ErrorHandler &h=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
bool visitDirectAccessibleScopes (function_ref< bool(const DomItem &)> visitor, VisitPrototypesOptions options=VisitPrototypesOption::Normal, const ErrorHandler &h=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
bool visitStaticTypePrototypeChains (function_ref< bool(const DomItem &)> visitor, VisitPrototypesOptions options=VisitPrototypesOption::Normal, const ErrorHandler &h=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
 DomItem::visitStaticTypePrototypeChains.
bool visitUp (function_ref< bool(const DomItem &)> visitor) const
 Let the visitor visit the Dom Tree hierarchy of this DomItem.
bool visitScopeChain (function_ref< bool(const DomItem &)> visitor, LookupOptions=LookupOption::Normal, const ErrorHandler &h=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
 Let the visitor visit the QML scope hierarchy of this DomItem.
bool visitLocalSymbolsNamed (const QString &name, function_ref< bool(const DomItem &)> visitor) const
bool visitLookup1 (const QString &symbolName, function_ref< bool(const DomItem &)> visitor, LookupOptions=LookupOption::Normal, const ErrorHandler &h=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
bool visitLookup (const QString &symbolName, function_ref< bool(const DomItem &)> visitor, LookupType type=LookupType::Symbol, LookupOptions=LookupOption::Normal, const ErrorHandler &errorHandler=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
bool visitSubSymbolsNamed (const QString &name, function_ref< bool(const DomItem &)> visitor) const
DomItem proceedToScope (const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
 Dereference DomItems pointing to other DomItems.
QList< DomItemlookup (const QString &symbolName, LookupType type=LookupType::Symbol, LookupOptions=LookupOption::Normal, const ErrorHandler &errorHandler=nullptr) const
DomItem lookupFirst (const QString &symbolName, LookupType type=LookupType::Symbol, LookupOptions=LookupOption::Normal, const ErrorHandler &errorHandler=nullptr) const
quintptr id () const
Path pathFromOwner () const
QString canonicalFilePath () const
MutableDomItem makeCopy (CopyOption option=CopyOption::EnvConnected) const
bool commitToBase (const std::shared_ptr< DomEnvironment > &validPtr=nullptr) const
DomItem refreshed () const
QCborValue value () const
void dumpPtr (const Sink &sink) const
void dump (const Sink &, int indent=0, function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter=noFilter) const
FileWriter::Status dump (const QString &path, function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter=noFilter, int nBackups=2, int indent=0, FileWriter *fw=nullptr) const
QString toString () const
int derivedFrom () const
int revision () const
QDateTime createdAt () const
QDateTime frozenAt () const
QDateTime lastDataUpdateAt () const
void addError (ErrorMessage &&msg) const
ErrorHandler errorHandler () const
void clearErrors (const ErrorGroups &groups=ErrorGroups({}), bool iterate=true) const
bool iterateErrors (function_ref< bool(const DomItem &, const ErrorMessage &)> visitor, bool iterate, Path inPath=Path()) const
bool iterateSubOwners (function_ref< bool(const DomItem &owner)> visitor) const
bool iterateDirectSubpaths (DirectVisitor v) const
template<typename T>
DomItem subDataItem (const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
template<typename T>
DomItem subValueItem (const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
template<typename T>
bool invokeVisitorOnValue (DirectVisitor visitor, const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
template<typename F>
bool invokeVisitorOnLazyField (DirectVisitor visitor, QStringView f, F valueF, ConstantData::Options options=ConstantData::Options::MapIsMap) const
DomItem subReferencesItem (const PathEls::PathComponent &c, const QList< Path > &paths) const
DomItem subReferenceItem (const PathEls::PathComponent &c, const Path &referencedObject) const
bool invokeVisitorOnReference (DirectVisitor visitor, QStringView f, const Path &referencedObject) const
bool invokeVisitorOnReferences (DirectVisitor visitor, QStringView f, const QList< Path > &paths) const
DomItem subListItem (const List &list) const
DomItem subMapItem (const Map &map) const
DomItem subScriptElementWrapperItem (const ScriptElementVariant &obj) const
template<typename Owner>
DomItem subOwnerItem (const PathEls::PathComponent &c, Owner o) const
template<typename T>
DomItem wrap (const PathEls::PathComponent &c, const T &obj) const
template<typename T>
bool invokeVisitorOnField (DirectVisitor visitor, QStringView f, T &obj) const
 DomItem ()=default
 DomItem (const std::shared_ptr< DomEnvironment > &)
 DomItem (const std::shared_ptr< DomUniverse > &)
std::shared_ptr< DomToptopPtr () const
std::shared_ptr< OwningItemowningItemPtr () const
template<typename T, typename std::enable_if< std::is_base_of_v< DomBase, T >, bool >::type = true>
T const * as () const
template<typename T, typename std::enable_if<!std::is_base_of_v< DomBase, T >, bool >::type = true>
T const * as () const
template<typename T>
std::shared_ptr< T > ownerAs () const
template<typename Owner, typename T>
DomItem copy (const Owner &owner, const Path &ownerPath, const T &base) const
template<typename Owner>
DomItem copy (const Owner &owner, const Path &ownerPath) const
template<typename T>
DomItem copy (const T &base) const

Static Public Member Functions

static ErrorGroups myErrors ()
static ErrorGroups myResolveErrors ()
static DomItem fromCode (const QString &code, DomType fileType=DomType::QmlFile)
 Creates a new document with the given code.

Static Public Attributes

static ErrorGroup domErrorGroup = NewErrorGroup("Dom")
static DomItem empty = DomItem()

Friends

class DomBase
class DomElement
class Map
class List
class QmlObject
class DomUniverse
class DomEnvironment
class ExternalItemInfoBase
class ConstantData
class MutableDomItem
class ScriptExpression
class AstComments
class FileLocations::Node
class TestDomItem
QMLDOM_EXPORT bool operator== (const DomItem &o1, const DomItem &o2)

Detailed Description

A value type that references any element of the Dom.

This class is the central element in the Dom, it is how any element can be identfied in a uniform way, and provides the API to explore the Dom, and Path based operations.

The DomItem (unless it is Empty) keeps a pointer to the element, and a shared pointer to its owner and to the DomEnvironment or DomUniverse that contains them. This means that: \list

  • A DomItem always has some context: you can get the canonicalPath(), go up along it with containingObject() and container().
  • the indexing operator [], or the path(), field(), key() and index() methods (along with their fields(), keys(), and indexes() contreparts) let one visit the contents of the current element.
  • visitTree can be used to visit all subEments, if preferred on the top of it a visitor pattern can also be used.
  • If element specific attributes are wanted the two template casting as and ownerAs allow safe casting of the DomItem to a specific concrete type (cast to superclasses is not supported).
  • Multithreading does not create issues, because even if an update replacing an OwningItem takes place the DomItem keeps a shared_ptr to the current owner as long as you use it
  • Some elements (Empty, List, Map, ConstantData, Reference) might be inline, meaning that they are generated on the fly, wrapping data of the original object. \endlist

One of the goals of the DomItem is to allow one to use real typed objects, as one is used to in C++, and also let one use modern C++ patterns, meaning container that contain the actual object (without pointer indirection). Exposed OwningItems are basically immutable, but during construction, objects can be modified. This will typically happen from a single thread, so there aren't locking issues, but pointers to inner elements might become invalid. In this case the use of the MutableDomItem is required. It does not keep any pointers to internal elements, but rather the path to them, and it resolves it every time it needs.

Definition at line 853 of file qqmldomitem_p.h.

Member Typedef Documentation

◆ Callback

using QQmlJS::Dom::DomItem::Callback = function<void(const Path &, const DomItem &, const DomItem &)>

Definition at line 856 of file qqmldomitem_p.h.

◆ ChildrenVisitor

using QQmlJS::Dom::DomItem::ChildrenVisitor = function_ref<bool(const Path &, const DomItem &, bool)>

Definition at line 860 of file qqmldomitem_p.h.

◆ InternalKind

Definition at line 858 of file qqmldomitem_p.h.

◆ Visitor

using QQmlJS::Dom::DomItem::Visitor = function_ref<bool(const Path &, const DomItem &)>

Definition at line 859 of file qqmldomitem_p.h.

Member Enumeration Documentation

◆ CopyOption

Enumerator
EnvConnected 
EnvDisconnected 

Definition at line 867 of file qqmldomitem_p.h.

Constructor & Destructor Documentation

◆ DomItem() [1/3]

◆ DomItem() [2/3]

DomItem::DomItem ( const std::shared_ptr< DomEnvironment > & envPtr)

Definition at line 2490 of file qqmldomitem.cpp.

References QQmlJS::Dom::Path::Path().

Here is the call graph for this function:

◆ DomItem() [3/3]

DomItem::DomItem ( const std::shared_ptr< DomUniverse > & universePtr)

Definition at line 2495 of file qqmldomitem.cpp.

References QQmlJS::Dom::Path::Path().

Here is the call graph for this function:

Member Function Documentation

◆ addError()

void DomItem::addError ( ErrorMessage && msg) const

Definition at line 2373 of file qqmldomitem.cpp.

References QQmlJS::Dom::defaultErrorHandler(), owner(), and QQmlJS::Dom::ErrorMessage::withItem().

Referenced by QQmlJS::Dom::LoadInfo::addError(), QQmlJS::Dom::MutableDomItem::addError(), QQmlJS::Dom::DomEnvironment::addLoadInfo(), errorHandler(), QQmlJS::Dom::ModuleIndex::exportsWithNameAndMinorVersion(), QQmlJS::Dom::fileTypeForPath(), QQmlJS::Dom::DomUniverse::loadFile(), and QQmlJS::Dom::DomEnvironment::loadPendingDependencies().

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

◆ annotations()

DomItem QQmlJS::Dom::DomItem::annotations ( ) const
inline

Definition at line 936 of file qqmldomitem_p.h.

References DomItem(), and hasAnnotations().

Referenced by QQmlJS::Dom::MutableDomItem::annotations().

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

◆ as() [1/2]

template<typename T, typename std::enable_if<!std::is_base_of_v< DomBase, T >, bool >::type = true>
T const * QQmlJS::Dom::DomItem::as ( ) const
inline

Definition at line 1156 of file qqmldomitem_p.h.

References QQmlJS::Dom::domTypeIsObjWrap(), and QQmlJS::Dom::domTypeIsValueWrap().

Here is the call graph for this function:

◆ as() [2/2]

template<typename T, typename std::enable_if< std::is_base_of_v< DomBase, T >, bool >::type = true>
T const * QQmlJS::Dom::DomItem::as ( ) const
inline

Definition at line 1144 of file qqmldomitem_p.h.

◆ bindings()

DomItem QQmlJS::Dom::DomItem::bindings ( ) const
inline

Definition at line 931 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::MutableDomItem::bindings().

Here is the caller graph for this function:

◆ canonicalFilePath()

QString DomItem::canonicalFilePath ( ) const

Definition at line 2073 of file qqmldomitem.cpp.

◆ canonicalPath()

◆ child()

DomItem QQmlJS::Dom::DomItem::child ( index_type i) const
inline

Definition at line 935 of file qqmldomitem_p.h.

◆ children()

DomItem QQmlJS::Dom::DomItem::children ( ) const
inline

Definition at line 934 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::MutableDomItem::children().

Here is the caller graph for this function:

◆ clearErrors()

void DomItem::clearErrors ( const ErrorGroups & groups = ErrorGroups({}),
bool iterate = true ) const

Definition at line 2389 of file qqmldomitem.cpp.

◆ commitToBase()

bool DomItem::commitToBase ( const std::shared_ptr< DomEnvironment > & validPtr = nullptr) const

Definition at line 2162 of file qqmldomitem.cpp.

References environment().

Referenced by QQmlJS::Dom::MutableDomItem::commitToBase().

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

◆ component()

DomItem DomItem::component ( GoTo option = GoTo::Strict) const

Definition at line 724 of file qqmldomitem.cpp.

References DomItem(), containingObject(), internalKind(), QQmlJS::Dom::List, QQmlJS::Dom::Map, and QQmlJS::Dom::QmlFile.

Here is the call graph for this function:

◆ container()

DomItem DomItem::container ( ) const

Definition at line 465 of file qqmldomitem.cpp.

References canonicalPath(), containingObject(), path(), pathFromOwner(), and QQmlJS::Dom::Path::split().

Referenced by QQmlJS::Dom::MutableDomItem::container(), QQmlJS::Dom::OwningItem::iterateSubOwners(), and QQmlJS::Dom::FileLocations::treeOf().

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

◆ containingFile()

DomItem DomItem::containingFile ( ) const

Shorthand to obtain the QmlFile DomItem, in which this DomItem is defined. Returns an empty DomItem if the item is not defined in a QML file.

See also
goToFile()

Definition at line 554 of file qqmldomitem.cpp.

References DomItem().

Here is the call graph for this function:

◆ containingObject()

DomItem DomItem::containingObject ( ) const

Definition at line 414 of file qqmldomitem.cpp.

Referenced by component(), container(), fileObject(), resolve(), visitLookup(), and QQmlJS::Dom::QmlObject::writeOut().

Here is the caller graph for this function:

◆ containingScriptExpression()

DomItem DomItem::containingScriptExpression ( ) const

Shorthand to obtain the ScriptExpression DomItem, in which this DomItem is defined. Returns an empty DomItem if the item is not defined inside a ScriptExpression.

See also
goToFile()

Definition at line 540 of file qqmldomitem.cpp.

References DomItem().

Here is the call graph for this function:

◆ copy() [1/3]

template<typename Owner>
DomItem QQmlJS::Dom::DomItem::copy ( const Owner & owner,
const Path & ownerPath ) const
inline

Definition at line 1177 of file qqmldomitem_p.h.

◆ copy() [2/3]

template<typename Owner, typename T>
DomItem QQmlJS::Dom::DomItem::copy ( const Owner & owner,
const Path & ownerPath,
const T & base ) const
inline

Definition at line 1169 of file qqmldomitem_p.h.

◆ copy() [3/3]

template<typename T>
DomItem QQmlJS::Dom::DomItem::copy ( const T & base) const
inline

Definition at line 1184 of file qqmldomitem_p.h.

◆ createdAt()

QDateTime DomItem::createdAt ( ) const

Definition at line 2343 of file qqmldomitem.cpp.

◆ derivedFrom()

int DomItem::derivedFrom ( ) const

Definition at line 2323 of file qqmldomitem.cpp.

◆ directParent()

DomItem DomItem::directParent ( ) const

In the DomItem hierarchy, go 1 level up to get the direct parent.

Definition at line 594 of file qqmldomitem.cpp.

References goUp().

Referenced by filterUp().

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

◆ domKind()

DomKind QQmlJS::Dom::DomItem::domKind ( ) const
inline

Definition at line 880 of file qqmldomitem_p.h.

References QQmlJS::Dom::ConstantData.

◆ dump() [1/2]

FileWriter::Status DomItem::dump ( const QString & path,
function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter = noFilter,
int nBackups = 2,
int indent = 0,
FileWriter * fw = nullptr ) const

Definition at line 2293 of file qqmldomitem.cpp.

References canonicalPath().

Here is the call graph for this function:

◆ dump() [2/2]

void DomItem::dump ( const Sink & s,
int indent = 0,
function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter = noFilter ) const

Definition at line 2285 of file qqmldomitem.cpp.

◆ dumpPtr()

void DomItem::dumpPtr ( const Sink & sink) const

Definition at line 2272 of file qqmldomitem.cpp.

◆ enumerations()

DomItem QQmlJS::Dom::DomItem::enumerations ( ) const
inline

Definition at line 933 of file qqmldomitem_p.h.

◆ environment()

DomItem DomItem::environment ( ) const

Definition at line 516 of file qqmldomitem.cpp.

References DomItem(), QQmlJS::Dom::DomEnvironment, internalKind(), and top().

Referenced by QQmlJS::Dom::RefCacheEntry::addForPath(), QQmlJS::Dom::LoadInfo::advanceLoad(), QQmlJS::Dom::ImportScope::allSources(), QQmlJS::Dom::ModuleIndex::autoExports(), commitToBase(), QQmlJS::Dom::MutableDomItem::environment(), QQmlJS::Dom::RefCacheEntry::forPath(), QQmlJS::Dom::Reference::get(), QQmlJS::Dom::Reference::getAll(), globalScope(), makeCopy(), QQmlJS::Dom::ModuleIndex::qmldirsToLoad(), QQmlJS::Dom::resolveLookupOptions(), QQmlJS::Dom::rootFromContext(), and visitLookup().

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

◆ errorHandler()

ErrorHandler DomItem::errorHandler ( ) const

Definition at line 2383 of file qqmldomitem.cpp.

References addError().

Referenced by QQmlJS::Dom::LoadInfo::advanceLoad().

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

◆ field()

DomItem DomItem::field ( QStringView name) const

Definition at line 1148 of file qqmldomitem.cpp.

◆ fields()

QList< QString > DomItem::fields ( ) const

Definition at line 1143 of file qqmldomitem.cpp.

◆ fileObject()

DomItem DomItem::fileObject ( GoTo option = GoTo::Strict) const

Definition at line 437 of file qqmldomitem.cpp.

References containingObject(), QQmlJS::Dom::Empty, internalKind(), QQmlJS::Dom::JsFile, QQmlJS::Dom::List, QQmlJS::Dom::Map, owner(), QQmlJS::Dom::QmldirFile, QQmlJS::Dom::QmlFile, and QQmlJS::Dom::QmltypesFile.

Here is the call graph for this function:

◆ filterUp()

DomItem DomItem::filterUp ( function_ref< bool(DomType k, const DomItem &)> filter,
FilterUpOptions options ) const

Finds the first element in the DomItem hierarchy that satisfies filter. Use options to set the search direction, see also \l{FilterUpOptions}.

Definition at line 604 of file qqmldomitem.cpp.

References DomItem(), canonicalPath(), directParent(), internalKind(), QQmlJS::Dom::operator!=(), path(), QQmlJS::Dom::ReturnInner, QQmlJS::Dom::ReturnOuter, QQmlJS::Dom::ReturnOuterNoSelf, and top().

Here is the call graph for this function:

◆ fromCode()

DomItem DomItem::fromCode ( const QString & code,
DomType fileType = DomType::QmlFile )
static

Creates a new document with the given code.

This is mostly useful for testing or loading a single code snippet without any dependency. The fileType should normally be QmlFile, but you might want to load a qmltypes file for example and interpret it as qmltypes file (not plain Qml), or as JsFile. In those case set the file type accordingly.

Definition at line 2508 of file qqmldomitem.cpp.

References DomItem(), and QQmlJS::Dom::DomEnvironment::NoDependencies.

Here is the call graph for this function:

◆ frozenAt()

QDateTime DomItem::frozenAt ( ) const

Definition at line 2353 of file qqmldomitem.cpp.

◆ get()

DomItem DomItem::get ( const ErrorHandler & h = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Definition at line 678 of file qqmldomitem.cpp.

References DomItem(), and QQmlJS::Dom::Reference::kindValue.

Here is the call graph for this function:

◆ getAll()

QList< DomItem > DomItem::getAll ( const ErrorHandler & h = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Definition at line 685 of file qqmldomitem.cpp.

References QQmlJS::Dom::Reference::kindValue.

◆ globalScope()

DomItem DomItem::globalScope ( ) const

Definition at line 476 of file qqmldomitem.cpp.

References DomItem(), QQmlJS::Dom::Path::Path(), environment(), QQmlJS::Dom::GlobalScope, and internalKind().

Referenced by QQmlJS::Dom::MutableDomItem::globalScope().

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

◆ goToFile()

DomItem DomItem::goToFile ( const QString & canonicalPath) const

Shorthand to obtain the QmlFile DomItem from a canonicalPath.

See also
containingFile()

Definition at line 567 of file qqmldomitem.cpp.

References top().

Here is the call graph for this function:

◆ goUp()

DomItem DomItem::goUp ( int n) const

In the DomItem hierarchy, go n levels up.

Definition at line 579 of file qqmldomitem.cpp.

References DomItem(), canonicalPath(), QQmlJS::Dom::Path::dropTail(), QQmlJS::Dom::Path::length(), path(), and top().

Referenced by directParent().

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

◆ hasAnnotations()

bool DomItem::hasAnnotations ( ) const

Definition at line 1383 of file qqmldomitem.cpp.

References QQmlJS::Dom::Binding, QQmlJS::Dom::Id, internalKind(), QQmlJS::Dom::QmlObject::kindValue, QQmlJS::Dom::MethodInfo, QQmlJS::Dom::PropertyDefinition, and QQmlJS::Dom::QmlObject.

Referenced by annotations(), and writeOutPre().

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

◆ id()

quintptr DomItem::id ( ) const

Definition at line 2063 of file qqmldomitem.cpp.

◆ ids()

DomItem QQmlJS::Dom::DomItem::ids ( ) const
inline

Definition at line 925 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::MutableDomItem::ids().

Here is the caller graph for this function:

◆ idStr()

QString QQmlJS::Dom::DomItem::idStr ( ) const
inline

Definition at line 926 of file qqmldomitem_p.h.

◆ index()

DomItem DomItem::index ( index_type i) const

Definition at line 1158 of file qqmldomitem.cpp.

◆ indexes()

index_type DomItem::indexes ( ) const

Definition at line 1153 of file qqmldomitem.cpp.

◆ internalKind()

◆ internalKindStr()

QString QQmlJS::Dom::DomItem::internalKindStr ( ) const
inline

Definition at line 879 of file qqmldomitem_p.h.

◆ invokeVisitorOnField()

template<typename T>
bool QQmlJS::Dom::DomItem::invokeVisitorOnField ( DirectVisitor visitor,
QStringView f,
T & obj ) const
inline

Definition at line 1123 of file qqmldomitem_p.h.

◆ invokeVisitorOnLazyField()

template<typename F>
bool QQmlJS::Dom::DomItem::invokeVisitorOnLazyField ( DirectVisitor visitor,
QStringView f,
F valueF,
ConstantData::Options options = ConstantData::Options::MapIsMap ) const
inline

Definition at line 1078 of file qqmldomitem_p.h.

◆ invokeVisitorOnReference()

bool QQmlJS::Dom::DomItem::invokeVisitorOnReference ( DirectVisitor visitor,
QStringView f,
const Path & referencedObject ) const
inline

Definition at line 1089 of file qqmldomitem_p.h.

◆ invokeVisitorOnReferences()

bool QQmlJS::Dom::DomItem::invokeVisitorOnReferences ( DirectVisitor visitor,
QStringView f,
const QList< Path > & paths ) const
inline

Definition at line 1097 of file qqmldomitem_p.h.

◆ invokeVisitorOnValue()

template<typename T>
bool DomItem::invokeVisitorOnValue ( DirectVisitor visitor,
const PathEls::PathComponent & c,
const T & value,
ConstantData::Options options = ConstantData::Options::MapIsMap ) const

Definition at line 1975 of file qqmldomitem_p.h.

◆ isCanonicalChild()

bool DomItem::isCanonicalChild ( const DomItem & child) const

Definition at line 1370 of file qqmldomitem.cpp.

References canonicalPath(), QQmlJS::Dom::Path::dropTail(), isOwningItem(), operator==, QQmlJS::Dom::operator==(), owner(), and pathFromOwner().

Referenced by QQmlJS::Dom::domCompare(), and QQmlJS::Dom::DomBase::dump().

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

◆ isContainer()

bool QQmlJS::Dom::DomItem::isContainer ( ) const
inline

Definition at line 919 of file qqmldomitem_p.h.

References QQmlJS::Dom::domTypeIsContainer(), and internalKind().

Here is the call graph for this function:

◆ isExternalItem()

bool QQmlJS::Dom::DomItem::isExternalItem ( ) const
inline

Definition at line 917 of file qqmldomitem_p.h.

References QQmlJS::Dom::domTypeIsExternalItem(), and internalKind().

Here is the call graph for this function:

◆ isOwningItem()

bool QQmlJS::Dom::DomItem::isOwningItem ( ) const
inline

Definition at line 916 of file qqmldomitem_p.h.

References QQmlJS::Dom::domTypeIsOwningItem(), and internalKind().

Referenced by isCanonicalChild(), and makeCopy().

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

◆ isScope()

bool QQmlJS::Dom::DomItem::isScope ( ) const
inline

Definition at line 920 of file qqmldomitem_p.h.

References QQmlJS::Dom::domTypeIsScope(), and internalKind().

Referenced by visitDirectAccessibleScopes(), and visitLocalSymbolsNamed().

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

◆ isTopItem()

bool QQmlJS::Dom::DomItem::isTopItem ( ) const
inline

Definition at line 918 of file qqmldomitem_p.h.

References QQmlJS::Dom::domTypeIsTopItem(), and internalKind().

Here is the call graph for this function:

◆ iterateDirectSubpaths()

bool DomItem::iterateDirectSubpaths ( DirectVisitor v) const

Definition at line 2436 of file qqmldomitem.cpp.

◆ iterateErrors()

bool DomItem::iterateErrors ( function_ref< bool(const DomItem &, const ErrorMessage &)> visitor,
bool iterate,
Path inPath = Path() ) const

Definition at line 2404 of file qqmldomitem.cpp.

References owner().

Here is the call graph for this function:

◆ iterateSubOwners()

bool DomItem::iterateSubOwners ( function_ref< bool(const DomItem &owner)> visitor) const

Definition at line 2426 of file qqmldomitem.cpp.

References owner().

Here is the call graph for this function:

◆ key() [1/2]

DomItem DomItem::key ( const QString & name) const

Definition at line 1188 of file qqmldomitem.cpp.

◆ key() [2/2]

DomItem QQmlJS::Dom::DomItem::key ( QStringView name) const
inline

Definition at line 974 of file qqmldomitem_p.h.

◆ keys()

QSet< QString > DomItem::keys ( ) const

Definition at line 1175 of file qqmldomitem.cpp.

◆ lastDataUpdateAt()

QDateTime DomItem::lastDataUpdateAt ( ) const

Definition at line 2363 of file qqmldomitem.cpp.

◆ length()

index_type QQmlJS::Dom::DomItem::length ( ) const
inline

Definition at line 958 of file qqmldomitem_p.h.

◆ lookup()

QList< DomItem > DomItem::lookup ( const QString & symbolName,
LookupType type = LookupType::Symbol,
LookupOptions opts = LookupOption::Normal,
const ErrorHandler & errorHandler = nullptr ) const

Definition at line 2035 of file qqmldomitem.cpp.

◆ lookupFirst()

DomItem DomItem::lookupFirst ( const QString & symbolName,
LookupType type = LookupType::Symbol,
LookupOptions opts = LookupOption::Normal,
const ErrorHandler & errorHandler = nullptr ) const

Definition at line 2049 of file qqmldomitem.cpp.

◆ makeCopy()

MutableDomItem DomItem::makeCopy ( DomItem::CopyOption option = CopyOption::EnvConnected) const

Definition at line 2078 of file qqmldomitem.cpp.

References DomItem(), QQmlJS::Dom::MutableDomItem::MutableDomItem(), canonicalPath(), QQmlJS::Dom::Default, QQmlJS::Dom::Empty, EnvDisconnected, environment(), QQmlJS::Dom::GlobalScope, internalKind(), isOwningItem(), QQmlJS::Dom::JsFile, QQmlJS::Dom::DomEnvironment::NoDependencies, QQmlJS::Dom::Overwrite, owner(), path(), pathFromOwner(), QQmlJS::Dom::QmlDirectory, QQmlJS::Dom::QmlFile, QQmlJS::Dom::QmltypesFile, and QQmlJS::Dom::DomEnvironment::SingleThreaded.

Referenced by QQmlJS::Dom::MutableDomItem::makeCopy().

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

◆ methods()

DomItem QQmlJS::Dom::DomItem::methods ( ) const
inline

Definition at line 932 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::MutableDomItem::methods().

Here is the caller graph for this function:

◆ myErrors()

ErrorGroups DomItem::myErrors ( )
static

Definition at line 391 of file qqmldomitem.cpp.

References domErrorGroup.

Referenced by visitPrototypeChain(), and QQmlJS::Dom::visitPrototypeIndex().

Here is the caller graph for this function:

◆ myResolveErrors()

ErrorGroups DomItem::myResolveErrors ( )
static

Definition at line 397 of file qqmldomitem.cpp.

References domErrorGroup.

Referenced by QQmlJS::Dom::CppTypeInfo::fromString(), resolve(), and visitScopeChain().

Here is the caller graph for this function:

◆ name()

QString QQmlJS::Dom::DomItem::name ( ) const
inline

Definition at line 923 of file qqmldomitem_p.h.

◆ nearestSemanticScope()

QQmlJSScope::ConstPtr DomItem::nearestSemanticScope ( ) const

Definition at line 641 of file qqmldomitem.cpp.

References scope().

Here is the call graph for this function:

◆ operator bool()

QQmlJS::Dom::DomItem::operator bool ( ) const
inlineexplicit

Definition at line 875 of file qqmldomitem_p.h.

References QQmlJS::Dom::Empty.

◆ operator[]() [1/6]

DomItem QQmlJS::Dom::DomItem::operator[] ( const char16_t * component) const
inline

Definition at line 951 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::rootFromContext().

Here is the caller graph for this function:

◆ operator[]() [2/6]

DomItem DomItem::operator[] ( const Path & path) const

Definition at line 2262 of file qqmldomitem.cpp.

References path().

Referenced by QQmlJS::Dom::ExternalItemInfoBase::lastRevision(), QQmlJS::Dom::ExternalItemInfoBase::lastValidRevision(), and QQmlJS::Dom::MutableDomItem::operator[]().

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

◆ operator[]() [3/6]

DomItem DomItem::operator[] ( const QString & component) const

Definition at line 2248 of file qqmldomitem.cpp.

◆ operator[]() [4/6]

DomItem QQmlJS::Dom::DomItem::operator[] ( index_type i) const
inline

Definition at line 955 of file qqmldomitem_p.h.

◆ operator[]() [5/6]

DomItem QQmlJS::Dom::DomItem::operator[] ( int i) const
inline

Definition at line 956 of file qqmldomitem_p.h.

◆ operator[]() [6/6]

DomItem DomItem::operator[] ( QStringView component) const

Definition at line 2255 of file qqmldomitem.cpp.

◆ owner()

DomItem DomItem::owner ( ) const

The owner of an element, for an qmlObject this is the containing qml file.

Definition at line 492 of file qqmldomitem.cpp.

References DomItem(), QQmlJS::Dom::domTypeIsOwningItem(), and QQmlJS::Dom::Empty.

Referenced by addError(), QQmlJS::Dom::DomElement::canonicalPath(), QQmlJS::Dom::ModuleScope::canonicalPath(), QQmlJS::Dom::DomBase::containingObject(), QQmlJS::Dom::MutableDomItem::containingObject(), fileObject(), isCanonicalChild(), iterateErrors(), iterateSubOwners(), makeCopy(), QQmlJS::Dom::QmlComponent::subComponents(), QQmlJS::Dom::QmlComponent::subComponentsNames(), QQmlJS::Dom::FileLocations::treeOf(), visitLookup(), visitScopeChain(), and QQmlJS::Dom::Import::writeOut().

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

◆ ownerAs()

template<typename T>
std::shared_ptr< T > DomItem::ownerAs ( ) const

◆ owningItemPtr()

shared_ptr< OwningItem > DomItem::owningItemPtr ( ) const

Definition at line 2471 of file qqmldomitem.cpp.

◆ path() [1/3]

◆ path() [2/3]

DomItem DomItem::path ( const QString & p,
const ErrorHandler & h = &defaultErrorHandler ) const

Definition at line 1133 of file qqmldomitem.cpp.

References path().

Here is the call graph for this function:

◆ path() [3/3]

DomItem DomItem::path ( QStringView p,
const ErrorHandler & h = &defaultErrorHandler ) const

Definition at line 1138 of file qqmldomitem.cpp.

References path().

Here is the call graph for this function:

◆ pathFromOwner()

◆ pragmas()

DomItem QQmlJS::Dom::DomItem::pragmas ( ) const
inline

Definition at line 924 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::MutableDomItem::pragmas().

Here is the caller graph for this function:

◆ proceedToScope()

DomItem DomItem::proceedToScope ( const ErrorHandler & h = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Dereference DomItems pointing to other DomItems.

Dereferences DomItems with internalKind being References, Export and Id. Also does multiple rounds of resolving for nested DomItems. Prefer this over \l {DomItem::get}.

Definition at line 2010 of file qqmldomitem.cpp.

References DomItem(), canonicalPath(), QQmlJS::Dom::Export, QQmlJS::Dom::Id, internalKind(), QQmlJS::Dom::Reference, and scope().

Here is the call graph for this function:

◆ propertyDefs()

DomItem QQmlJS::Dom::DomItem::propertyDefs ( ) const
inline

Definition at line 930 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::MutableDomItem::propertyDefs().

Here is the caller graph for this function:

◆ propertyInfoNames()

QSet< QString > DomItem::propertyInfoNames ( ) const

Definition at line 713 of file qqmldomitem.cpp.

◆ propertyInfos()

DomItem QQmlJS::Dom::DomItem::propertyInfos ( ) const
inline

Definition at line 927 of file qqmldomitem_p.h.

◆ propertyInfoWithName()

PropertyInfo DomItem::propertyInfoWithName ( const QString & name) const

Definition at line 692 of file qqmldomitem.cpp.

◆ qmlObject()

DomItem DomItem::qmlObject ( GoTo options = GoTo::Strict,
FilterUpOptions filterOptions = FilterUpOptions::ReturnOuter ) const

Returns the QmlObject that this belongs to.

qmlObject() might also return the object of a component if GoTo:MostLikely is used.

Definition at line 425 of file qqmldomitem.cpp.

References DomItem().

Here is the call graph for this function:

◆ refreshed()

DomItem QQmlJS::Dom::DomItem::refreshed ( ) const
inline

Definition at line 1037 of file qqmldomitem_p.h.

References canonicalPath(), path(), and top().

Referenced by QQmlJS::Dom::MutableDomItem::refreshed().

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

◆ resolve()

◆ revision()

int DomItem::revision ( ) const

Definition at line 2333 of file qqmldomitem.cpp.

◆ rootQmlObject()

DomItem DomItem::rootQmlObject ( GoTo option = GoTo::Strict) const

Definition at line 460 of file qqmldomitem.cpp.

◆ scope()

DomItem DomItem::scope ( FilterUpOptions options = FilterUpOptions::ReturnOuter) const

Definition at line 635 of file qqmldomitem.cpp.

Referenced by nearestSemanticScope(), proceedToScope(), QQmlJS::Dom::MutableDomItem::scope(), semanticScope(), and visitScopeChain().

Here is the caller graph for this function:

◆ semanticScope()

QQmlJSScope::ConstPtr DomItem::semanticScope ( ) const

Definition at line 651 of file qqmldomitem.cpp.

References scope().

Here is the call graph for this function:

◆ size()

index_type QQmlJS::Dom::DomItem::size ( ) const
inline

Definition at line 957 of file qqmldomitem_p.h.

◆ sortedKeys()

QStringList DomItem::sortedKeys ( ) const

Definition at line 1180 of file qqmldomitem.cpp.

◆ subDataItem()

template<typename T>
DomItem DomItem::subDataItem ( const PathEls::PathComponent & c,
const T & value,
ConstantData::Options options = ConstantData::Options::MapIsMap ) const

Definition at line 1958 of file qqmldomitem_p.h.

◆ subListItem()

DomItem DomItem::subListItem ( const List & list) const
inline

Definition at line 2184 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::ImportScope::iterateDirectSubpaths(), subReferencesItem(), subValueItem(), QQmlJS::Dom::BindingValue::value(), wrap(), and wrap().

Here is the caller graph for this function:

◆ subMapItem()

DomItem DomItem::subMapItem ( const Map & map) const
inline

Definition at line 2189 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::QmlObject::field(), QQmlJS::Dom::FileLocations::Info::iterateDirectSubpaths(), QQmlJS::Dom::ImportScope::iterateDirectSubpaths(), QQmlJS::Dom::RegionComments::iterateDirectSubpaths(), and wrap().

Here is the caller graph for this function:

◆ subOwnerItem()

template<typename Owner>
DomItem QQmlJS::Dom::DomItem::subOwnerItem ( const PathEls::PathComponent & c,
Owner o ) const
inline

Definition at line 1113 of file qqmldomitem_p.h.

◆ subReferenceItem()

DomItem DomItem::subReferenceItem ( const PathEls::PathComponent & c,
const Path & referencedObject ) const

Definition at line 2451 of file qqmldomitem.cpp.

References QQmlJS::Dom::domTypeIsOwningItem(), and internalKind().

Referenced by QQmlJS::Dom::QmlObject::field().

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

◆ subReferencesItem()

DomItem DomItem::subReferencesItem ( const PathEls::PathComponent & c,
const QList< Path > & paths ) const

Definition at line 2442 of file qqmldomitem.cpp.

References subListItem().

Here is the call graph for this function:

◆ subScriptElementWrapperItem()

DomItem QQmlJS::Dom::DomItem::subScriptElementWrapperItem ( const ScriptElementVariant & obj) const
inline

Definition at line 1106 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::QmlObject::field(), and wrap().

Here is the caller graph for this function:

◆ subValueItem()

template<typename T>
DomItem DomItem::subValueItem ( const PathEls::PathComponent & c,
const T & value,
ConstantData::Options options = ConstantData::Options::MapIsMap ) const

Definition at line 1931 of file qqmldomitem_p.h.

References subListItem().

Here is the call graph for this function:

◆ top()

DomItem DomItem::top ( ) const

Definition at line 504 of file qqmldomitem.cpp.

References DomItem(), QQmlJS::Dom::Path::Path(), QQmlJS::Dom::domTypeIsTopItem(), and QQmlJS::Dom::Empty.

Referenced by QQmlJS::Dom::ImportScope::allSources(), environment(), filterUp(), goToFile(), goUp(), refreshed(), QQmlJS::Dom::rootFromContext(), QQmlJS::Dom::MutableDomItem::top(), universe(), and visitUp().

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

◆ topPtr()

shared_ptr< DomTop > DomItem::topPtr ( ) const

Definition at line 2461 of file qqmldomitem.cpp.

◆ toString()

QString DomItem::toString ( ) const

Definition at line 2318 of file qqmldomitem.cpp.

◆ universe()

DomItem DomItem::universe ( ) const

Definition at line 524 of file qqmldomitem.cpp.

References DomItem(), QQmlJS::Dom::DomEnvironment, QQmlJS::Dom::DomUniverse, internalKind(), and top().

Referenced by QQmlJS::Dom::ExternalItemInfoBase::lastRevision(), QQmlJS::Dom::ExternalItemInfoBase::lastValidRevision(), and QQmlJS::Dom::MutableDomItem::universe().

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

◆ value()

QCborValue DomItem::value ( ) const

Definition at line 2267 of file qqmldomitem.cpp.

◆ values()

QList< DomItem > DomItem::values ( ) const

Definition at line 1205 of file qqmldomitem.cpp.

◆ visitDirectAccessibleScopes()

bool DomItem::visitDirectAccessibleScopes ( function_ref< bool(const DomItem &)> visitor,
VisitPrototypesOptions options = VisitPrototypesOption::Normal,
const ErrorHandler & h = nullptr,
QSet< quintptr > * visited = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Definition at line 1592 of file qqmldomitem.cpp.

References QQmlJS::Dom::Binding, QQmlJS::Dom::Export, QQmlJS::Dom::Id, internalKind(), isScope(), QQmlJS::Dom::PropertyDefinition, QQmlJS::Dom::QmlObject, QQmlJS::Dom::Reference, and QQmlJS::Dom::SkipFirst.

Here is the call graph for this function:

◆ visitEl()

template<typename F>
auto QQmlJS::Dom::DomItem::visitEl ( F f) const
inline

Definition at line 870 of file qqmldomitem_p.h.

◆ visitIndexes()

bool DomItem::visitIndexes ( function_ref< bool(const DomItem &)> visitor) const

Definition at line 1163 of file qqmldomitem.cpp.

◆ visitKeys()

bool DomItem::visitKeys ( function_ref< bool(const QString &, const DomItem &)> visitor) const

Definition at line 1193 of file qqmldomitem.cpp.

◆ visitLocalSymbolsNamed()

bool DomItem::visitLocalSymbolsNamed ( const QString & name,
function_ref< bool(const DomItem &)> visitor ) const

Definition at line 2171 of file qqmldomitem.cpp.

References QQmlJS::Dom::ImportScope, internalKind(), isScope(), QQmlJS::Dom::MethodInfo, QQmlJS::Dom::QmlFile, and QQmlJS::Dom::ScriptExpression.

Here is the call graph for this function:

◆ visitLookup()

bool DomItem::visitLookup ( const QString & symbolName,
function_ref< bool(const DomItem &)> visitor,
LookupType type = LookupType::Symbol,
LookupOptions opts = LookupOption::Normal,
const ErrorHandler & errorHandler = nullptr,
QSet< quintptr > * visited = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Definition at line 1936 of file qqmldomitem.cpp.

References containingObject(), environment(), internalKind(), owner(), and QQmlJS::Dom::QmltypesFile.

Here is the call graph for this function:

◆ visitLookup1()

bool DomItem::visitLookup1 ( const QString & symbolName,
function_ref< bool(const DomItem &)> visitor,
LookupOptions opts = LookupOption::Normal,
const ErrorHandler & h = nullptr,
QSet< quintptr > * visited = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Definition at line 1794 of file qqmldomitem.cpp.

◆ visitPrototypeChain()

bool DomItem::visitPrototypeChain ( function_ref< bool(const DomItem &)> visitor,
VisitPrototypesOptions options = VisitPrototypesOption::Normal,
const ErrorHandler & h = nullptr,
QSet< quintptr > * visited = nullptr,
QList< Path > * visitedRefs = nullptr ) const

Definition at line 1547 of file qqmldomitem.cpp.

References canonicalPath(), myErrors(), QQmlJS::Dom::RevisitWarn, QQmlJS::Dom::SkipFirst, and QQmlJS::Dom::ErrorGroups::warning().

Here is the call graph for this function:

◆ visitScopeChain()

bool DomItem::visitScopeChain ( function_ref< bool(const DomItem &)> visitor,
LookupOptions options = LookupOption::Normal,
const ErrorHandler & h = nullptr,
QSet< quintptr > * visited = nullptr,
QList< Path > * visitedRefs = nullptr ) const

◆ visitStaticTypePrototypeChains()

bool DomItem::visitStaticTypePrototypeChains ( function_ref< bool(const DomItem &)> visitor,
VisitPrototypesOptions options = VisitPrototypesOption::Normal,
const ErrorHandler & h = nullptr,
QSet< quintptr > * visited = nullptr,
QList< Path > * visitedRefs = nullptr ) const

DomItem::visitStaticTypePrototypeChains.

Parameters
visitor
visitFirst
visited
Returns

visit the values JS reaches accessing a type directly: the values if it is a singleton or the attached type

Definition at line 1639 of file qqmldomitem.cpp.

References QQmlJS::Dom::SkipFirst.

◆ visitSubSymbolsNamed()

bool QQmlJS::Dom::DomItem::visitSubSymbolsNamed ( const QString & name,
function_ref< bool(const DomItem &)> visitor ) const

◆ visitTree()

bool DomItem::visitTree ( const Path & basePath,
DomItem::ChildrenVisitor visitor,
VisitOptions options = VisitOption::Default,
DomItem::ChildrenVisitor openingVisitor = emptyChildrenVisitor,
DomItem::ChildrenVisitor closingVisitor = emptyChildrenVisitor,
const FieldFilter & filter = FieldFilter::noFilter() ) const

Visits recursively all the children of this item using the given visitors.

First, the visitor is called and can continue or exit the visit by returning true or false.

Second, the openingVisitor is called and controls if the children of the current item needs to be visited or not by returning true or false. In either case, the visitation of all the other siblings is not affected. If both visitor and openingVisitor returned true, then the childrens of the current item will be recursively visited.

Finally, after all the children were visited by visitor and openingVisitor, the closingVisitor is called. Its return value is currently ignored.

Compared to the AST::Visitor*, openingVisitor and closingVisitor are called in the same order as the visit() and endVisit()-calls.

Filtering allows to not visit certain part of the trees, and is checked before(!) the lazy child is instantiated via its lambda. For example, visiting propertyInfos or defaultPropertyname takes a lot of time because it resolves and collects all properties inherited from base types, and might not even be relevant for the visitors.

Definition at line 1436 of file qqmldomitem.cpp.

◆ visitUp()

bool DomItem::visitUp ( function_ref< bool(const DomItem &)> visitor) const

Let the visitor visit the Dom Tree hierarchy of this DomItem.

Definition at line 1662 of file qqmldomitem.cpp.

References canonicalPath(), QQmlJS::Dom::Path::dropTail(), QQmlJS::Dom::Path::length(), path(), and top().

Here is the call graph for this function:

◆ wrap()

template<typename T>
DomItem DomItem::wrap ( const PathEls::PathComponent & c,
const T & obj ) const

Definition at line 1985 of file qqmldomitem_p.h.

References DomItem(), subListItem(), and subMapItem().

Here is the call graph for this function:

◆ writeOut() [1/2]

bool DomItem::writeOut ( const QString & path,
int nBackups = 2,
const LineWriterOptions & opt = LineWriterOptions(),
FileWriter * fw = nullptr,
WriteOutChecks extraChecks = WriteOutCheck::Default ) const

Definition at line 1341 of file qqmldomitem.cpp.

◆ writeOut() [2/2]

void DomItem::writeOut ( OutWriter & lw) const

Definition at line 1234 of file qqmldomitem.cpp.

References writeOutPost(), and writeOutPre().

Referenced by QQmlJS::Dom::ListPBase::writeOut(), QQmlJS::Dom::MutableDomItem::writeOut(), QQmlJS::Dom::MutableDomItem::writeOut(), writeOutForFile(), and QQmlJS::Dom::Binding::writeOutValue().

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

◆ writeOutForFile()

bool DomItem::writeOutForFile ( OutWriter & ow,
WriteOutChecks extraChecks ) const

Performes WriteOut of the FileItem and verifies the consistency of the DOM structure.

OutWriter is essentially a visitor traversing the DOM structure, starting from the current item representing a FileItem. While traversing it might be saving some intermediate information, used later for restoring written out item. Restoration is needed to validate that the DOM structure of the written item has not changed.

Definition at line 1329 of file qqmldomitem.cpp.

References writeOut().

Here is the call graph for this function:

◆ writeOutPost()

void DomItem::writeOutPost ( OutWriter & lw) const

Definition at line 1241 of file qqmldomitem.cpp.

Referenced by QQmlJS::Dom::Binding::writeOut(), writeOut(), QQmlJS::Dom::QmlObject::writeOutAttributes(), QQmlJS::Dom::QmlObject::writeOutId(), QQmlJS::Dom::MethodParameter::writeOutSignal(), and QQmlJS::Dom::Binding::writeOutValue().

Here is the caller graph for this function:

◆ writeOutPre()

void DomItem::writeOutPre ( OutWriter & lw) const

Definition at line 1215 of file qqmldomitem.cpp.

References hasAnnotations().

Referenced by QQmlJS::Dom::Binding::writeOut(), writeOut(), QQmlJS::Dom::QmlObject::writeOutAttributes(), QQmlJS::Dom::QmlObject::writeOutId(), QQmlJS::Dom::MethodParameter::writeOutSignal(), and QQmlJS::Dom::Binding::writeOutValue().

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

◆ AstComments

friend class AstComments
friend

Definition at line 1247 of file qqmldomitem_p.h.

◆ ConstantData

friend class ConstantData
friend

Definition at line 1244 of file qqmldomitem_p.h.

◆ DomBase

friend class DomBase
friend

Definition at line 1236 of file qqmldomitem_p.h.

◆ DomElement

friend class DomElement
friend

Definition at line 1237 of file qqmldomitem_p.h.

◆ DomEnvironment

friend class DomEnvironment
friend

Definition at line 1242 of file qqmldomitem_p.h.

◆ DomUniverse

friend class DomUniverse
friend

Definition at line 1241 of file qqmldomitem_p.h.

◆ ExternalItemInfoBase

friend class ExternalItemInfoBase
friend

Definition at line 1243 of file qqmldomitem_p.h.

◆ FileLocations::Node

friend class FileLocations::Node
friend

Definition at line 1248 of file qqmldomitem_p.h.

◆ List

friend class List
friend

Definition at line 1239 of file qqmldomitem_p.h.

◆ Map

friend class Map
friend

Definition at line 1238 of file qqmldomitem_p.h.

◆ MutableDomItem

friend class MutableDomItem
friend

Definition at line 1245 of file qqmldomitem_p.h.

◆ operator==

QMLDOM_EXPORT bool operator== ( const DomItem & o1,
const DomItem & o2 )
friend

Definition at line 3183 of file qqmldomitem.cpp.

References QQmlJS::Dom::operator!=().

Referenced by isCanonicalChild(), and QQmlJS::Dom::operator!=().

◆ QmlObject

friend class QmlObject
friend

Definition at line 1240 of file qqmldomitem_p.h.

◆ ScriptExpression

friend class ScriptExpression
friend

Definition at line 1246 of file qqmldomitem_p.h.

◆ TestDomItem

friend class TestDomItem
friend

Definition at line 1249 of file qqmldomitem_p.h.

Member Data Documentation

◆ domErrorGroup

◆ empty

DomItem DomItem::empty = DomItem()
static

Definition at line 865 of file qqmldomitem_p.h.

Referenced by QQmlJS::Dom::domCompare().


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