Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmlJS::Dom::Path Class Reference

#include <qqmldompath_p.h>

Collaboration diagram for QQmlJS::Dom::Path:

Public Types

using Kind = PathEls::Kind
using Component = PathEls::PathComponent
using difference_type = long
using value_type = Path
using pointer = const Component*
using reference = const Path&
using iterator_category = std::forward_iterator_tag

Public Member Functions

 Path ()=default
 Path (const PathEls::PathComponent &c)
int length () const
Path operator[] (int i) const
 operator bool () const
PathIterator begin () const
PathIterator end () const
PathRoot headRoot () const
PathCurrent headCurrent () const
Kind headKind () const
QString headName () const
bool checkHeadName (QStringView name) const
index_type headIndex (index_type defaultValue=-1) const
std::function< bool(const DomItem &)> headFilter () const
Path head () const
Path last () const
Source split () const
 Splits the path at the last field, root or current Component.
void dump (const Sink &sink) const
QString toString () const
Path dropFront (int n=1) const
Path dropTail (int n=1) const
Path mid (int offset, int length) const
Path mid (int offset) const
Path withComponent (const PathEls::PathComponent &c)
Path withEmpty () const
Path withField (const QString &name) const
Path withField (QStringView name) const
Path withKey (const QString &name) const
Path withKey (QStringView name) const
Path withIndex (index_type i) const
Path withAny () const
Path withFilter (const std::function< bool(const DomItem &)> &, const QString &) const
Path withFilter (const std::function< bool(const DomItem &)> &, QStringView desc=u"<native code filter>") const
Path withCurrent (PathCurrent s) const
Path withCurrent (const QString &s) const
Path withCurrent (QStringView s=u"") const
Path withPath (const Path &toAdd, bool avoidToAddAsBase=false) const
 Returns a copy of this with toAdd appended to it.
Path expandFront () const
 Expand a path prefix hidden by slicing.
Path expandBack () const
 Expand a path suffix hidden by slicing.
Pathoperator++ ()
Path operator++ (int)

Static Public Member Functions

static ErrorGroups myErrors ()
static Path fromString (const QString &s, const ErrorHandler &errorHandler=nullptr)
static Path fromString (QStringView s, const ErrorHandler &errorHandler=nullptr)
static Path fromRoot (PathRoot r)
static Path fromRoot (QStringView s=u"")
static Path fromRoot (const QString &s)
static Path fromIndex (index_type i)
static Path fromField (QStringView s=u"")
static Path fromField (const QString &s)
static Path fromKey (QStringView s=u"")
static Path fromKey (const QString &s)
static Path fromCurrent (PathCurrent c)
static Path fromCurrent (QStringView s=u"")
static Path fromCurrent (const QString &s)
static int cmp (const Path &p1, const Path &p2)

Friends

class QQmlJS::Dom::PathEls::TestPaths
class FieldFilter
size_t qHash (const Path &path, size_t seed)

Detailed Description

Definition at line 593 of file qqmldompath_p.h.

Member Typedef Documentation

◆ Component

◆ difference_type

Definition at line 670 of file qqmldompath_p.h.

◆ iterator_category

using QQmlJS::Dom::Path::iterator_category = std::forward_iterator_tag

Definition at line 674 of file qqmldompath_p.h.

◆ Kind

Definition at line 597 of file qqmldompath_p.h.

◆ pointer

Definition at line 672 of file qqmldompath_p.h.

◆ reference

Definition at line 673 of file qqmldompath_p.h.

◆ value_type

Definition at line 671 of file qqmldompath_p.h.

Constructor & Destructor Documentation

◆ Path() [1/2]

◆ Path() [2/2]

QQmlJS::Dom::Path::Path ( const PathEls::PathComponent & c)
inlineexplicit

Definition at line 602 of file qqmldompath_p.h.

References withComponent().

Referenced by withComponent().

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

Member Function Documentation

◆ begin()

PathIterator QQmlJS::Dom::Path::begin ( ) const

Definition at line 316 of file qqmldompath.cpp.

◆ checkHeadName()

bool QQmlJS::Dom::Path::checkHeadName ( QStringView name) const

Definition at line 354 of file qqmldompath.cpp.

◆ cmp()

int QQmlJS::Dom::Path::cmp ( const Path & p1,
const Path & p2 )
static

Definition at line 921 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::PathComponent::cmp().

