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
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< QQmlJSMetaPropertychangeHandlerProperty (const QQmlJSScope::ConstPtr &scope, QStringView signalName)
 
static std::optional< QQmlJSMetaPropertypropertyFromChangedHandler (const QQmlJSScope::ConstPtr &scope, QStringView changedHandler)
 
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)
 
template<typename Container >
static void deduplicate (Container &container)
 

Detailed Description

Definition at line 68 of file qqmljsutils_p.h.

Member Enumeration Documentation

◆ PropertyAccessor

Enumerator
PropertyAccessor_Read 
PropertyAccessor_Write 

Definition at line 146 of file qqmljsutils_p.h.

◆ ResolvedAliasTarget

Enumerator
AliasTarget_Invalid 
AliasTarget_Property 
AliasTarget_Object 

Definition at line 173 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 157 of file qqmljsutils_p.h.

◆ changeHandlerProperty()

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

Definition at line 107 of file qqmljsutils_p.h.

References QQmlJSMetaProperty::bindable(), QString::isEmpty(), and QQmlJSScope::property().

+ Here is the call 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 99 of file qqmljsutils_p.h.

◆ deduplicate()

template<typename Container >
static void QQmlJSUtils::deduplicate ( Container & container)
inlinestatic

Definition at line 369 of file qqmljsutils_p.h.

References erase().

Referenced by QQmlJSBasicBlocks::run().

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

◆ didYouMean()

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

Definition at line 103 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 74 of file qqmljsutils_p.h.

◆ hasCompositeBase()

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

Definition at line 136 of file qqmljsutils_p.h.

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

+ Here is the call graph for this function:

◆ propertyFromChangedHandler()

static std::optional< QQmlJSMetaProperty > QQmlJSUtils::propertyFromChangedHandler ( const QQmlJSScope::ConstPtr & scope,
QStringView changedHandler )
inlinestatic

Definition at line 122 of file qqmljsutils_p.h.

References QQmlJSMetaProperty::bindable(), QQmlSignalNames::changedHandlerNameToPropertyName(), QString::isEmpty(), and QQmlJSScope::property().

Referenced by QQmlJSImportVisitor::visit().

+ Here is the call graph for this function:
+ Here is the caller 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 91 of file qqmljsutils.cpp.

References property.

◆ 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 QQmlJSRegisterContent::ObjectById, property, QQmlJSTypeResolver::scopedType(), QQmlJSRegisterContent::type(), and QQmlJSRegisterContent::variant().

+ Here is the call graph for this function:

◆ searchBaseAndExtensionTypes()

template<typename QQmlJSScopePtr , typename Action >
static bool QQmlJSUtils::searchBaseAndExtensionTypes ( QQmlJSScopePtr type,
const Action & check )
inlinestatic

◆ 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 167 of file qqmljsutils.cpp.

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

+ 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 90 of file qqmljsutils_p.h.

Referenced by QQmlJSCodeGenerator::convertStored(), QQmlJSCodeGenerator::generate_DefineObjectLiteral(), 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 298 of file qqmljsutils_p.h.

References begin(), and QQmlJSScope::NotExtension.

+ 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 266 of file qqmljsutils_p.h.

References QQmlJSScope::childScopes(), and QQmlJSScope::isArrayScope().

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: