Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQmlJSUtils Struct Reference

#include <qqmljsutils_p.h>

+ Collaboration diagram for QQmlJSUtils:

Classes

struct  AliasResolutionVisitor
 
struct  ResolvedAlias
 

Public Types

enum  PropertyAccessor { PropertyAccessor_Read , PropertyAccessor_Write }
 
enum  ResolvedAliasTarget { AliasTarget_Invalid , AliasTarget_Property , AliasTarget_Object }
 

Static Public Member Functions

static QString escapeString (QString s)
 
static QString toLiteral (const QString &s, QStringView ctor=u"QStringLiteral")
 
static QString constRefify (QString type)
 
static std::optional< QStringsignalName (QStringView handlerName)
 
static std::optional< QQmlJSMetaPropertychangeHandlerProperty (const QQmlJSScope::ConstPtr &scope, QStringView signalName)
 
static bool hasCompositeBase (const QQmlJSScope::ConstPtr &scope)
 
static bool bindablePropertyHasDefaultAccessor (const QQmlJSMetaProperty &p, PropertyAccessor accessor)
 
static ResolvedAlias resolveAlias (const QQmlJSTypeResolver *typeResolver, const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &owner, const AliasResolutionVisitor &visitor)
 
static ResolvedAlias resolveAlias (const QQmlJSScopesById &idScopes, const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &owner, const AliasResolutionVisitor &visitor)
 
template<typename QQmlJSScopePtr , typename Action >
static bool searchBaseAndExtensionTypes (QQmlJSScopePtr type, const Action &check)
 
template<typename Action >
static void traverseFollowingQmlIrObjectStructure (const QQmlJSScope::Ptr &root, Action act)
 
template<typename Action >
static void traverseFollowingMetaObjectHierarchy (const QQmlJSScope::ConstPtr &scope, const QQmlJSScope::ConstPtr &start, Action act)
 
static std::optional< QQmlJSFixSuggestiondidYouMean (const QString &userInput, QStringList candidates, QQmlJS::SourceLocation location)
 
static std::variant< QString, QQmlJS::DiagnosticMessagesourceDirectoryPath (const QQmlJSImporter *importer, const QString &buildDirectoryPath)
 

Detailed Description

Definition at line 67 of file qqmljsutils_p.h.

Member Enumeration Documentation

◆ PropertyAccessor

Enumerator
PropertyAccessor_Read 
PropertyAccessor_Write 

Definition at line 147 of file qqmljsutils_p.h.

◆ ResolvedAliasTarget

Enumerator
AliasTarget_Invalid 
AliasTarget_Property 
AliasTarget_Object 

Definition at line 174 of file qqmljsutils_p.h.

Member Function Documentation

◆ bindablePropertyHasDefaultAccessor()

static bool QQmlJSUtils::bindablePropertyHasDefaultAccessor ( const QQmlJSMetaProperty p,
PropertyAccessor  accessor 
)
inlinestatic

Returns true if p is bindable and property accessor specified by accessor is equal to "default". Returns false otherwise.

Note
This function follows BINDABLE-only properties logic (e.g. in moc)

Definition at line 158 of file qqmljsutils_p.h.

◆ changeHandlerProperty()

static std::optional< QQmlJSMetaProperty > QQmlJSUtils::changeHandlerProperty ( const QQmlJSScope::ConstPtr scope,
QStringView  signalName 
)
inlinestatic

Definition at line 123 of file qqmljsutils_p.h.

References QQmlJSMetaProperty::bindable(), QStringView::chop(), QStringView::endsWith(), QString::isEmpty(), QQmlJSScope::property(), and QStringView::toString().

Referenced by QQmlJSImportVisitor::visit().

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

◆ constRefify()

static QString QQmlJSUtils::constRefify ( QString  type)
inlinestatic

Returns type string conditionally wrapped into {const} and {&}. This function is mostly useful for code generators.

Definition at line 95 of file qqmljsutils_p.h.

◆ didYouMean()

std::optional< QQmlJSFixSuggestion > QQmlJSUtils::didYouMean ( const QString userInput,
QStringList  candidates,
QQmlJS::SourceLocation  location 
)
static

Definition at line 100 of file qqmljsutils.cpp.

References i, j, QString::size(), v0, and v1.

Referenced by QQmlJSImportVisitor::breakInheritanceCycles(), QQmlJSTypePropagator::checkForEnumProblems(), QQmlJSTypePropagator::generate_CallProperty(), and QQmlJSImportVisitor::processPropertyBindings().

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

◆ escapeString()

static QString QQmlJSUtils::escapeString ( QString  s)
inlinestatic

Returns escaped version of s. This function is mostly useful for code generators.

