37 cont = cont && self.dvValueLazyField(visitor, Fields::fullRegion, [
this]() {
40 cont = cont && self.dvItemField(visitor, Fields::regions, [
this, &self]() ->
DomItem {
41 const Path pathFromOwner = self.pathFromOwner().field(Fields::regions);
42 auto map = Map::fromFileRegionMap(pathFromOwner,
regions);
43 return self.subMapItem(
map);
46 && self.dvItemField(visitor, Fields::preCommentLocations, [
this, &self]() ->
DomItem {
47 const Path pathFromOwner =
48 self.pathFromOwner().field(Fields::preCommentLocations);
50 return self.subMapItem(
map);
53 && self.dvItemField(visitor, Fields::postCommentLocations, [
this, &self]() ->
DomItem {
54 const Path pathFromOwner =
55 self.pathFromOwner().field(Fields::postCommentLocations);
57 return self.subMapItem(
map);
81AttachedInfoLookupResult<FileLocations::Tree>
132 fLoc->info().regions[
region] = loc;
139 const auto &
regions = fLoc->info().regions;
145 return fLoc->info().fullRegion;
172 cont = cont && self.dvItemField(visitor, Fields::parent, [&self,
p]() {
173 return self.copy(
p, self.m_ownerPath.dropTail(2),
p.get());
176 && self.dvValueLazyField(visitor, Fields::path, [
this]() {
return path().
toString(); });
177 cont = cont && self.dvItemField(visitor, Fields::subItems, [
this, &self]() {
178 return self.subMapItem(
Map(
192 cont = cont && self.dvItemField(visitor, Fields::infoItem, [&self,
this]() {
228 for (
const auto &
p : std::as_const(relative)) {
245 if (!self)
return nullptr;
247 if (removed != self->path())
258 res =
res->m_subItems.value(rest.head());
259 rest = rest.dropFront();
264AttachedInfoLookupResult<AttachedInfo::Ptr>
273 p =
item.pathFromOwner();
274 fLoc =
o.field(fieldName);
277 p =
c.pathFromOwner().path(
o.canonicalPath().last()).path(
p);
279 fLoc =
o.field(fieldName);
282 AttachedInfoLookupResult<AttachedInfo::Ptr>
res;
287 res.foundTree = foundTree;
288 res.rootTreePath = fLoc.canonicalPath();
290 res.foundTreePath =
res.rootTreePath;
291 for (
const Path &pEl :
res.lookupPath)
292 res.foundTreePath =
res.foundTreePath.field(Fields::subItems).key(pEl.toString());
299 cont = cont && self.dvWrapField(visitor, Fields::expr,
expr);
315AttachedInfoLookupResult<UpdatedScriptExpression::Tree>
319 item, Fields::updatedScriptExpressions);
336 const Path &basePath)
345#include "moc_qqmldomattachedinfo_p.cpp"
iterator insert(const Key &key, const T &value)
Key key(const T &value, const Key &defaultKey=Key()) const
static Ptr createTree(const Path &p=Path())
static bool visitTree(const Ptr &base, function_ref< bool(const Path &, const Ptr &)> visitor, const Path &basePath=Path())
static Ptr ensure(const Ptr &self, const Path &path, PathType pType=PathType::Relative)
static AttachedInfoLookupResult< Ptr > findAttachedInfo(const DomItem &item, QStringView fieldName)
static Ptr treePtr(const DomItem &item, QStringView fieldName)
Attached info creates a tree to attach extra info to DomItems.
virtual DomItem infoItem(const DomItem &self) const =0
static Ptr find(const Ptr &self, const Path &p, PathType pType=PathType::Relative)
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.
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor visitor) const override
static AttachedInfoLookupResult< Ptr > findAttachedInfo(const DomItem &item, QStringView treeFieldName)
QMap< Path, Ptr > m_subItems
std::shared_ptr< AttachedInfo > Ptr
AttachedInfo(const Ptr &parent=nullptr, const Path &p=Path())
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 const FileLocations * fileLocationsOf(const DomItem &)
static AttachedInfoLookupResult< Tree > findAttachedInfo(const DomItem &item)
QMap< FileLocationRegion, SourceLocation > regions
static QQmlJS::SourceLocation region(const Tree &fLoc, FileLocationRegion region)
SourceLocation fullRegion
std::shared_ptr< AttachedInfoT< FileLocations > > Tree
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)
Path mid(int offset, int length) const
static Path fromString(const QString &s, const ErrorHandler &errorHandler=nullptr)
static Path Field(QStringView s=u"")
Path dropFront(int n=1) const
static AttachedInfoLookupResult< Tree > findAttachedInfo(const DomItem &item)
bool iterateDirectSubpaths(const DomItem &self, DirectVisitor) const
std::shared_ptr< AttachedInfoT< UpdatedScriptExpression > > Tree
static const UpdatedScriptExpression * exprPtr(const DomItem &)
static bool visitTree(const Tree &base, function_ref< bool(const Path &, const Tree &)> visitor, const Path &basePath=Path())
static Tree ensure(const Tree &base, const Path &basePath, AttachedInfo::PathType pType)
static Tree treePtr(const DomItem &)
static Tree createTree(const Path &basePath)
std::shared_ptr< ScriptExpression > expr
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & insert(qsizetype i, QChar c)
qsizetype length() const noexcept
Returns the number of characters in this string.
QMap< QString, QString > map
[6]
QSet< QString >::iterator it
QCborValue sourceLocationToQCborValue(QQmlJS::SourceLocation loc)
Combined button and popup list for selecting options.
GLsizei const GLchar *const * path
QLatin1StringView QLatin1String