Referenced by QQmlJS::Dom::ErrorMessage::compare, QQmlJS::Dom::operator!=(), QQmlJS::Dom::operator<(), QQmlJS::Dom::operator<=(), QQmlJS::Dom::operator==(), QQmlJS::Dom::operator>(), and QQmlJS::Dom::operator>=().

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

◆ dropFront()

Path QQmlJS::Dom::Path::dropFront ( int n = 1) const

Definition at line 1054 of file qqmldompath.cpp.

References Path().

Referenced by QQmlJS::Dom::FileLocations::find().

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

◆ dropTail()

Path QQmlJS::Dom::Path::dropTail ( int n = 1) const

Definition at line 1061 of file qqmldompath.cpp.

References Path().

Referenced by QQmlJS::Dom::DomItem::goUp(), QQmlJS::Dom::DomItem::isCanonicalChild(), QQmlJS::Dom::DomItem::visitScopeChain(), and QQmlJS::Dom::DomItem::visitUp().

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

◆ dump()

void QQmlJS::Dom::Path::dump ( const Sink & sink) const

Definition at line 1031 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::Current, QQmlJS::Dom::PathEls::PathComponent::hasSquareBrackets(), QQmlJS::Dom::PathEls::PathComponent::kind(), and QQmlJS::Dom::PathEls::Root.

Here is the call graph for this function:

◆ end()

PathIterator QQmlJS::Dom::Path::end ( ) const

Definition at line 321 of file qqmldompath.cpp.

◆ expandBack()

Path QQmlJS::Dom::Path::expandBack ( ) const

Expand a path suffix hidden by slicing.

This sets m_endOffset to 0.

For example, for a path \badcode c -> d when encoded as a -> b -> c -> d -> e -> f -> g, m_endOffset = 3, m_length = 2 expandBack() will return \badcode c -> d -> e -> f -> g when encoded as a -> b -> c -> d -> e -> f -> g, m_endOffset = 0, m_length = 5

Definition at line 899 of file qqmldompath.cpp.

Referenced by withPath().

Here is the caller graph for this function:

◆ expandFront()

Path QQmlJS::Dom::Path::expandFront ( ) const

Expand a path prefix hidden by slicing.

This sets m_length to the maximum length this path can have.

For example, for a path \badcode b -> c -> d when encoded as a -> b -> c -> d -> e -> f, m_endOffset = 2, m_length = 3 expandFront() will return \badcode a -> b -> c -> d when encoded as a -> b -> c -> d -> e -> f, m_endOffset = 2, m_length = 4

Definition at line 872 of file qqmldompath.cpp.

Referenced by withPath().

Here is the caller graph for this function:

◆ fromCurrent() [1/3]

Path QQmlJS::Dom::Path::fromCurrent ( const QString & s)
static

Definition at line 678 of file qqmldompath.cpp.

◆ fromCurrent() [2/3]

Path QQmlJS::Dom::Path::fromCurrent ( PathCurrent c)
static

Definition at line 672 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::Current::Current(), and QQmlJS::Dom::PathEls::PathComponent::PathComponent().

Referenced by QQmlJS::Dom::ModuleScope::iterateDirectSubpaths(), QQmlJS::Dom::Paths::lookupCppTypePath(), QQmlJS::Dom::Paths::lookupPropertyPath(), QQmlJS::Dom::Paths::lookupSymbolPath(), and QQmlJS::Dom::Paths::lookupTypePath().

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

◆ fromCurrent() [3/3]

Path QQmlJS::Dom::Path::fromCurrent ( QStringView s = u"")
static

Definition at line 684 of file qqmldompath.cpp.

◆ fromField() [1/2]

Path QQmlJS::Dom::Path::fromField ( const QString & s)
static

Definition at line 651 of file qqmldompath.cpp.

◆ fromField() [2/2]

Path QQmlJS::Dom::Path::fromField ( QStringView s = u"")
static

Definition at line 645 of file qqmldompath.cpp.

◆ fromIndex()

Path QQmlJS::Dom::Path::fromIndex ( index_type i)
static

Definition at line 632 of file qqmldompath.cpp.

◆ fromKey() [1/2]

Path QQmlJS::Dom::Path::fromKey ( const QString & s)
static

Definition at line 665 of file qqmldompath.cpp.

◆ fromKey() [2/2]

Path QQmlJS::Dom::Path::fromKey ( QStringView s = u"")
static

Definition at line 657 of file qqmldompath.cpp.

◆ fromRoot() [1/3]

Path QQmlJS::Dom::Path::fromRoot ( const QString & s)
static

Definition at line 626 of file qqmldompath.cpp.

