|
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< DomItem > | getAll (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< QString > | propertyInfoNames () 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< QString > | fields () 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< QString > | keys () 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< DomItem > | values () const |
void | writeOutPre (OutWriter &lw) const |
void | writeOut (OutWriter &lw) const |
bool | writeOut (const QString &path, int nBackups=2, const LineWriterOptions &opt=LineWriterOptions(), FileWriter *fw=nullptr, WriteOutChecks extraChecks=WriteOutCheck::Default) const |
void | writeOutPost (OutWriter &lw) const |
bool | writeOutForFile (OutWriter &ow, WriteOutChecks extraChecks) 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< DomItem > | lookup (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 | subDataItemField (QStringView f, 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 | dvValue (DirectVisitor visitor, const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const |
template<typename T> |
bool | dvValueField (DirectVisitor visitor, QStringView f, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const |
template<typename F> |
bool | dvValueLazy (DirectVisitor visitor, const PathEls::PathComponent &c, F valueF, ConstantData::Options options=ConstantData::Options::MapIsMap) const |
template<typename F> |
bool | dvValueLazyField (DirectVisitor visitor, QStringView f, F valueF, ConstantData::Options options=ConstantData::Options::MapIsMap) const |
DomItem | subLocationItem (const PathEls::PathComponent &c, SourceLocation loc) const |
DomItem | subReferencesItem (const PathEls::PathComponent &c, const QList< Path > &paths) const |
DomItem | subReferenceItem (const PathEls::PathComponent &c, const Path &referencedObject) const |
bool | dvReference (DirectVisitor visitor, const PathEls::PathComponent &c, const Path &referencedObject) const |
bool | dvReferences (DirectVisitor visitor, const PathEls::PathComponent &c, const QList< Path > &paths) const |
bool | dvReferenceField (DirectVisitor visitor, QStringView f, const Path &referencedObject) const |
bool | dvReferencesField (DirectVisitor visitor, QStringView f, const QList< Path > &paths) const |
bool | dvItem (DirectVisitor visitor, const PathEls::PathComponent &c, function_ref< DomItem()> it) const |
bool | dvItemField (DirectVisitor visitor, QStringView f, function_ref< DomItem()> it) const |
DomItem | subListItem (const List &list) const |
DomItem | subMapItem (const Map &map) const |
DomItem | subObjectWrapItem (SimpleObjectWrap obj) 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> |
DomItem | wrapField (QStringView f, const T &obj) const |
template<typename T> |
bool | dvWrap (DirectVisitor visitor, const PathEls::PathComponent &c, T &obj) const |
template<typename T> |
bool | dvWrapField (DirectVisitor visitor, QStringView f, T &obj) const |
| DomItem ()=default |
| DomItem (const std::shared_ptr< DomEnvironment > &) |
| DomItem (const std::shared_ptr< DomUniverse > &) |
std::shared_ptr< DomTop > | topPtr () const |
std::shared_ptr< OwningItem > | owningItemPtr () 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 |
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 856 of file qqmldomitem_p.h.