Definition at line 73 of file qqmljsutils_p.h.

◆ hasCompositeBase()

static bool QQmlJSUtils::hasCompositeBase ( const QQmlJSScope::ConstPtr scope)
inlinestatic

Definition at line 137 of file qqmljsutils_p.h.

References base, QQmlJSScope::baseType(), and QQmlSA::QMLScope.

+ Here is the call graph for this function:

◆ resolveAlias() [1/2]

QQmlJSUtils::ResolvedAlias QQmlJSUtils::resolveAlias ( const QQmlJSScopesById idScopes,
const QQmlJSMetaProperty property,
const QQmlJSScope::ConstPtr owner,
const AliasResolutionVisitor visitor 
)
static

Definition at line 88 of file qqmljsutils.cpp.

References property, and QQmlJSScopesById::scope().

+ Here is the call graph for this function:

◆ resolveAlias() [2/2]

QQmlJSUtils::ResolvedAlias QQmlJSUtils::resolveAlias ( const QQmlJSTypeResolver typeResolver,
const QQmlJSMetaProperty property,
const QQmlJSScope::ConstPtr owner,
const AliasResolutionVisitor visitor 
)
static

Definition at line 76 of file qqmljsutils.cpp.

References property, and QQmlJSTypeResolver::scopeForId().

+ Here is the call graph for this function:

◆ searchBaseAndExtensionTypes()

◆ signalName()

static std::optional< QString > QQmlJSUtils::signalName ( QStringView  handlerName)
inlinestatic

Returns a signal name from handlerName string.

Definition at line 105 of file qqmljsutils_p.h.

References ch, i, QStringView::mid(), signal, QStringView::size(), QStringView::startsWith(), and QStringView::toString().

Referenced by QQmlJSImportVisitor::visit().

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

◆ sourceDirectoryPath()

std::variant< QString, QQmlJS::DiagnosticMessage > QQmlJSUtils::sourceDirectoryPath ( const QQmlJSImporter importer,
const QString buildDirectoryPath 
)
static

Returns a corresponding source directory path for buildDirectoryPath Returns empty string on error

Definition at line 164 of file qqmljsutils.cpp.

References arg, QQmlJSResourceFileMapper::Directory, QQmlJSResourceFileMapper::entry(), QQmlJSResourceFileMapper::filePaths(), QQmlJSImporter::metaDataMapper(), QString::number(), QString::prepend(), QStringLiteral, QtWarningMsg, QQmlJSResourceFileMapper::Recurse, QString::remove(), QQmlJSResourceFileMapper::resourceFileFilter(), QQmlJSImporter::resourceFileMapper(), and QString::startsWith().

+ Here is the call graph for this function:

◆ toLiteral()

static QString QQmlJSUtils::toLiteral ( const QString s,
QStringView  ctor = u"QStringLiteral" 
)
inlinestatic

Returns s wrapped into a literal macro specified by ctor. By default, returns a QStringLiteral-wrapped literal. This function is mostly useful for code generators.

Note
This function escapes s before wrapping it.

Definition at line 86 of file qqmljsutils_p.h.

Referenced by QQmlJSCodeGenerator::convertStored(), QQmlJSCodeGenerator::generate_GetLookup(), and QQmlJSCodeGenerator::generate_LoadRuntimeString().

+ Here is the caller graph for this function:

◆ traverseFollowingMetaObjectHierarchy()

template<typename Action >
static void QQmlJSUtils::traverseFollowingMetaObjectHierarchy ( const QQmlJSScope::ConstPtr scope,
const QQmlJSScope::ConstPtr start,
Action  act 
)
inlinestatic

Traverses the base types and extensions of scope in the order aligned with QMetaObjects created at run time for these types and extensions (except that QQmlVMEMetaObject is ignored). start is the starting type in the hierarchy where act is applied.

Note
To call act for every type in the hierarchy, use scope->extensionType().scope as start

Definition at line 299 of file qqmljsutils_p.h.

References QList< T >::append(), begin(), QQmlJSScope::NotExtension, and QList< T >::size().

+ Here is the call graph for this function:

◆ traverseFollowingQmlIrObjectStructure()

template<typename Action >
static void QQmlJSUtils::traverseFollowingQmlIrObjectStructure ( const QQmlJSScope::Ptr root,
Action  act 
)
inlinestatic

Definition at line 267 of file qqmljsutils_p.h.

References QList< T >::append(), QQmlJSScope::childScopes(), QQmlJSScope::isArrayScope(), QList< T >::isEmpty(), QStack< T >::pop(), and QStack< T >::push().

Referenced by QQmlJSImportVisitor::populateRuntimeFunctionIndicesForDocument().

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

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