Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJS::Dom::FileLocations Class Reference

Represents and maintains a mapping between elements and their location in a file. More...

#include <qqmldomattachedinfo_p.h>

+ Collaboration diagram for QQmlJS::Dom::FileLocations:

Public Types

using Tree = std::shared_ptr< AttachedInfoT< FileLocations > >
 

Public Member Functions

DomType kind () const
 
bool iterateDirectSubpaths (DomItem &self, DirectVisitor)
 
void ensureCommentLocations (QList< QString > keys)
 

Static Public Member Functions

static Tree createTree (Path basePath)
 
static Tree ensure (Tree base, Path basePath, AttachedInfo::PathType pType=AttachedInfo::PathType::Relative)
 
static Tree find (Tree self, Path p, AttachedInfo::PathType pType=AttachedInfo::PathType::Relative)
 
static AttachedInfoLookupResult< TreefindAttachedInfo (DomItem &item, AttachedInfo::FindOptions options=AttachedInfo::FindOption::Default)
 
static FileLocations::Tree treeOf (DomItem &)
 
static const FileLocationsfileLocationsOf (DomItem &)
 
static void updateFullLocation (Tree fLoc, SourceLocation loc)
 
static void addRegion (Tree fLoc, QString locName, SourceLocation loc)
 
static void addRegion (Tree fLoc, QStringView locName, SourceLocation loc)
 

Public Attributes

SourceLocation fullRegion
 
QMap< QString, SourceLocationregions
 
QMap< QString, QList< SourceLocation > > preCommentLocations
 
QMap< QString, QList< SourceLocation > > postCommentLocations
 

Static Public Attributes

static constexpr DomType kindValue = DomType::FileLocations
 

Detailed Description

Represents and maintains a mapping between elements and their location in a file.

The location information is attached to the element it refers to via AttachedInfo There are static methods to simplify the handling of the tree of AttachedInfo.

Attributes: \list

  • fullRegion: A location guaranteed to include this element, its comments, and all its sub elements
  • regions: a map with locations of regions of this element, the empty string is the default region of this element
  • preCommentLocations: locations of the comments before this element
  • postCommentLocations: locations of the comments after this element \endlist
See also
QQmlJs::Dom::AttachedInfo

Definition at line 238 of file qqmldomattachedinfo_p.h.

Member Typedef Documentation

◆ Tree

Definition at line 240 of file qqmldomattachedinfo_p.h.

Member Function Documentation

◆ addRegion() [1/2]

◆ addRegion() [2/2]

void QQmlJS::Dom::FileLocations::addRegion ( FileLocations::Tree  fLoc,
QStringView  locName,
SourceLocation  loc 
)
static

Definition at line 149 of file qqmldomattachedinfo.cpp.

References QStringView::toString().

+ Here is the call graph for this function:

◆ createTree()

FileLocations::Tree QQmlJS::Dom::FileLocations::createTree ( Path  basePath)
static

Definition at line 94 of file qqmldomattachedinfo.cpp.

Referenced by QQmlJS::Dom::OutWriter::updatedFile().

+ Here is the caller graph for this function:

◆ ensure()

FileLocations::Tree QQmlJS::Dom::FileLocations::ensure ( FileLocations::Tree  base,
Path  basePath,
AttachedInfo::PathType  pType = AttachedInfo::PathType::Relative 
)
static

◆ ensureCommentLocations()

void QQmlJS::Dom::FileLocations::ensureCommentLocations ( QList< QString keys)

Definition at line 86 of file qqmldomattachedinfo.cpp.

References keys.

◆ fileLocationsOf()

const FileLocations * QQmlJS::Dom::FileLocations::fileLocationsOf ( DomItem item)
static

Returns the filelocation Info corresponding to a DomItem.

Definition at line 121 of file qqmldomattachedinfo.cpp.

References item.

Referenced by QmlGoToTypeDefinitionSupport::process(), and QQmlJS::Dom::ErrorMessage::withItem().

+ Here is the caller graph for this function:

◆ find()

static Tree QQmlJS::Dom::FileLocations::find ( Tree  self,
Path  p,
AttachedInfo::PathType  pType = AttachedInfo::PathType::Relative 
)
inlinestatic

Definition at line 249 of file qqmldomattachedinfo_p.h.

◆ findAttachedInfo()

AttachedInfoLookupResult< FileLocations::Tree > QQmlJS::Dom::FileLocations::findAttachedInfo ( DomItem item,
AttachedInfo::FindOptions  options = AttachedInfo::FindOption::Default 
)
static

Definition at line 103 of file qqmldomattachedinfo.cpp.

References item.

◆ iterateDirectSubpaths()

bool QQmlJS::Dom::FileLocations::iterateDirectSubpaths ( DomItem self,
DirectVisitor  visitor 
)

Definition at line 29 of file qqmldomattachedinfo.cpp.

References el, fullRegion, QString::length(), QQmlJS::Dom::locationToData(), map, QStringView::mid(), preCommentLocations, and regions.

+ Here is the call graph for this function:

◆ kind()

DomType QQmlJS::Dom::FileLocations::kind ( ) const
inline

Definition at line 242 of file qqmldomattachedinfo_p.h.

◆ treeOf()

FileLocations::Tree QQmlJS::Dom::FileLocations::treeOf ( DomItem item)
static

Returns the tree corresponding to a DomItem.

Definition at line 112 of file qqmldomattachedinfo.cpp.

References item.

Referenced by findMethodDefinitionOf(), findPropertyDefinitionOf(), findUsagesHelper(), and findUsagesOfNonJSIdentifiers().

+ Here is the caller graph for this function:

◆ updateFullLocation()

void QQmlJS::Dom::FileLocations::updateFullLocation ( FileLocations::Tree  fLoc,
SourceLocation  loc 
)
static

Definition at line 128 of file qqmldomattachedinfo.cpp.

References QQmlJS::SourceLocation::begin(), QQmlJS::SourceLocation::end(), and Q_ASSERT.

Referenced by QQmlJS::Dom::OutWriter::itemStart().

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

Member Data Documentation

◆ fullRegion

SourceLocation QQmlJS::Dom::FileLocations::fullRegion

Definition at line 266 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths().

◆ kindValue

constexpr DomType QQmlJS::Dom::FileLocations::kindValue = DomType::FileLocations
staticconstexpr

Definition at line 241 of file qqmldomattachedinfo_p.h.

◆ postCommentLocations

QMap<QString, QList<SourceLocation> > QQmlJS::Dom::FileLocations::postCommentLocations

Definition at line 269 of file qqmldomattachedinfo_p.h.

◆ preCommentLocations

QMap<QString, QList<SourceLocation> > QQmlJS::Dom::FileLocations::preCommentLocations

Definition at line 268 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths().

◆ regions

QMap<QString, SourceLocation> QQmlJS::Dom::FileLocations::regions

Definition at line 267 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths().


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