◆ fromRoot() [2/3]

Path QQmlJS::Dom::Path::fromRoot ( PathRoot r)
static

◆ fromRoot() [3/3]

Path QQmlJS::Dom::Path::fromRoot ( QStringView s = u"")
static

Definition at line 638 of file qqmldompath.cpp.

◆ fromString() [1/2]

Path QQmlJS::Dom::Path::fromString ( const QString & s,
const ErrorHandler & errorHandler = nullptr )
static

Definition at line 1082 of file qqmldompath.cpp.

◆ fromString() [2/2]

Path QQmlJS::Dom::Path::fromString ( QStringView s,
const ErrorHandler & errorHandler = nullptr )
static

◆ head()

Path QQmlJS::Dom::Path::head ( ) const

Definition at line 373 of file qqmldompath.cpp.

References mid().

Referenced by QQmlJS::Dom::FileLocations::find().

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

◆ headCurrent()

PathCurrent QQmlJS::Dom::Path::headCurrent ( ) const

Definition at line 334 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::PathComponent::asCurrent(), QQmlJS::Dom::PathEls::Current::contextKind, and QQmlJS::Dom::Other.

Referenced by QQmlJS::Dom::DomItem::resolve().

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

◆ headFilter()

function< bool(const DomItem &)> QQmlJS::Dom::Path::headFilter ( ) const

Definition at line 364 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::PathComponent::asFilter().

Referenced by QQmlJS::Dom::DomItem::resolve().

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

◆ headIndex()

index_type QQmlJS::Dom::Path::headIndex ( index_type defaultValue = -1) const

Definition at line 359 of file qqmldompath.cpp.

◆ headKind()

Path::Kind QQmlJS::Dom::Path::headKind ( ) const

Definition at line 342 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::Empty, and QQmlJS::Dom::PathEls::PathComponent::kind().

Referenced by QQmlJS::Dom::DomItem::canonicalPath(), qHash, and QQmlJS::Dom::DomItem::resolve().

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

◆ headName()

QString QQmlJS::Dom::Path::headName ( ) const

Definition at line 349 of file qqmldompath.cpp.

◆ headRoot()

PathRoot QQmlJS::Dom::Path::headRoot ( ) const

Definition at line 326 of file qqmldompath.cpp.

References QQmlJS::Dom::PathEls::PathComponent::asRoot(), QQmlJS::Dom::PathEls::Root::contextKind, and QQmlJS::Dom::Other.

Referenced by QQmlJS::Dom::DomItem::resolve().

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

◆ last()

Path QQmlJS::Dom::Path::last ( ) const

Definition at line 378 of file qqmldompath.cpp.

Referenced by QQmlJS::Dom::QmlObject::addBinding(), QQmlJS::Dom::QmlObject::addMethod(), QQmlJS::Dom::QmlObject::addPropertyDef(), QQmlJS::Dom::QmlObject::orderOfAttributes(), QQmlJS::Dom::FileLocations::treeOf(), and QQmlJS::Dom::EnumItem::writeOut().

Here is the caller graph for this function:

◆ length()

int QQmlJS::Dom::Path::length ( ) const
inline

◆ mid() [1/2]

Path QQmlJS::Dom::Path::mid ( int offset) const

Definition at line 1077 of file qqmldompath.cpp.

Referenced by split().

Here is the caller graph for this function:

◆ mid() [2/2]

Path QQmlJS::Dom::Path::mid ( int offset,
int length ) const

Definition at line 1068 of file qqmldompath.cpp.

References Path().

Referenced by head(), QQmlJS::Dom::ExternalItemInfoBase::lastRevision(), QQmlJS::Dom::ExternalItemInfoBase::lastValidRevision(), operator[](), QQmlJS::Dom::DomItem::resolve(), split(), and withPath().

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

◆ myErrors()

ErrorGroups QQmlJS::Dom::Path::myErrors ( )
static

Definition at line 1025 of file qqmldompath.cpp.

Referenced by fromString().

Here is the caller graph for this function:

◆ operator bool()

QQmlJS::Dom::Path::operator bool ( ) const
explicit

Definition at line 311 of file qqmldompath.cpp.

References length().

Here is the call graph for this function:

◆ operator++() [1/2]

Path & QQmlJS::Dom::Path::operator++ ( )

Definition at line 906 of file qqmldompath.cpp.

◆ operator++() [2/2]

Path QQmlJS::Dom::Path::operator++ ( int )

Definition at line 913 of file qqmldompath.cpp.

◆ operator[]()

