4#ifndef QMLDOMATTACHEDINFO_P_H
5#define QMLDOMATTACHEDINFO_P_H
34template<
typename TreePtr>
45 res.AttachedInfoLookupResultBase::operator=(*
this);
72 Ptr
parent()
const {
return m_parent.lock(); }
85 QStringView treeFieldName);
88 return findAttachedInfo(item, fieldName).foundTree;
93 if (Ptr resPtr = find(self.ownerAs<AttachedInfo>(), p, pType)) {
94 const Path relative = (pType == PathType::Canonical) ? p.mid(m_path.length()) : p;
96 for (
const Path &pEl : relative) {
97 resPath = resPath.field(
Fields::subItems).key(pEl.toString());
99 return self.copy(resPtr, resPath);
106 return itemAtPath(self, p, pType).field(Fields::infoItem);
112 if (Ptr resPtr = ensure(self.ownerAs<AttachedInfo>(), p, pType)) {
113 const Path relative = (pType == PathType::Canonical) ? p.mid(m_path.length()) : p;
115 for (
const Path &pEl : relative) {
116 resPath = resPath.field(
Fields::subItems).key(pEl.toString());
126 return ensureItemAtPath(self, p, pType).field(Fields::infoItem);
144template<
typename Info>
149 using Ptr =
std::shared_ptr<AttachedInfoT>;
150 using InfoType = Info;
157 auto end = o.m_subItems.end();
158 auto i = o.m_subItems.begin();
160 m_subItems.insert(i.key(), Ptr(
161 new AttachedInfoT(*std::static_pointer_cast<AttachedInfoT>(i.value()).get())));
166 return Ptr(
new AttachedInfoT(
nullptr, p));
171 return std::static_pointer_cast<AttachedInfoT>(AttachedInfo::ensure(self, path, pType));
176 return std::static_pointer_cast<AttachedInfoT>(AttachedInfo::find(self, p, pType));
180 QStringView fieldName)
182 return AttachedInfo::findAttachedInfo(item, fieldName).
template as<AttachedInfoT>();
186 return std::static_pointer_cast<AttachedInfoT>(AttachedInfo::treePtr(item, fieldName));
189 const Ptr &base, function_ref<
bool(
const Path &,
const Ptr &)> visitor,
193 if (visitor(pNow, base)) {
194 auto it = base->m_subItems.cbegin();
195 auto end = base->m_subItems.cend();
197 if (!visitTree(
std::static_pointer_cast<AttachedInfoT>(it.value()), visitor, pNow))
211 return Ptr(
new AttachedInfoT(
std::static_pointer_cast<AttachedInfoT>(parent), p));
218 return std::static_pointer_cast<AttachedInfoT>(
doCopy(self
));
221 Ptr
parent()
const {
return std::static_pointer_cast<AttachedInfoT>(AttachedInfo::parent()); }
223 const Info &
info()
const {
return m_info; }
224 Info &
info() {
return m_info; }
229 for (
auto *it =
this; it; it = it->parent().get()) {
230 result.prepend(it->path().toString());
238 return Ptr(
new AttachedInfoT(*
this));
253 static Tree
ensure(
const Tree &base,
const Path &basePath,
258 return AttachedInfoT<FileLocations>::find(self, p, pType);
267 static void addRegion(
const Tree &fLoc, FileLocationRegion region, SourceLocation loc);
271 static QMetaEnum regionEnum;
AttachedInfoLookupResult< std::shared_ptr< T > > as() const
static Ptr createTree(const Path &p=Path())
AttachedInfo::Ptr instantiate(const AttachedInfo::Ptr &parent, const Path &p=Path()) const override
static bool visitTree(const Ptr &base, function_ref< bool(const Path &, const Ptr &)> visitor, const Path &basePath=Path())
static Ptr find(const Ptr &self, const Path &p, PathType pType=PathType::Relative)
Ptr makeCopy(const DomItem &self) const
DomItem infoItem(const DomItem &self) const override
static Ptr ensure(const Ptr &self, const Path &path, PathType pType=PathType::Relative)
const Info & info() const
AttachedInfoT(const Ptr &parent=nullptr, const Path &p=Path())
std::shared_ptr< OwningItem > doCopy(const DomItem &) const override
static AttachedInfoLookupResult< Ptr > findAttachedInfo(const DomItem &item, QStringView fieldName)
QString canonicalPathForTesting() const
static Ptr treePtr(const DomItem &item, QStringView fieldName)
static constexpr DomType kindValue
AttachedInfoT(const AttachedInfoT &o)
Attached info creates a tree to attach extra info to DomItems.
Path canonicalPath(const DomItem &self) const override
static Ptr treePtr(const DomItem &item, QStringView fieldName)
virtual DomItem infoItem(const DomItem &self) const =0
void setSubItems(QMap< Path, Ptr > v)
static Ptr find(const Ptr &self, const Path &p, PathType pType=PathType::Relative)
void setPath(const Path &p)
static Ptr ensure(const Ptr &self, const Path &path, PathType pType=PathType::Relative)
Returns that the AttachedInfo corresponding to the given path, creating it if it does not exists.
AttachedInfo::Ptr makeCopy(const DomItem &self) const
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const override
static AttachedInfoLookupResult< Ptr > findAttachedInfo(const DomItem &item, QStringView treeFieldName)
DomItem infoAtPath(const DomItem &self, const Path &p, PathType pType=PathType::Relative) const
virtual AttachedInfo::Ptr instantiate(const AttachedInfo::Ptr &parent, const Path &p=Path()) const =0
QMap< Path, Ptr > m_subItems
MutableDomItem ensureItemAtPath(MutableDomItem &self, const Path &p, PathType pType=PathType::Relative)
AttachedInfo(const AttachedInfo &o)
MutableDomItem ensureInfoAtPath(MutableDomItem &self, const Path &p, PathType pType=PathType::Relative)
DomItem itemAtPath(const DomItem &self, const Path &p, PathType pType=PathType::Relative) const
std::weak_ptr< AttachedInfo > m_parent
QMap< Path, Ptr > subItems() const
DomType kind() const override
AttachedInfo(const Ptr &parent=nullptr, const Path &p=Path())
void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
QQmlJSScope::ConstPtr m_semanticScope
void updatePathFromOwner(const Path &newPath)
QQmlJSScope::ConstPtr semanticScope() const
QList< QmlObject > annotations
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
Path addAnnotation(const Path &selfPathFromOwner, const QmlObject &annotation, QmlObject **aPtr=nullptr)
BindingValue(const QList< QmlObject > &l)
void updatePathFromOwner(const Path &newPath)
BindingValue(const std::shared_ptr< ScriptExpression > &o)
BindingValue(const BindingValue &o)
DomItem value(const DomItem &binding) const
BindingValue & operator=(const BindingValue &o)
std::shared_ptr< ScriptExpression > scriptExpression
BindingValue(const QmlObject &o)
void setValue(std::unique_ptr< BindingValue > &&value)
BindingType bindingType() const
std::shared_ptr< ScriptExpression > scriptExpressionValue() const
RegionComments & comments()
Binding & operator=(const Binding &)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const
void setBindingIdentifiers(const ScriptElementVariant &bindingIdentifiers)
Path addAnnotation(const Path &selfPathFromOwner, const QmlObject &a, QmlObject **aPtr=nullptr)
QList< QmlObject > annotations() const
void updatePathFromOwner(const Path &newPath)
static QString preCodeForName(QStringView n)
QmlObject const * objectValue() const
DomItem valueItem(const DomItem &self) const
QList< QmlObject > * arrayValue()
Binding(const Binding &o)
Binding(const QString &m_name, std::unique_ptr< BindingValue > value, BindingType bindingType=BindingType::Normal)
QList< QmlObject > const * arrayValue() const
static QString postCodeForName(QStringView)
void setAnnotations(const QList< QmlObject > &annotations)
Binding & operator=(Binding &&)=default
void writeOut(const DomItem &self, OutWriter &lw) const
Binding(const QString &m_name, const QString &scriptCode, BindingType bindingType=BindingType::Normal)
const RegionComments & comments() const
bool isSignalHandler() const
void writeOutValue(const DomItem &self, OutWriter &lw) const
Binding(const QString &m_name=QString())
static constexpr DomType kindValue
Binding(const QString &m_name, const QmlObject &value, BindingType bindingType=BindingType::Normal)
Binding(Binding &&o)=default
QmlObject * objectValue()
std::shared_ptr< ScriptExpression > scriptExpressionValue()
ScriptElementVariant bindingIdentifiers() const
BindingValueKind valueKind() const
Binding(const QString &m_name, const std::shared_ptr< ScriptExpression > &value, BindingType bindingType=BindingType::Normal)
void setIsSingleton(bool isSingleton)
void updatePathFromOwner(const Path &newPath) override
Component(const Path &pathFromOwner=Path())
void setIsComposite(bool isComposite)
Component & operator=(const Component &)=default
void setIsCreatable(bool isCreatable)
void setObjects(const QList< QmlObject > &objects)
const QMultiMap< QString, EnumDecl > & enumerations() const &
Component(const Component &o)=default
void setEnumerations(QMultiMap< QString, EnumDecl > enumerations)
Path addObject(const QmlObject &object, QmlObject **oPtr=nullptr)
void setName(const QString &name)
Path attachedTypePath(const DomItem &) const
DomItem field(const DomItem &self, QStringView name) const override
Path addEnumeration(const EnumDecl &enumeration, AddOption option=AddOption::Overwrite, EnumDecl **ePtr=nullptr)
void setAttachedTypeName(const QString &name)
bool iterateDirectSubpaths(const DomItem &, DirectVisitor) const override
QString attachedTypeName() const
Component(const QString &name)
void setAttachedTypePath(const Path &p)
const QList< QmlObject > & objects() const &
DomKind domKind() const override
ConstantData(const Path &pathFromOwner, const QCborValue &value, Options options=Options::MapIsMap)
QCborValue value() const override
quintptr id() const override
static constexpr DomType kindValue
DomType kind() const override
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
ConstantData & operator*()
const ConstantData & operator*() const
const ConstantData * operator->() const
ConstantData * operator->()
bool iterateDirectSubpathsConst(const DomItem &self, DirectVisitor) const
virtual DomType kind() const =0
virtual DomKind domKind() const
virtual Path canonicalPath(const DomItem &self) const =0
virtual Path pathFromOwner(const DomItem &self) const =0
virtual QList< QString > fields(const DomItem &self) const
virtual bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const =0
virtual index_type indexes(const DomItem &self) const
const DomBase * domBase() const
virtual void writeOut(const DomItem &self, OutWriter &lw) const
virtual DomItem containingObject(const DomItem &self) const
virtual QString canonicalFilePath(const DomItem &self) const
virtual QSet< QString > const keys(const DomItem &self) const
virtual DomItem field(const DomItem &self, QStringView name) const
virtual quintptr id() const
virtual QCborValue value() const
virtual ~DomBase()=default
virtual DomItem key(const DomItem &self, const QString &name) const
virtual DomItem index(const DomItem &self, index_type index) const
virtual void dump(const DomItem &, const Sink &sink, int indent, FilterT filter) const
DomElement & operator=(const DomElement &)=default
Path canonicalPath(const DomItem &self) const override
DomElement(const DomElement &o)=default
DomElement(const Path &pathFromOwner=Path())
virtual void updatePathFromOwner(const Path &newPath)
Path pathFromOwner(const DomItem &self) const override
Path pathFromOwner() const
DomItem containingObject(const DomItem &self) const override
friend class RefCacheEntry
DomItem fileLocations() const
bool dvReferences(DirectVisitor visitor, const PathEls::PathComponent &c, const QList< Path > &paths) const
DomItem fileLocationsTree() const
bool visitKeys(function_ref< bool(const QString &, const DomItem &)> visitor) const
static ErrorGroup domErrorGroup
bool isCanonicalChild(const DomItem &child) const
QSet< QString > propertyInfoNames() const
QSet< QString > keys() 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
static ErrorGroups myResolveErrors()
QString internalKindStr() const
DomItem enumerations() const
DomItem subOwnerItem(const PathEls::PathComponent &c, Owner o) const
DomItem child(index_type i) const
static ErrorGroups myErrors()
DomItem fileObject(GoTo option=GoTo::Strict) const
bool dvValue(DirectVisitor visitor, const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
DomItem environment() const
DomItem key(QStringView name) const
std::shared_ptr< T > ownerAs() const
DomItem directParent() const
bool commitToBase(const std::shared_ptr< DomEnvironment > &validPtr=nullptr) const
DomItem container() const
index_type indexes() const
DomItem operator[](const char16_t *component) const
DomItem field(QStringView name) const
Path pathFromOwner() const
QDateTime createdAt() const
QStringList sortedKeys() const
DomItem refreshed() const
bool dvItem(DirectVisitor visitor, const PathEls::PathComponent &c, function_ref< DomItem()> it) const
bool visitIndexes(function_ref< bool(const DomItem &)> visitor) const
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
DomItem containingObject() const
DomItem(const std::shared_ptr< DomEnvironment > &)
bool dvReferenceField(DirectVisitor visitor, QStringView f, const Path &referencedObject) const
bool dvWrapField(DirectVisitor visitor, QStringView f, T &obj) const
DomItem subDataItemField(QStringView f, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
DomItem path(QStringView p, const ErrorHandler &h=&defaultErrorHandler) const
bool writeOutForFile(OutWriter &ow, WriteOutChecks extraChecks) const
DomItem copy(const T &base) 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
DomItem path(const QString &p, const ErrorHandler &h=&defaultErrorHandler) const
DomItem rootQmlObject(GoTo option=GoTo::Strict) const
DomItem operator[](const QString &component) const
bool dvReferencesField(DirectVisitor visitor, QStringView f, const QList< Path > &paths) const
DomItem get(const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
DomItem subListItem(const List &list) const
void addError(ErrorMessage &&msg) const
DomItem path(const Path &p, const ErrorHandler &h=&defaultErrorHandler) const
std::shared_ptr< OwningItem > owningItemPtr() 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
bool dvReference(DirectVisitor visitor, const PathEls::PathComponent &c, const Path &referencedObject) const
bool iterateDirectSubpaths(DirectVisitor v) const
std::shared_ptr< DomTop > topPtr() const
DomItem lookupFirst(const QString &symbolName, LookupType type=LookupType::Symbol, LookupOptions=LookupOption::Normal, const ErrorHandler &errorHandler=nullptr) const
DomItem operator[](const Path &path) const
DomItem filterUp(function_ref< bool(DomType k, const DomItem &)> filter, FilterUpOptions options) const
DomItem subReferenceItem(const PathEls::PathComponent &c, const Path &referencedObject) const
DomItem copy(const Owner &owner, const Path &ownerPath) const
bool dvItemField(DirectVisitor visitor, QStringView f, function_ref< DomItem()> it) const
bool visitSubSymbolsNamed(const QString &name, function_ref< bool(const DomItem &)> visitor) const
bool dvValueLazyField(DirectVisitor visitor, QStringView f, F valueF, ConstantData::Options options=ConstantData::Options::MapIsMap) const
DomItem operator[](QStringView component) const
DomItem containingScriptExpression() const
DomItem wrap(const PathEls::PathComponent &c, const T &obj) const
void clearErrors(const ErrorGroups &groups=ErrorGroups({}), bool iterate=true) const
bool dvWrap(DirectVisitor visitor, const PathEls::PathComponent &c, T &obj) const
QQmlJSScope::ConstPtr nearestSemanticScope() const
MutableDomItem makeCopy(CopyOption option=CopyOption::EnvConnected) const
bool visitScopeChain(function_ref< bool(const DomItem &)> visitor, LookupOptions=LookupOption::Normal, const ErrorHandler &h=nullptr, QSet< quintptr > *visited=nullptr, QList< Path > *visitedRefs=nullptr) const
bool dvValueLazy(DirectVisitor visitor, const PathEls::PathComponent &c, F valueF, ConstantData::Options options=ConstantData::Options::MapIsMap) const
friend QMLDOM_EXPORT bool operator==(const DomItem &, const DomItem &)
DomItem wrapField(QStringView f, const T &obj) const
DomItem scope(FilterUpOptions options=FilterUpOptions::ReturnOuter) const
QDateTime lastDataUpdateAt() const
index_type length() 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 subValueItem(const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
DomItem globalScope() const
QString canonicalFilePath() const
DomItem annotations() const
bool visitTree(const Path &basePath, ChildrenVisitor visitor, VisitOptions options=VisitOption::Default, ChildrenVisitor openingVisitor=emptyChildrenVisitor, ChildrenVisitor closingVisitor=emptyChildrenVisitor, const FieldFilter &filter=FieldFilter::noFilter()) const
bool resolve(const Path &path, Visitor visitor, const ErrorHandler &errorHandler, ResolveOptions options=ResolveOption::None, const Path &fullPath=Path(), QList< Path > *visitedRefs=nullptr) const
bool iterateSubOwners(function_ref< bool(const DomItem &owner)> visitor) const
QDateTime frozenAt() const
DomItem(const std::shared_ptr< DomUniverse > &)
QList< DomItem > getAll(const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
bool dvValueField(DirectVisitor visitor, QStringView f, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
DomItem subMapItem(const Map &map) const
DomItem proceedToScope(const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
QList< DomItem > values() const
bool isExternalItem() const
bool writeOut(const QString &path, int nBackups=2, const LineWriterOptions &opt=LineWriterOptions(), FileWriter *fw=nullptr, WriteOutChecks extraChecks=WriteOutCheck::Default) const
ErrorHandler errorHandler() const
DomItem index(index_type) const
InternalKind internalKind() const
bool isOwningItem() const
Path canonicalPath() const
bool hasAnnotations() const
DomItem subObjectWrapItem(SimpleObjectWrap obj) const
DomItem subDataItem(const PathEls::PathComponent &c, const T &value, ConstantData::Options options=ConstantData::Options::MapIsMap) const
void writeOut(OutWriter &lw) const
bool visitUp(function_ref< bool(const DomItem &)> visitor) const
QList< DomItem > lookup(const QString &symbolName, LookupType type=LookupType::Symbol, LookupOptions=LookupOption::Normal, const ErrorHandler &errorHandler=nullptr) const
static DomItem fromCode(const QString &code, DomType fileType=DomType::QmlFile)
DomItem containingFile() const
void dump(const Sink &, int indent=0, function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter=noFilter) const
DomItem subScriptElementWrapperItem(const ScriptElementVariant &obj) const
DomItem copy(const Owner &owner, const Path &ownerPath, const T &base) const
QList< QString > fields() const
DomItem goToFile(const QString &filePath) const
DomItem component(GoTo option=GoTo::Strict) const
void writeOutPost(OutWriter &lw) const
void writeOutPre(OutWriter &lw) const
bool iterateErrors(function_ref< bool(const DomItem &, const ErrorMessage &)> visitor, bool iterate, Path inPath=Path()) const
PropertyInfo propertyInfoWithName(const QString &name) const
bool visitLocalSymbolsNamed(const QString &name, function_ref< bool(const DomItem &)> visitor) const
DomItem propertyDefs() const
DomItem subLocationItem(const PathEls::PathComponent &c, SourceLocation loc) const
DomItem subReferencesItem(const PathEls::PathComponent &c, const QList< Path > &paths) const
void dumpPtr(const Sink &sink) const
DomItem qmlObject(GoTo option=GoTo::Strict, FilterUpOptions options=FilterUpOptions::ReturnOuter) const
DomItem key(const QString &name) const
QQmlJSScope::ConstPtr semanticScope() const
DomItem propertyInfos() const
A Sink is a function that accepts a QStringView as input.
void operator()(const Sink &s) const
void dump(const DomItem &, const Sink &s, int indent, function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter) const override
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
Path pathFromOwner(const DomItem &self) const override
static constexpr DomType kindValue
Path canonicalPath(const DomItem &self) const override
const Empty & operator*() const
const Empty * operator->() const
DomType kind() const override
DomItem containingObject(const DomItem &self) const override
quintptr id() const override
const QList< QmlObject > & annotations() const &
void setValues(QList< EnumItem > values)
const QList< EnumItem > & values() const &
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const override
Path addValue(EnumItem value)
void setAlias(const QString &aliasName)
void setAnnotations(const QList< QmlObject > &annotations)
void writeOut(const DomItem &self, OutWriter &lw) const override
void updatePathFromOwner(const Path &newP) override
void setName(const QString &name)
Path addAnnotation(const QmlObject &child, QmlObject **cPtr=nullptr)
void setIsFlag(bool flag)
static constexpr DomType kindValue
EnumDecl(const QString &name=QString(), QList< EnumItem > values=QList< EnumItem >(), Path pathFromOwner=Path())
DomType kind() const override
EnumItem(const QString &name=QString(), int value=0, ValueKind valueKind=ValueKind::ImplicitValue)
const RegionComments & comments() const
RegionComments & comments()
void writeOut(const DomItem &self, OutWriter &lw) const
static constexpr DomType kindValue
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
convenience macro creating a new ErrorGroup and registering its groupId as translatable string
QLatin1String groupId() const
void dumpId(const Sink &sink) const
QString groupName() const
Represents a set of tags grouping a set of related error messages.
ErrorMessage debug(const Dumper &message) const
ErrorMessage error(const QString &message) const
ErrorMessage errorMessage(const DiagnosticMessage &msg, const Path &element=Path(), const QString &canonicalFilePath=QString()) const
ErrorMessage warning(const Dumper &message) const
QVector< ErrorGroup > groups
static int cmp(const ErrorGroups &g1, const ErrorGroups &g2)
ErrorMessage debug(const QString &message) const
void dumpId(const Sink &sink) const
ErrorMessage info(const QString &message) const
ErrorMessage warning(const QString &message) const
ErrorMessage errorMessage(const Dumper &msg, ErrorLevel level, const Path &element=Path(), const QString &canonicalFilePath=QString(), SourceLocation location=SourceLocation()) const
ErrorMessage info(const Dumper &message) const
void fatal(const Dumper &msg, const Path &element=Path(), QStringView canonicalFilePath=u"", SourceLocation location=SourceLocation()) const
ErrorMessage error(const Dumper &message) const
QCborArray toCbor() const
Represents an error message connected to the dom.
ErrorMessage & withPath(const Path &)
ErrorMessage & withErrorId(QLatin1String errorId)
ErrorMessage(const ErrorGroups &errorGroups, const DiagnosticMessage &msg, const Path &path=Path(), const QString &file=QString(), QLatin1String errorId=QLatin1String(""))
static QLatin1String msg(QLatin1String errorId, ErrorMessage &&err)
ErrorMessage & withLocation(SourceLocation)
ErrorMessage handle(const ErrorHandler &errorHandler=nullptr)
static QLatin1String msg(const char *errorId, ErrorMessage &&err)
ErrorMessage & withFile(const QString &)
ErrorMessage & withItem(const DomItem &)
static ErrorMessage load(const char *errorId)
static ErrorMessage load(QLatin1String errorId, T... args)
ErrorMessage(const QString &message, const ErrorGroups &errorGroups, Level level=Level::Warning, const Path &path=Path(), const QString &file=QString(), SourceLocation location=SourceLocation(), QLatin1String errorId=QLatin1String(""))
void dump(const Sink &s) const
ErrorMessage & withFile(QStringView)
static ErrorMessage load(QLatin1String errorId)
friend int compare(const ErrorMessage &msg1, const ErrorMessage &msg2)
static void visitRegisteredMessages(function_ref< bool(const ErrorMessage &)> visitor)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
static Export fromString(const Path &source, QStringView exp, const Path &typePath, const ErrorHandler &h)
const QMultiMap< QString, QString > & fieldFilterAdd() const
bool operator()(const DomItem &, const Path &, const DomItem &) const
bool addFilter(const QString &f)
static FieldFilter defaultFilter()
static FieldFilter noLocationFilter()
static FieldFilter compareFilter()
bool operator()(const DomItem &, const PathEls::PathComponent &c, const DomItem &) const
static FieldFilter noFilter()
static FieldFilter compareNoCommentsFilter()
FieldFilter(const QMultiMap< QString, QString > &fieldFilterAdd={}, const QMultiMap< QString, QString > &fieldFilterRemove={})
QSet< DomType > filtredTypes
QMultiMap< QString, QString > fieldFilterRemove() const
Represents and maintains a mapping between elements and their location in a file.
QMap< FileLocationRegion, QList< SourceLocation > > preCommentLocations
static void addRegion(const Tree &fLoc, FileLocationRegion region, SourceLocation loc)
static Tree find(const Tree &self, const Path &p, AttachedInfo::PathType pType=AttachedInfo::PathType::Relative)
static const FileLocations * fileLocationsOf(const DomItem &)
static AttachedInfoLookupResult< Tree > findAttachedInfo(const DomItem &item)
static constexpr DomType kindValue
QMap< FileLocationRegion, SourceLocation > regions
static QQmlJS::SourceLocation region(const Tree &fLoc, FileLocationRegion region)
SourceLocation fullRegion
static Tree createTree(const Path &basePath)
static FileLocations::Tree treeOf(const DomItem &)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const
static Tree ensure(const Tree &base, const Path &basePath, AttachedInfo::PathType pType=AttachedInfo::PathType::Relative)
QMap< FileLocationRegion, QList< SourceLocation > > postCommentLocations
static void updateFullLocation(const Tree &fLoc, SourceLocation loc)
QString logicalPath() const
QString canonicalPath() const
static FileToLoad fromFileSystem(const std::weak_ptr< DomEnvironment > &environment, const QString &canonicalPath)
static FileToLoad fromMemory(const std::weak_ptr< DomEnvironment > &environment, const QString &path, const QString &data)
void setCanonicalPath(const QString &canonicalPath)
void setLogicalPath(const QString &logicalPath)
std::optional< InMemoryContents > content() const
FileToLoad(const std::weak_ptr< DomEnvironment > &environment, const QString &canonicalPath, const QString &logicalPath, const std::optional< InMemoryContents > &content)
std::weak_ptr< DomEnvironment > environment() const
Status write(const QString &targetFile, function_ref< bool(QTextStream &)> write, int nBk=2)
bool shouldRemoveTempFile
GlobalComponent(const Path &pathFromOwner=Path())
DomType kind() const override
static constexpr DomType kindValue
Path addAnnotation(const Path &selfPathFromOwner, const QmlObject &ann, QmlObject **aPtr=nullptr)
std::shared_ptr< ScriptExpression > value
static constexpr DomType kindValue
Id(const QString &idName=QString(), const Path &referredObject=Path())
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const
void updatePathFromOwner(const Path &pathFromOwner)
QList< QmlObject > annotations
const QList< Path > & importSourcePaths() const &
void addImport(QStringList p, const Path &targetExports)
const QMap< QString, ImportScope > & subImports() const &
QList< DomItem > importedItemsWithName(const DomItem &self, const QString &name) const
QList< Export > importedExportsWithName(const DomItem &self, const QString &name) const
QSet< QString > importedNames(const DomItem &self) const
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
QList< Path > allSources(const DomItem &self) const
Import(const QmlUri &uri=QmlUri(), Version version=Version(), const QString &importId=QString())
Import baseImport() const
static Import fromUriString(const QString &importStr, Version v=Version(), const QString &importId=QString(), const ErrorHandler &handler=nullptr)
friend bool operator==(const Import &i1, const Import &i2)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const
Path importedPath() const
static QRegularExpression importRe()
void writeOut(const DomItem &self, OutWriter &ow) const
static Import fromFileString(const QString &importStr, const QString &importId=QString(), const ErrorHandler &handler=nullptr)
friend bool operator!=(const Import &i1, const Import &i2)
IndentInfo(QStringView line, int tabSize, int initialColumn=0)
QStringView trailingString
JsResource(const Path &pathFromOwner=Path())
DomType kind() const override
bool iterateDirectSubpaths(const DomItem &, DirectVisitor) const override
static constexpr DomType kindValue
AttributesSequence attributesSequence
FormatOptions formatOptions
TrailingSpace codeTrailingSpace
TrailingSpace commentTrailingSpace
TrailingSpace stringTrailingSpace
virtual void lineChanged()
const QString & currentLine() const
QList< SinkF > innerSinks()
LineWriter & write(QStringView v, TextAddType tType=TextAddType::Normal)
QAtomicInt m_lastCallbackId
void endSourceLocation(PendingSourceLocationId)
void handleTrailingSpace(LineWriterOptions::TrailingSpace s)
LineWriter & write(QStringView v, SourceLocation *toUpdate)
int column(int localIndex)
LineWriter & ensureNewline(int nNewlines=1, TextAddType t=TextAddType::Extra)
PendingSourceLocationId startSourceLocation(SourceLocation *)
QMap< PendingSourceLocationId, PendingSourceLocation > m_pendingSourceLocations
QMap< int, std::function< bool(LineWriter &, TextAddType)> > m_textAddCallbacks
LineWriterOptions m_options
LineWriter & ensureSpace(TextAddType t=TextAddType::Extra)
const LineWriterOptions & options() const
QString eolToWrite() const
void eof(bool ensureNewline=true)
QList< SinkF > m_innerSinks
void addInnerSink(const SinkF &s)
std::function< void(QStringView)> sink()
int addNewlinesAutospacerCallback(int nLines)
virtual void reindentAndSplit(const QString &eol, bool eof=false)
quint32 m_committedEmptyLines
void commitLine(const QString &eol, TextAddType t=TextAddType::Normal, int untilChar=-1)
SourceLocation currentSourceLocation() const
PendingSourceLocationId startSourceLocation(std::function< void(SourceLocation)>)
LineWriter & ensureSpace(QStringView space, TextAddType t=TextAddType::Extra)
PendingSourceLocationIdAtomic m_lastSourceLocationId
virtual void willCommit()
bool removeTextAddCallback(int i)
SourceLocation committedLocation() const
void setLineIndent(int indentAmount)
int addTextAddCallback(std::function< bool(LineWriter &, TextAddType)> callback)
void textAddCallback(TextAddType t)
LineWriter(const SinkF &innerSink, const QString &fileName, const LineWriterOptions &options=LineWriterOptions(), int lineNr=0, int columnNr=0, int utf16Offset=0, const QString ¤tLine=QString())
quintptr id() const override
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor v) const override
void writeOut(const DomItem &self, OutWriter &ow, bool compact) const
static constexpr DomType kindValue
index_type indexes(const DomItem &) const override
virtual void copyTo(ListPBase *) const
virtual void moveTo(ListPBase *) const
void writeOut(const DomItem &self, OutWriter &ow) const override
DomType kind() const override
QList< const void * > m_pList
ListPBase(const Path &pathFromOwner, const QList< const void * > &pList, const QString &elType)
void moveTo(ListPBase *t) const override
ListPT(const Path &pathFromOwner, const QList< T * > &pList, const QString &elType=QString(), ListOptions options=ListOptions::Normal)
DomItem index(const DomItem &self, index_type index) const override
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor v) const override
void copyTo(ListPBase *t) const override
static constexpr DomType kindValue
static constexpr DomType kindValue
const ListPBase * operator->() const
ListP(const Path &pathFromOwner, const QList< T * > &pList, const QString &elType=QString(), ListOptions options=ListOptions::Normal)
const ListPBase & operator*() const
void writeOut(const DomItem &self, OutWriter &ow, bool compact) const
List(const Path &pathFromOwner, const LookupFunction &lookup, const Length &length, const IteratorFunction &iterator, const QString &elType)
DomType kind() const override
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
const List & operator*() const
static List fromQList(const Path &pathFromOwner, const QList< T > &list, const std::function< DomItem(const DomItem &, const PathEls::PathComponent &, const T &)> &elWrapper, ListOptions options=ListOptions::Normal)
static List fromQListRef(const Path &pathFromOwner, const QList< T > &list, const std::function< DomItem(const DomItem &, const PathEls::PathComponent &, const T &)> &elWrapper, ListOptions options=ListOptions::Normal)
void dump(const DomItem &, const Sink &s, int indent, function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)>) const override
void writeOut(const DomItem &self, OutWriter &ow) const override
quintptr id() const override
static constexpr DomType kindValue
const List * operator->() const
index_type indexes(const DomItem &self) const override
DomItem index(const DomItem &self, index_type index) const override
static Map fromMultiMapRef(const Path &pathFromOwner, const QMultiMap< QString, T > &mmap)
const Map * operator->() const
static Map fromFileRegionMap(const Path &pathFromOwner, const QMap< FileLocationRegion, T > &map)
static Map fromFileRegionListMap(const Path &pathFromOwner, const QMap< FileLocationRegion, QList< T > > &map)
QSet< QString > const keys(const DomItem &self) const override
Map(const Path &pathFromOwner, const LookupFunction &lookup, const Keys &keys, const QString &targetType)
const Map & operator*() const
static Map fromMapRef(const Path &pathFromOwner, const QMap< QString, T > &mmap, const std::function< DomItem(const DomItem &, const PathEls::PathComponent &, const T &)> &elWrapper)
static Map fromMultiMap(const Path &pathFromOwner, const QMultiMap< QString, T > &mmap)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
quintptr id() const override
DomItem key(const DomItem &self, const QString &name) const override
static constexpr DomType kindValue
DomType kind() const override
std::shared_ptr< ScriptExpression > body
Path typePath(const DomItem &) const
QString postCode(const DomItem &) const
QString preCode(const DomItem &) const
QList< MethodParameter > parameters
std::shared_ptr< ScriptExpression > returnType
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
void writeOut(const DomItem &self, OutWriter &ow) const
void writePre(const DomItem &self, OutWriter &ow) const
void setCode(const QString &code)
QString signature(const DomItem &self) const
std::shared_ptr< ScriptExpression > defaultValue
void writeOut(const DomItem &self, OutWriter &ow) const
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
void writeOutSignal(const DomItem &self, OutWriter &ow) const
TypeAnnotationStyle typeAnnotationStyle
static constexpr DomType kindValue
std::shared_ptr< ScriptExpression > value
QList< QmlObject > annotations
QMap< QString, QMap< QString, MockObject > > subMaps
friend bool operator==(const ModuleAutoExport &i1, const ModuleAutoExport &i2)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
friend bool operator!=(const ModuleAutoExport &i1, const ModuleAutoExport &i2)
static constexpr DomType kindValue
MutableDomItem setCode(const QString &code)
std::shared_ptr< T > ownerAs() const
MutableDomItem environment()
MutableDomItem annotations()
MutableDomItem addChild(QmlObject child)
MutableDomItem setMethods(QMultiMap< QString, MethodInfo > functionDefs)
QQmlJSScope::ConstPtr semanticScope()
Path canonicalPath() const
MutableDomItem setBindings(QMultiMap< QString, Binding > bindings)
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)
MutableDomItem globalScope()
bool writeOut(const QString &path, int nBackups=2, const LineWriterOptions &opt=LineWriterOptions(), FileWriter *fw=nullptr)
QString internalKindStr()
friend bool operator==(const MutableDomItem &o1, const MutableDomItem &o2)
MutableDomItem bindings()
MutableDomItem addPropertyDef(const PropertyDefinition &propertyDef, AddOption option=AddOption::Overwrite)
void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
bool commitToBase(const std::shared_ptr< DomEnvironment > &validEnvPtr=nullptr)
MutableDomItem addPrototypePath(const Path &prototypePath)
QString canonicalFilePath() const
MutableDomItem propertyDefs()
MutableDomItem fileObject(GoTo option=GoTo::Strict)
MutableDomItem operator[](const char16_t *component)
MutableDomItem addAnnotation(QmlObject child)
MutableDomItem setPropertyDefs(QMultiMap< QString, PropertyDefinition > propertyDefs)
MutableDomItem key(QStringView name)
MutableDomItem operator[](const QString &component)
ErrorHandler errorHandler()
MutableDomItem setNextScopePath(const Path &nextScopePath)
MutableDomItem addMethod(const MethodInfo &functionDef, AddOption option=AddOption::Overwrite)
MutableDomItem field(QStringView name)
void dump(const Sink &s, int indent=0, function_ref< bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> filter=noFilter)
void writeOut(OutWriter &lw)
MutableDomItem(const DomItem &owner, const Path &pathFromOwner)
MutableDomItem containingObject()
MutableDomItem container()
MutableDomItem refreshed()
void addError(ErrorMessage &&msg)
MutableDomItem path(const QString &p)
std::shared_ptr< DomTop > topPtr()
MutableDomItem setAnnotations(const QList< QmlObject > &annotations)
MutableDomItem key(const QString &name)
QSet< QString > const keys()
MutableDomItem qmlObject(GoTo option=GoTo::Strict, FilterUpOptions fOptions=FilterUpOptions::ReturnOuter)
QList< QString > const fields()
MutableDomItem component(GoTo option=GoTo::Strict)
MutableDomItem path(const Path &p)
MutableDomItem makeCopy(CopyOption option=CopyOption::EnvConnected)
MutableDomItem operator[](const Path &path)
MutableDomItem setChildren(const QList< QmlObject > &children)
MutableDomItem index(index_type i)
MutableDomItem child(index_type i)
MutableDomItem addPreComment(const Comment &comment, FileLocationRegion region)
QDateTime lastDataUpdateAt()
MutableDomItem children()
MutableDomItem(const DomItem &item)
std::shared_ptr< OwningItem > owningItemPtr()
MutableDomItem universe()
friend bool operator!=(const MutableDomItem &o1, const MutableDomItem &o2)
MutableDomItem rootQmlObject(GoTo option=GoTo::Strict)
MutableDomItem fileLocations()
MutableDomItem operator[](QStringView component)
MutableDomItem path(QStringView p)
MutableDomItem setScript(const std::shared_ptr< ScriptExpression > &exp)
MutableDomItem addBinding(Binding binding, AddOption option=AddOption::Overwrite)
MutableDomItem addPostComment(const Comment &comment, FileLocationRegion region)
virtual void addError(const DomItem &self, ErrorMessage &&msg)
QDateTime createdAt() const
virtual QDateTime lastDataUpdateAt() const
Path pathFromOwner(const DomItem &) const override final
QBasicMutex * mutex() const
DomItem containingObject(const DomItem &self) const override
virtual std::shared_ptr< OwningItem > doCopy(const DomItem &self) const =0
std::shared_ptr< OwningItem > makeCopy(const DomItem &self) const
virtual bool frozen() const
OwningItem(const OwningItem &&)=delete
bool iterateErrors(const DomItem &self, function_ref< bool(const DomItem &source, const ErrorMessage &msg)> visitor, const Path &inPath=Path())
virtual int revision() const
Path pathFromOwner() const
QDateTime frozenAt() const
void addErrorLocal(ErrorMessage &&msg)
void clearErrors(const ErrorGroups &groups=ErrorGroups({}))
Path canonicalPath(const DomItem &self) const override=0
QMultiMap< Path, ErrorMessage > localErrors() const
OwningItem & operator=(const OwningItem &&)=delete
virtual void refreshedDataAt(QDateTime tNew)
OwningItem(int derivedFrom, const QDateTime &lastDataUpdateAt)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
static int nextRevision()
virtual bool iterateSubOwners(const DomItem &self, function_ref< bool(const DomItem &owner)> visitor)
OwningItem(int derivedFrom=0)
OwningItem(const OwningItem &o)
bool hasSquareBrackets() const
void dump(const Sink &sink) const
bool checkName(QStringView s) const
bool hasSquareBrackets() const
index_type index(index_type defaultValue=-1) const
QStringView stringView() const
void dump(const Sink &sink, const QString &name, bool hasSquareBrackets) const
void dump(const Sink &sink) const
QStringView stringView() const
bool checkName(QStringView s) const
void dump(const Sink &sink) const
bool checkName(QStringView s) const
bool checkName(QStringView s) const
QStringView stringView() const
void dump(const Sink &sink) const
bool checkName(QStringView s) const
void dump(const Sink &sink) const
Filter(const std::function< bool(const DomItem &)> &f, QStringView filterDescription=u"<native code filter>")
QStringView stringView() const
bool hasSquareBrackets() const
std::function< bool(const DomItem &)> filterFunction
QStringView filterDescription
index_type index(index_type=-1) const
bool hasSquareBrackets() const
bool checkName(QStringView s) const
void dump(const Sink &sink) const
bool hasSquareBrackets() const
void dump(const Sink &sink) const
bool checkName(QStringView s) const
QStringView stringView() const
const Key * asKey() const
const Index * asIndex() const
const Filter * asFilter() const
const Empty * asEmpty() const
const Any * asAny() const
bool checkName(QStringView s) const
static int cmp(const PathComponent &p1, const PathComponent &p2)
QStringView stringView() const
PathComponent & operator=(PathComponent &&)=default
const Field * asField() const
PathComponent & operator=(const PathComponent &)=default
index_type index(index_type defaultValue=-1) const
PathComponent(const PathComponent &)=default
PathComponent(Filter &&o)
PathComponent(PathComponent &&)=default
void dump(const Sink &sink) const
const Current * asCurrent() const
PathComponent(Current &&o)
const Root * asRoot() const
bool hasSquareBrackets() const
PathData(const QStringList &strData, const QVector< PathComponent > &components, const std::shared_ptr< PathData > &parent)
QVector< PathComponent > components
PathData(const QStringList &strData, const QVector< PathComponent > &components)
std::shared_ptr< PathData > parent
void dump(const Sink &sink) const
QStringView stringView() const
bool checkName(QStringView s) const
bool operator==(const PathIterator &o) const
PathIterator operator++(int)
PathIterator operator++()
bool operator!=(const PathIterator &o) const
Path field(QStringView name) const
PathCurrent headCurrent() const
Path dropTail(int n=1) const
index_type headIndex(index_type defaultValue=-1) const
static Path Key(QStringView s=u"")
static int cmp(const Path &p1, const Path &p2)
static Path Root(PathRoot r)
Path key(QStringView name) const
Path current(const QString &s) const
Path key(const QString &name) const
Path field(const QString &name) const
static Path fromString(QStringView s, const ErrorHandler &errorHandler=nullptr)
static Path Root(QStringView s=u"")
Path appendComponent(const PathEls::PathComponent &c)
static Path Field(const QString &s)
static Path Key(const QString &s)
PathIterator begin() const
Path current(PathCurrent s) const
Path filter(const std::function< bool(const DomItem &)> &, const QString &) const
static ErrorGroups myErrors()
static Path Current(const QString &s)
bool checkHeadName(QStringView name) const
Path operator[](int i) const
static Path Index(index_type i)
Path current(QStringView s=u"") const
Path path(const Path &toAdd, bool avoidToAddAsBase=false) const
Path mid(int offset, int length) const
static Path Current(QStringView s=u"")
void dump(const Sink &sink) const
Path mid(int offset) const
static Path fromString(const QString &s, const ErrorHandler &errorHandler=nullptr)
static Path Field(QStringView s=u"")
static Path Root(const QString &s)
Path index(index_type i) const
std::function< bool(const DomItem &)> headFilter() const
Path dropFront(int n=1) const
static Path Current(PathCurrent c)
Path filter(const std::function< bool(const DomItem &)> &, QStringView desc=u"<native code filter>") const
PathRoot headRoot() const
Path(const PathEls::PathComponent &c)
std::function< void(SourceLocation)> updater
void changeAtOffset(quint32 offset, qint32 change, qint32 colChange, qint32 lineChange)
SourceLocation * toUpdate
PendingSourceLocationId id
Pragma(const QString &pragmaName=QString(), const QStringList &pragmaValues={})
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
void writeOut(const DomItem &self, OutWriter &ow) const
static constexpr DomType kindValue
static constexpr DomType kindValue
ScriptElementVariant m_nameIdentifiers
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
bool isParametricType() const
void writeOut(const DomItem &self, OutWriter &lw) const
ScriptElementVariant nameIdentifiers() const
void setNameIdentifiers(const ScriptElementVariant &name)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const
static constexpr DomType kindValue
QList< DomItem > propertyDefs
QList< DomItem > bindings
QQmlJSImportVisitor & scopeCreator()
virtual QQmlJSASTClassListToVisit void throwRecursionDepthError() override
QQmlDomAstCreatorWithQQmlJSScope(const QQmlJSScope::Ptr ¤t, MutableDomItem &qmlFile, QQmlJSLogger *logger, QQmlJSImporter *importer)
void enableScriptExpressions(bool enable=true)
void enableLoadFileLazily(bool enable=true)
void endVisit(AST::UiProgram *) override
void enableLoadFileLazily(bool enable=true)
void endVisitHelper(AST::PatternElement *pe, const std::shared_ptr< ScriptElements::GenericScriptElement > &element)
void enableScriptExpressions(bool enable=true)
QQmlDomAstCreator(const MutableDomItem &qmlFile)
bool visit(AST::UiProgram *program) override
void throwRecursionDepthError() override
bool stackHasScriptList() const
void loadAnnotations(AST::UiObjectMember *el)
bool stackHasScriptVariant() const
QQmlJSScope::ConstPtr semanticScope() const
void setNextComponentPath(const Path &p)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
QList< DomItem > subComponents(const DomItem &self) const
void setIds(QMultiMap< QString, Id > ids)
const QMultiMap< QString, Id > & ids() const &
void updatePathFromOwner(const Path &newPath) override
void setNameIdentifiers(const ScriptElementVariant &name)
static constexpr DomType kindValue
void writeOut(const DomItem &self, OutWriter &) const override
void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
QmlComponent(const QString &name=QString())
QList< QString > subComponentsNames(const DomItem &self) const
Path nextComponentPath() const
Path addId(const Id &id, AddOption option=AddOption::Overwrite, Id **idPtr=nullptr)
ScriptElementVariant nameIdentifiers() const
DomType kind() const override
QList< QString > fields(const DomItem &) const override
void setNameIdentifiers(const ScriptElementVariant &name)
void writeOut(const DomItem &self, OutWriter &ow, const QString &onTarget) const
MutableDomItem addBinding(MutableDomItem &self, Binding binding, AddOption option)
ScriptElementVariant nameIdentifiers() const
void setName(const QString &name)
MutableDomItem addChild(MutableDomItem &self, QmlObject child)
void setBindings(QMultiMap< QString, Binding > bindings)
void setAnnotations(const QList< QmlObject > &annotations)
Path addChild(QmlObject child, QmlObject **cPtr=nullptr)
const QMultiMap< QString, Binding > & bindings() const &
DomType kind() const override
void setNextScopePath(const Path &nextScopePath)
void updatePathFromOwner(const Path &newPath) override
void setChildren(const QList< QmlObject > &children)
static constexpr DomType kindValue
Path addAnnotation(const QmlObject &annotation, QmlObject **aPtr=nullptr)
void writeOutSortedEnumerations(const DomItem &component, OutWriter &ow) const
LocallyResolvedAlias resolveAlias(const DomItem &self, std::shared_ptr< ScriptExpression > accessSequence) const
void writeOutId(const DomItem &self, OutWriter &ow) const
QList< QmlObject > children() const
LocallyResolvedAlias resolveAlias(const DomItem &self, const QStringList &accessSequence) const
const QList< Path > & prototypePaths() const &
virtual bool iterateSubOwners(const DomItem &self, function_ref< bool(const DomItem &owner)> visitor) const
void writeOutSortedPropertyDefinition(const DomItem &self, OutWriter &ow, QSet< QString > &mergedDefBinding) const
Path addPropertyDef(const PropertyDefinition &propertyDef, AddOption option, PropertyDefinition **pDef=nullptr)
const QMultiMap< QString, MethodInfo > & methods() const &
Path addBinding(Binding binding, AddOption option, Binding **bPtr=nullptr)
MutableDomItem addPropertyDef(MutableDomItem &self, const PropertyDefinition &propertyDef, AddOption option)
DomItem field(const DomItem &self, QStringView name) const override
QString localDefaultPropertyName() const
void setPropertyDefs(QMultiMap< QString, PropertyDefinition > propertyDefs)
QString defaultPropertyName(const DomItem &self) const
QmlObject(const Path &pathFromOwner=Path())
void writeOutSortedAttributes(const DomItem &self, OutWriter &ow, const DomItem &component) const
MutableDomItem addMethod(MutableDomItem &self, const MethodInfo &functionDef, AddOption option)
void writeOutAttributes(const DomItem &self, OutWriter &ow, const DomItem &component, const QString &code) const
Path nextScopePath() const
void setIdStr(const QString &id)
QList< QPair< SourceLocation, DomItem > > orderOfAttributes(const DomItem &self, const DomItem &component) const
QQmlJSScope::ConstPtr semanticScope() const
const QMultiMap< QString, PropertyDefinition > & propertyDefs() const &
void writeOut(const DomItem &self, OutWriter &lw) const override
Path addPrototypePath(const Path &prototypePath)
void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
void setDefaultPropertyName(const QString &name)
QList< QmlObject > annotations() const
QList< QString > fields() const
void setPrototypePaths(QList< Path > prototypePaths)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
void setMethods(QMultiMap< QString, MethodInfo > functionDefs)
Path addMethod(const MethodInfo &functionDef, AddOption option, MethodInfo **mPtr=nullptr)
bool iterateBaseDirectSubpaths(const DomItem &self, DirectVisitor) const
QString absoluteLocalPath(const QString &basePath=QString()) const
static QmlUri fromDirectoryString(const QString &importStr)
QUrl directoryUrl() const
QString directoryString() const
static QmlUri fromUriString(const QString &importStr)
QString localPath() const
static QmlUri fromString(const QString &importStr)
QString moduleUri() const
friend bool operator==(const QmlUri &i1, const QmlUri &i2)
friend bool operator!=(const QmlUri &i1, const QmlUri &i2)
void setValueTypeName(const QString &name)
void setHasCustomParser(bool v)
void setInterfaceNames(const QStringList &interfaces)
QQmlJSScope::AccessSemantics accessSemantics() const
void setFileName(const QString &fileName)
bool extensionIsJavaScript() const
static constexpr DomType kindValue
bool hasCustomParser() const
QQmlJSScope::ConstPtr semanticScope() const
void setAccessSemantics(QQmlJSScope::AccessSemantics v)
void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
QString extensionTypeName() const
bool iterateDirectSubpaths(const DomItem &, DirectVisitor) const override
bool extensionIsNamespace() const
QString valueTypeName() const
void setExports(QList< Export > exports)
void setMetaRevisions(QList< int > metaRevisions)
void setExtensionTypeName(const QString &name)
void setExtensionIsJavaScript(bool v)
void setExtensionIsNamespace(bool v)
const QList< int > & metaRevisions() const &
const QList< Export > & exports() const &
void addExport(const Export &exportedEntry)
const QStringList & interfaceNames() const &
QmltypesComponent(const Path &pathFromOwner=Path())
DomType kind() const override
QList< QString > fields(const DomItem &self) const override
quintptr id() const override
static constexpr DomType kindValue
const Reference & operator*() const
DomItem index(const DomItem &, index_type) const override
DomItem field(const DomItem &self, QStringView name) const override
DomItem get(const DomItem &self, const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
QList< DomItem > getAll(const DomItem &self, const ErrorHandler &h=nullptr, QList< Path > *visitedRefs=nullptr) const
index_type indexes(const DomItem &) const override
DomType kind() const override
QSet< QString > const keys(const DomItem &) const override
const Reference * operator->() const
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const override
Reference(const Path &referredObject=Path(), const Path &pathFromOwner=Path(), const SourceLocation &loc=SourceLocation())
DomItem key(const DomItem &, const QString &) const override
const DomBase & operator*() const
const DomBase * operator->() const
static constexpr DomType kindValue
ScriptElementVariant element() const
ScriptElementDomWrapper(const ScriptElementVariant &element)
Use this to contain any script element.
void visitConst(F &&visitor) const
std::optional< ScriptElementT > data()
ScriptElement::PointerType< ScriptElement > base() const
static ScriptElementVariant fromElement(const T &element)
void setData(const ScriptElementT &data)
void replaceKindForGenericChildren(DomType oldType, DomType newType)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const override
QStringView preCode() const
ScriptExpression(const QString &code, ExpressionType expressionType, int derivedFrom=0, const QString &preCode=QString(), const QString &postCode=QString())
DomType kind() const override
std::shared_ptr< AstComments > astComments() const
std::shared_ptr< QQmlJS::Engine > engine() const
static constexpr DomType kindValue
std::shared_ptr< ScriptExpression > makeCopy(const DomItem &self) const
ScriptExpression(const ScriptExpression &e)
ExpressionType expressionType() const
void writeOut(const DomItem &self, OutWriter &lw) const override
SourceLocation globalLocation(const DomItem &self) const
QStringView postCode() const
QString astRelocatableDump() const
void setScriptElement(const ScriptElementVariant &p)
std::shared_ptr< OwningItem > doCopy(const DomItem &) const override
SourceLocation locationToLocal(SourceLocation x) const
std::function< SourceLocation(SourceLocation)> locationToLocalF(const DomItem &) const
ScriptElementVariant scriptElement()
void astDumper(const Sink &s, AstDumperOptions options) const
ScriptExpression(QStringView code, const std::shared_ptr< QQmlJS::Engine > &engine, AST::Node *ast, const std::shared_ptr< AstComments > &comments, ExpressionType expressionType, SourceLocation localOffset=SourceLocation(), int derivedFrom=0, QStringView preCode=QStringView(), QStringView postCode=QStringView())
std::function< SourceLocation(SourceLocation)> locationToGlobalF(const DomItem &self) const
std::shared_ptr< ScriptExpression > copyWithUpdatedCode(const DomItem &self, const QString &code) const
SourceLocation localOffset() const
Path canonicalPath(const DomItem &self) const override
static constexpr DomType kindValue
bool iterateDirectSubpaths(const DomItem &, DirectVisitor) const override
SimpleWrapOptions m_options
SimpleObjectWrapBase(const Path &pathFromOwner, const QVariant &value, quintptr idValue, DomType kind=kindValue, SimpleWrapOptions options=SimpleWrapOption::None)
virtual void moveTo(SimpleObjectWrapBase *) const
DomKind domKind() const final override
virtual void copyTo(SimpleObjectWrapBase *) const
SimpleObjectWrapBase()=delete
DomType kind() const final override
quintptr id() const final override
SimpleObjectWrapT(const Path &pathFromOwner, const QVariant &v, quintptr idValue, SimpleWrapOptions o)
void moveTo(SimpleObjectWrapBase *target) const override
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const override
static constexpr DomType kindValue
void writeOut(const DomItem &self, OutWriter &lw) const override
void copyTo(SimpleObjectWrapBase *target) const override
const SimpleObjectWrapBase & operator*() const
SimpleObjectWrapBase & operator*()
static SimpleObjectWrap fromObjectRef(const Path &pathFromOwner, T &value)
SimpleObjectWrap()=delete
const SimpleObjectWrapBase * operator->() const
static constexpr DomType kindValue
SimpleObjectWrapBase * operator->()
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const
QString majorString() const
static constexpr DomType kindValue
int compare(const Version &o) const
Version(qint32 majorVersion=Undefined, qint32 minorVersion=Undefined)
QString minorString() const
static Version fromString(QStringView v)
QString stringValue() const
static constexpr qint32 Undefined
static constexpr qint32 Latest
QString majorSymbolicString() const
A vistor that visits all the AST:Node.
bool visit(AST::UiPublicMember *el) override
void throwRecursionDepthError() override
static QSet< int > uiKinds()
returns a set with all Ui* Nodes (i.e.
void endVisit(AST::UiImport *el) override
bool operator>=(const PathComponent &lhs, const PathComponent &rhs)
bool operator<=(const PathComponent &lhs, const PathComponent &rhs)
bool operator==(const PathComponent &lhs, const PathComponent &rhs)
bool operator!=(const PathComponent &lhs, const PathComponent &rhs)
bool operator>(const PathComponent &lhs, const PathComponent &rhs)
bool operator<(const PathComponent &lhs, const PathComponent &rhs)
Path lookupTypePath(const QString &name)
Path loadInfoPath(const Path &el)
Path moduleScopePath(const QString &uri, const ErrorHandler &errorHandler=nullptr)
Path qmltypesFilePath(const QString &path)
Path jsFilePath(const QString &path)
Path lookupCppTypePath(const QString &name)
Path qmlFileInfoPath(const QString &canonicalFilePath)
Path moduleIndexPath(const QString &uri, int majorVersion, const ErrorHandler &errorHandler=nullptr)
Path qmlFilePath(const QString &canonicalFilePath)
Path globalScopePath(const QString &name)
Path moduleScopePath(const QString &uri, const QString &version, const ErrorHandler &errorHandler=nullptr)
Path lookupSymbolPath(const QString &name)
Path jsFileInfoPath(const QString &path)
Path lookupPropertyPath(const QString &name)
Path moduleScopePath(const QString &uri, Version version, const ErrorHandler &errorHandler=nullptr)
Path qmlDirPath(const QString &path)
Path qmlDirectoryPath(const QString &path)
Path qmldirFilePath(const QString &path)
Path qmlDirectoryInfoPath(const QString &path)
Path qmltypesFileInfoPath(const QString &path)
Path qmldirFileInfoPath(const QString &path)
Path qmlDirInfoPath(const QString &path)
Path qmlFileObjectPath(const QString &canonicalFilePath)
Path globalScopeInfoPath(const QString &name)
QMLDOM_EXPORT void dumperToQDebug(const Dumper &dumper, QDebug debug)
void devNull(QStringView)
QMLDOM_EXPORT void errorToQDebug(const ErrorMessage &)
writes an ErrorMessage to QDebug
constexpr bool domTypeIsOwningItem(DomType)
Path appendUpdatableElementInQList(const Path &listPathFromOwner, QList< T > &list, const T &value, T **vPtr=nullptr)
bool operator<=(const ErrorMessage &e1, const ErrorMessage &e2)
QMLDOM_EXPORT void dumpErrorLevel(const Sink &s, ErrorLevel level)
Dumps a string describing the given error level (ErrorLevel::Error -> Error,...)
constexpr bool domTypeIsValueWrap(DomType k)
void sinkInt(const Sink &s, T i)
QMLDOM_EXPORT void silentError(const ErrorMessage &)
Error handler that ignores all errors (excluding fatal ones)
Path insertUpdatableElementInMultiMap(const Path &mapPathFromOwner, QMultiMap< K, T > &mmap, K key, const T &value, AddOption option=AddOption::KeepExisting, T **valuePtr=nullptr)
bool operator!=(const Version &v1, const Version &v2)
bool noFilter(const DomItem &, const PathEls::PathComponent &, const DomItem &)
QMLDOM_EXPORT void dumperToQDebug(const Dumper &dumper, ErrorLevel level=ErrorLevel::Debug)
writes the dumper to the QDebug object corrsponding to the given error level
QMLDOM_EXPORT void sinkNewline(const Sink &s, int indent=0)
sinks a neline and indents by the given amount
bool operator>=(const ErrorGroups &lhs, const ErrorGroups &rhs)
QMLDOM_EXPORT void setDefaultErrorHandler(const ErrorHandler &h)
Sets the default error handler.
QMLDOM_EXPORT ErrorLevel errorLevelFromQtMsgType(QtMsgType msgType)
size_t qHash(const Path &, size_t)
DomKind kind2domKind(DomType k)
bool operator==(const ErrorGroups &lhs, const ErrorGroups &rhs)
static DomItem keyMultiMapHelper(const DomItem &self, const QString &key, const QMultiMap< QString, T > &mmap)
bool operator!=(const DomItem &o1, const DomItem &o2)
constexpr bool domTypeIsUnattachedOwningItem(DomType)
QMLDOM_EXPORT QString domTypeToString(DomType k)
bool operator!=(const ErrorMessage &e1, const ErrorMessage &e2)
bool operator<=(const Path &lhs, const Path &rhs)
bool operator==(const ErrorMessage &e1, const ErrorMessage &e2)
bool operator>(const Path &lhs, const Path &rhs)
bool operator<(const ErrorMessage &e1, const ErrorMessage &e2)
auto writeOutWrap(const T &, const DomItem &, OutWriter &, rank< 0 >) -> void
constexpr bool domTypeIsScriptElement(DomType)
bool operator>=(const ErrorMessage &e1, const ErrorMessage &e2)
QMLDOM_EXPORT bool domTypeIsScope(DomType k)
constexpr bool domTypeIsDomElement(DomType)
QMLDOM_EXPORT bool domTypeIsExternalItem(DomType k)
void updatePathFromOwnerQList(QList< T > &list, const Path &newPath)
constexpr bool domTypeCanBeInline(DomType k)
bool operator!=(const ErrorGroups &lhs, const ErrorGroups &rhs)
QMLDOM_EXPORT QDebug operator<<(QDebug d, const Dumper &dumper)
QMLDOM_EXPORT QDebug operator<<(QDebug debug, const MutableDomItem &c)
auto writeOutWrap(const T &t, const DomItem &self, OutWriter &lw) -> void
QDebug operator<<(QDebug debug, const Path &p)
bool operator>(const Version &v1, const Version &v2)
QMLDOM_EXPORT QDebug operator<<(QDebug debug, const DomItem &c)
bool operator>=(const Path &lhs, const Path &rhs)
QMLDOM_EXPORT QMap< DomType, QString > domTypeToStringMap()
auto writeOutWrap(const T &t, const DomItem &self, OutWriter &lw, rank< 1 >) -> decltype(t.writeOut(self, lw))
bool operator<=(const ErrorGroups &lhs, const ErrorGroups &rhs)
bool operator!=(const Path &lhs, const Path &rhs)
bool operator<(const Path &lhs, const Path &rhs)
QMLDOM_EXPORT bool domTypeIsTopItem(DomType k)
bool operator>=(const Version &v1, const Version &v2)
QMLDOM_EXPORT void sinkIndent(const Sink &s, int indent)
sinks the requested amount of spaces
bool operator==(const Version &v1, const Version &v2)
bool operator>(const ErrorGroups &lhs, const ErrorGroups &rhs)
QMLDOM_EXPORT void defaultErrorHandler(const ErrorMessage &)
Calls the default error handler (by default errorToQDebug)
bool operator<=(const Version &v1, const Version &v2)
void updatePathFromOwnerMultiMap(QMultiMap< K, T > &mmap, const Path &newPath)
bool operator<(const ErrorGroups &lhs, const ErrorGroups &rhs)
constexpr bool domTypeIsObjWrap(DomType k)
QMLDOM_EXPORT void sinkEscaped(const Sink &sink, QStringView s, EscapeOptions options=EscapeOptions::OuterQuotes)
dumps a string as quoted string (escaping things like quotes or newlines)
@ ScriptVariableDeclarationEntry
@ ScriptContinueStatement
@ ScriptLabelledStatement
@ ScriptTemplateExpressionPart
@ ScriptParenthesizedExpression
@ ScriptNewMemberExpression
@ ScriptConditionalExpression
@ ScriptTryCatchStatement
@ ScriptFunctionExpression
@ ScriptVariableDeclaration
@ ScriptTemplateStringPart
QMLDOM_EXPORT QString domKindToString(DomKind k)
bool operator==(const Path &lhs, const Path &rhs)
bool operator>(const ErrorMessage &e1, const ErrorMessage &e2)
bool emptyChildrenVisitor(Path, const DomItem &, bool)
QMLDOM_EXPORT QString dumperToString(const Dumper &writer)
Converts a dumper to a string.
bool operator<(const Version &v1, const Version &v2)
QMLDOM_EXPORT bool domTypeIsContainer(DomType k)
static ErrorGroups importErrors
QMLDOM_EXPORT QMap< DomKind, QString > domKindToStringMap()
Combined button and popup list for selecting options.
Q_STATIC_LOGGING_CATEGORY(lcAccessibilityCore, "qt.accessibility.core")
#define Q_SCRIPTELEMENT_EXIT_IF(check)
#define Q_SCRIPTELEMENT_DISABLE()
#define NewErrorGroup(name)
QT_BEGIN_NAMESPACE QT_DECLARE_EXPORTED_QT_LOGGING_CATEGORY(writeOutLog, QMLDOM_EXPORT)
#define QMLDOM_FIELD(name)
#define QMLDOM_USTRING(s)
A common base class for all the script elements.
void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
virtual void createFileLocations(const std::shared_ptr< AttachedInfoT< FileLocations > > &fileLocationOfOwner)=0
QQmlJSScope::ConstPtr semanticScope()
SubclassStorage & operator=(const SubclassStorage &o)
SubclassStorage(const SubclassStorage &&o)
SubclassStorage(const SubclassStorage &o)
SubclassStorage(const T *el)