Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 (const DomItem &self, DirectVisitor) const
 

Static Public Member Functions

static Tree createTree (const Path &basePath)
 
static Tree ensure (const Tree &base, const Path &basePath, AttachedInfo::PathType pType=AttachedInfo::PathType::Relative)
 
static Tree find (const Tree &self, const Path &p, AttachedInfo::PathType pType=AttachedInfo::PathType::Relative)
 
static AttachedInfoLookupResult< TreefindAttachedInfo (const DomItem &item)
 
static FileLocations::Tree treeOf (const DomItem &)
 
static const FileLocationsfileLocationsOf (const DomItem &)
 
static void updateFullLocation (const Tree &fLoc, SourceLocation loc)
 
static void addRegion (const Tree &fLoc, FileLocationRegion region, SourceLocation loc)
 
static QQmlJS::SourceLocation region (const Tree &fLoc, FileLocationRegion region)
 

Public Attributes

SourceLocation fullRegion
 
QMap< FileLocationRegion, SourceLocationregions
 
QMap< FileLocationRegion, QList< SourceLocation > > preCommentLocations
 
QMap< FileLocationRegion, 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 245 of file qqmldomattachedinfo_p.h.

Member Typedef Documentation

◆ Tree

Definition at line 247 of file qqmldomattachedinfo_p.h.

Member Function Documentation

◆ addRegion()

void QQmlJS::Dom::FileLocations::addRegion ( const Tree & fLoc,
FileLocationRegion region,
SourceLocation loc )
static

◆ createTree()

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

Definition at line 62 of file qqmldomattachedinfo.cpp.

References QQmlJS::Dom::AttachedInfoT< Info >::createTree().

+ Here is the call graph for this function:

◆ ensure()

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

Definition at line 66 of file qqmldomattachedinfo.cpp.

References base, and QQmlJS::Dom::AttachedInfoT< Info >::ensure().

Referenced by QQmlJS::Dom::ScriptElements::ScriptElementBase< type >::createFileLocations(), QQmlJS::Dom::QQmlDomAstCreator::endVisit(), QQmlJS::Dom::QQmlDomAstCreator::endVisit(), QQmlJS::Dom::OutWriter::itemStart(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), QQmlJS::Dom::QQmlDomAstCreator::visit(), and QQmlJS::Dom::QQmlDomAstCreator::visit().

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

◆ fileLocationsOf()

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

Returns the filelocation Info corresponding to a DomItem.

Definition at line 100 of file qqmldomattachedinfo.cpp.

References item, and treeOf().

+ Here is the call graph for this function:

◆ find()

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

Definition at line 255 of file qqmldomattachedinfo_p.h.

◆ findAttachedInfo()

AttachedInfoLookupResult< FileLocations::Tree > QQmlJS::Dom::FileLocations::findAttachedInfo ( const DomItem & item)
static

Allows to query information about the FileLocations::Tree obtained from item, such as path of the Tree root in the Dom, the path of this item's Tree in the Dom, and so on.

Note
You can use {qDebug() << item.path(FileLocations::findAttachedInfo(item).foundTreePath)} or {item.path(FileLocations::findAttachedInfo(item).foundTreePath).toString()} to print out the Tree of item, for example, as Tree's cannot be printed when outside the Dom.

Definition at line 82 of file qqmldomattachedinfo.cpp.

References QQmlJS::Dom::AttachedInfoT< Info >::findAttachedInfo(), and item.

Referenced by treeOf().

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

◆ iterateDirectSubpaths()

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

Definition at line 34 of file qqmldomattachedinfo.cpp.

References fullRegion, map, postCommentLocations, preCommentLocations, regions, and QQmlJS::Dom::sourceLocationToQCborValue().

+ Here is the call graph for this function:

◆ kind()

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

Definition at line 249 of file qqmldomattachedinfo_p.h.

◆ region()

SourceLocation QQmlJS::Dom::FileLocations::region ( const Tree & fLoc,
FileLocationRegion region )
static

Definition at line 136 of file qqmldomattachedinfo.cpp.

References it, QQmlJS::Dom::MainRegion, Q_ASSERT, region(), and regions.

Referenced by addRegion(), QQmlJS::Dom::CommentCollector::collectComments(), findUsagesOfNonJSIdentifiers(), locationFromDomItem(), region(), and QQmlJS::Dom::ErrorMessage::withItem().

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

◆ treeOf()

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

Returns the tree corresponding to a DomItem.

Definition at line 91 of file qqmldomattachedinfo.cpp.

References findAttachedInfo(), and item.

Referenced by fileLocationsOf(), QQmlLSUtils::findDefinitionOf(), findMethodDefinitionOf(), findPropertyDefinitionOf(), findUsagesHelper(), findUsagesOfNonJSIdentifiers(), locationFromDomItem(), HighlightingVisitor::operator()(), and QQmlJS::Dom::ErrorMessage::withItem().

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

◆ updateFullLocation()

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

Definition at line 107 of file qqmldomattachedinfo.cpp.

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

Referenced by addRegion(), and 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 274 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths().

◆ kindValue

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

Definition at line 248 of file qqmldomattachedinfo_p.h.

◆ postCommentLocations

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

Definition at line 277 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths().

◆ preCommentLocations

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

Definition at line 276 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths().

◆ regions

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

Definition at line 275 of file qqmldomattachedinfo_p.h.

Referenced by iterateDirectSubpaths(), and region().


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