Path QQmlJS::Dom::Path::operator[] ( int i) const

Definition at line 306 of file qqmldompath.cpp.

References mid().

Referenced by qHash, QQmlJS::Dom::DomItem::resolve(), and QQmlJS::Dom::QmlComponent::subComponentsNames().

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

◆ split()

Source QQmlJS::Dom::Path::split ( ) const

Splits the path at the last field, root or current Component.

Definition at line 387 of file qqmldompath.cpp.

References Path(), QQmlJS::Dom::PathEls::Current, QQmlJS::Dom::PathEls::Field, QQmlJS::Dom::PathEls::PathComponent::kind(), length(), mid(), mid(), and QQmlJS::Dom::PathEls::Root.

Referenced by QQmlJS::Dom::DomItem::container(), QQmlJS::Dom::DomBase::containingObject(), and QQmlJS::Dom::OwningItem::containingObject().

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

◆ toString()

QString QQmlJS::Dom::Path::toString ( ) const

Definition at line 1045 of file qqmldompath.cpp.

◆ withAny()

Path QQmlJS::Dom::Path::withAny ( ) const

Definition at line 734 of file qqmldompath.cpp.

References withAny().

Referenced by withAny().

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

◆ withComponent()

Path QQmlJS::Dom::Path::withComponent ( const PathEls::PathComponent & c)

◆ withCurrent() [1/3]

Path QQmlJS::Dom::Path::withCurrent ( const QString & s) const

Definition at line 763 of file qqmldompath.cpp.

References withCurrent().

Here is the call graph for this function:

◆ withCurrent() [2/3]

Path QQmlJS::Dom::Path::withCurrent ( PathCurrent s) const

Definition at line 757 of file qqmldompath.cpp.

Referenced by withCurrent(), and withCurrent().

Here is the caller graph for this function:

◆ withCurrent() [3/3]

Path QQmlJS::Dom::Path::withCurrent ( QStringView s = u"") const

Definition at line 770 of file qqmldompath.cpp.

References withCurrent().

Here is the call graph for this function:

◆ withEmpty()

Path QQmlJS::Dom::Path::withEmpty ( ) const

Definition at line 690 of file qqmldompath.cpp.

References withEmpty().

Referenced by withEmpty().

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

◆ withField() [1/2]

Path QQmlJS::Dom::Path::withField ( const QString & name) const

Definition at line 698 of file qqmldompath.cpp.

◆ withField() [2/2]

Path QQmlJS::Dom::Path::withField ( QStringView name) const

Definition at line 705 of file qqmldompath.cpp.

◆ withFilter() [1/2]

Path QQmlJS::Dom::Path::withFilter ( const std::function< bool(const DomItem &)> & ,
const QString &  ) const

◆ withFilter() [2/2]

Path QQmlJS::Dom::Path::withFilter ( const std::function< bool(const DomItem &)> & ,
QStringView desc = u"<native code filter>" ) const

◆ withIndex()

Path QQmlJS::Dom::Path::withIndex ( index_type i) const

Definition at line 726 of file qqmldompath.cpp.

◆ withKey() [1/2]

Path QQmlJS::Dom::Path::withKey ( const QString & name) const

Definition at line 713 of file qqmldompath.cpp.

◆ withKey() [2/2]

Path QQmlJS::Dom::Path::withKey ( QStringView name) const

Definition at line 721 of file qqmldompath.cpp.

◆ withPath()

Path QQmlJS::Dom::Path::withPath ( const Path & toAdd,
bool avoidToAddAsBase = false ) const

Returns a copy of this with toAdd appended to it.

Compresses toAdd into one vector of components before adding it to this.

Definition at line 819 of file qqmldompath.cpp.

References expandBack(), expandFront(), length(), mid(), QQmlJS::Dom::operator==(), and withPath().

Referenced by QQmlJS::Dom::AstRangesVisitor::addItemRanges(), QQmlJS::Dom::ModuleScope::canonicalPath(), QQmlJS::Dom::FileLocations::treeOf(), and withPath().

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

◆ FieldFilter

friend class FieldFilter
friend

Definition at line 683 of file qqmldompath_p.h.

◆ qHash

size_t qHash ( const Path & path,
size_t seed )
friend

Definition at line 734 of file qqmldompath_p.h.

References headKind(), length(), and operator[]().

◆ QQmlJS::Dom::PathEls::TestPaths

friend class QQmlJS::Dom::PathEls::TestPaths
friend

Definition at line 682 of file qqmldompath_p.h.


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