diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-02-25 14:28:40 +0100 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-02-28 20:11:31 +0100 |
| commit | d08f9c1b785645f2c0e66f95476348cb71cfdc86 (patch) | |
| tree | a09e0635656865ed643a3f81772ec9925843414c | |
| parent | ab72fde37ce25f37411b4b5ed3e2971633a77010 (diff) | |
Doc: Add more documentation for QQmlSA
Some documentation may not provide a lot of extra information but is
there mainly so that the function appears in the final documentation
and is discoverable by the user.
Fixes: QTBUG-116682
Pick-to: 6.9 6.8
Change-Id: I68e531663a25ea9aaba9dfd4ec0c8b842023f673
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
| -rw-r--r-- | src/qmlcompiler/qqmljsloggingutils.cpp | 10 | ||||
| -rw-r--r-- | src/qmlcompiler/qqmlsa.cpp | 362 | ||||
| -rw-r--r-- | src/qmlcompiler/qqmlsasourcelocation.cpp | 46 |
3 files changed, 410 insertions, 8 deletions
diff --git a/src/qmlcompiler/qqmljsloggingutils.cpp b/src/qmlcompiler/qqmljsloggingutils.cpp index 154fed130d..e265e8c2c3 100644 --- a/src/qmlcompiler/qqmljsloggingutils.cpp +++ b/src/qmlcompiler/qqmljsloggingutils.cpp @@ -135,6 +135,16 @@ LoggerCategoryPrivate *LoggerCategoryPrivate::get(LoggerCategory *loggerCategory warning categories in the \c{QQmlSA} framework. */ +/*! + \fn constexpr LoggerWarningId::LoggerWarningId(QAnyStringView name) + Constructs a LoggerWarningId object with logging catergory name \a name. + */ + +/*! + \fn QAnyStringView LoggerWarningId::name() const + Returns the name of the wrapped warning category. + */ + namespace LoggingUtils { QString levelToString(const QQmlJS::LoggerCategory &category) diff --git a/src/qmlcompiler/qqmlsa.cpp b/src/qmlcompiler/qqmlsa.cpp index b3c0a31e3b..ccf69f825d 100644 --- a/src/qmlcompiler/qqmlsa.cpp +++ b/src/qmlcompiler/qqmlsa.cpp @@ -32,21 +32,142 @@ static_assert(QQmlJSScope::sizeofQQmlSAElement() == sizeof(Element)); */ /*! + \enum QQmlSA::MethodType + \inmodule QtQmlCompiler + + \brief Describes the type of a \l{QQmlSA::Method}. + \value Signal The method is a signal + \value Slot The method is a slot + \value Method The method is a \l{Q_INVOKABLE} method + \value StaticMethod The method is a \l{Q_INVOKABLE} static method +*/ + +/*! + \enum QQmlSA::AccessSemantics + \inmodule QtQmlCompiler + + \brief Describes how a type is accessed and shared. + \value Reference The type behaves like an \l{QML Object Types}{Object type} + \value Value The type behaves like a \l{QML Value Types}{Value type} + \value None The type is a \l{QML Namespaces}{namespace}, or is invalid + \value Sequence The type behaves like a \l{QML Sequence Types}{Sequence type} + + \sa {The QML Type System} +*/ + +/*! + \enum QQmlSA::BindingType + \inmodule QtQmlCompiler + + \brief Describes the type of a \l{QQmlSA::Binding}. + \value Invalid There is no binding + \value BoolLiteral The binding is a bool literal + \value NumberLiteral The binding is a number literal + \value StringLiteral The binding is a string literal + \value RegExpLiteral The binding is a regular expression literal + \value Null The binding is a null literal + \value Translation The binding is a \l{Text ID based translations}{translation} + \value TranslationById The binding is a \l{Text ID based translations}{translation} by id + \value Script The binding is a regular script + \value Object The binging is an \l{QML Object Types}{Object} + \value Interceptor The binding is an interceptor that can intercept writes to properties such as \l{Behavior QML Type}{Behavior} + \value ValueSource The binging is a \l{Defining QML Types from C++#Property Value Sources}{property value source} + \value AttachedProperty The binding is an \l{QML Object Attributes#Attached Properties and Attached Signal Handlers}{attached object} + \value GroupProperty The binding is a \l{QML Object Attributes#Grouped Properties}{grouped property} +*/ + +/*! + \enum QQmlSA::ScriptBindingKind + \inmodule QtQmlCompiler + + \brief Describes the script type of a \l{QQmlSA::Binding} of type \l{Script}. + \value Invalid The binding has an invalid script + \value PropertyBinding The binding is bound to a property + \value SignalHandler The binding is a \l{Signal and Handler Event System#Receiving signals with signal handlers}{signal handler} + \value ChangeHandler The binding is a \l{Signal and Handler Event System#Property change signal handlers}{change handler} +*/ + +/*! + \enum QQmlSA::ScopeType + \brief Describes the type of QML scope. + \value JSFunctionScope The scope is a JavaScript function: + \badcode + Item { + function f() : int { <- begin + return 1 + } <- end + } + \endcode + \value JSLexicalScope The scope is a JavaScript lexical scope: + \badcode + property int i: { <- begin + let a = 1 + { <- begin + console.log("hello") + } <- end + return a + } <- end + \endcode + \value QMLScope The scope is a QML Object: + \badcode + Item { <- begin + x: 50 + } <- end + \endcode + \value GroupedPropertyScope The scope is a \l{QML Object Attributes#Grouped Properties}{grouped property}: + \badcode + Text { + font { <- begin + pixelSize: 12 + bold: true + } <- end + } + \endcode + \value AttachedPropertyScope The scope is an \l{QML Object Attributes#Attached Properties and Attached Signal Handlers}{attached property}: + \badcode + Item { + Component.onCompleted: console.log("Hello") + ^^^^^^^^^ + \ Scope of attached property Component + } + \endcode + \value EnumScope The scope is a QML \l{QML Enumerations}{enum}: + \badcode + enum E { <- begin + A, + B, + C + } <- end + \endcode + + Each entry is shown with an example scope of the matching type in QML code. +*/ + +/*! \class QQmlSA::Binding::Bindings \inmodule QtQmlCompiler \brief Holds multiple property name to property binding associations. */ +/*! + Constructs a new Bindings object. + */ Binding::Bindings::Bindings() : d_ptr{ new BindingsPrivate{ this } } { } BindingsPrivate::BindingsPrivate(QQmlSA::Binding::Bindings *interface) : q_ptr{ interface } { } +/*! + Creates a copy of \a other. + */ Binding::Bindings::Bindings(const Bindings &other) : d_ptr{ new BindingsPrivate{ this, *other.d_func() } } { } +/*! + Destroys the Bindings object. + */ Binding::Bindings::~Bindings() = default; BindingsPrivate::BindingsPrivate(QQmlSA::Binding::Bindings *interface, const BindingsPrivate &other) @@ -68,6 +189,11 @@ QMultiHash<QString, Binding>::const_iterator Binding::Bindings::constBegin() con return d->constBegin(); } +/*! + \fn QMultiHash<QString, Binding>::const_iterator Binding::Bindings::begin() const + Same as constBegin(). + */ + QMultiHash<QString, Binding>::const_iterator BindingsPrivate::constBegin() const { return m_bindings.constBegin(); @@ -82,6 +208,11 @@ QMultiHash<QString, Binding>::const_iterator Binding::Bindings::constEnd() const return d->constEnd(); } +/*! + \fn QMultiHash<QString, Binding>::const_iterator Binding::Bindings::end() const + Same as constEnd(). + */ + QMultiHash<QString, Binding>::const_iterator BindingsPrivate::constEnd() const { return m_bindings.constEnd(); @@ -94,15 +225,28 @@ QMultiHash<QString, Binding>::const_iterator BindingsPrivate::constEnd() const \brief Represents a single QML property binding for a specific type. */ +/*! + Constructs a new Binding object. + */ Binding::Binding() : d_ptr{ new BindingPrivate{ this } } { } BindingPrivate::BindingPrivate(Binding *interface) : q_ptr{ interface } { } +/*! + Creates a copy of \a other. +*/ Binding::Binding(const Binding &other) : d_ptr{ new BindingPrivate{ this, *other.d_func() } } { } +/*! + Move-constructs a \c Binding instance. +*/ Binding::Binding(Binding &&other) noexcept : d_ptr{ new BindingPrivate{ this, *other.d_func() } } { } + +/*! + Assigns \a other to this Binding instance. +*/ Binding &Binding::operator=(const Binding &other) { if (*this == other) @@ -113,6 +257,9 @@ Binding &Binding::operator=(const Binding &other) return *this; } +/*! + Move-assigns \a other to this Binding instance. +*/ Binding &Binding::operator=(Binding &&other) noexcept { if (*this == other) @@ -123,6 +270,9 @@ Binding &Binding::operator=(Binding &&other) noexcept return *this; } +/*! + Destroys the binding. +*/ Binding::~Binding() = default; bool Binding::operatorEqualsImpl(const Binding &lhs, const Binding &rhs) @@ -161,6 +311,9 @@ Element Binding::groupType() const return QQmlJSScope::createQQmlSAElement(BindingPrivate::binding(*this).groupType()); } +/*! + Returns the type of this binding. + */ QQmlSA::BindingType Binding::bindingType() const { return BindingPrivate::binding(*this).bindingType(); @@ -225,7 +378,7 @@ double Binding::numberValue() const /*! Returns the kind of the associated script if the content type of this - binding is Script, otherwise returns Script_Invalid. + binding is Script, otherwise returns Invalid. */ QQmlSA::ScriptBindingKind Binding::scriptKind() const { @@ -249,6 +402,11 @@ QQmlSA::Element Binding::objectType() const return QQmlJSScope::createQQmlSAElement(BindingPrivate::binding(*this).objectType()); } +/*! + Returns whether this binding has script value type undefined like when it + is assigned \c undefined. If the content type of this binding is not + \l{QQmlSA::BindingType::Script}, returns \c false. + */ bool Binding::hasUndefinedScriptValue() const { const auto &jsBinding = BindingPrivate::binding(*this); @@ -258,21 +416,42 @@ bool Binding::hasUndefinedScriptValue() const /*! Returns \c true if \a bindingType is a literal type, and \c false - otherwise. Literal types include strings, booleans, numbers, regular - expressions. + otherwise. */ bool QQmlSA::Binding::isLiteralBinding(QQmlSA::BindingType bindingType) { return QQmlJSMetaPropertyBinding::isLiteralBinding(bindingType); } +/*! + \fn friend bool Binding::operator==(const Binding &lhs, const Binding &rhs) + Returns \c true if \a lhs and \a rhs are equal, and \c false otherwise. Two + \c Bindings are considered equal if their property name, content type, and + source location match. + */ +/*! + \fn friend bool Binding::operator!=(const Binding &lhs, const Binding &rhs) + Returns \c true if \a lhs and \a rhs are not equal, and \c false otherwise. + Two \c Bindings are considered equal if their property name, content type, + and source location match. + */ + +/*! + Constructs a new Methods object. +*/ QQmlSA::Method::Methods::Methods() : d_ptr{ new MethodsPrivate{ this } } { } +/*! + Creates a copy of \a other. + */ QQmlSA::Method::Methods::Methods(const Methods &other) : d_ptr{ new MethodsPrivate{ this, *other.d_func() } } { } +/*! + Destroys the Methods instance. + */ QQmlSA::Method::Methods::~Methods() = default; /*! @@ -284,6 +463,11 @@ QMultiHash<QString, Method>::const_iterator Method::Methods::constBegin() const return d->constBegin(); } +/*! + \fn QMultiHash<QString, Method>::const_iterator Methods::begin() const + Returns an iterator to the beginning of the methods. + */ + QMultiHash<QString, Method>::const_iterator MethodsPrivate::constBegin() const { return m_methods.constBegin(); @@ -297,6 +481,12 @@ QMultiHash<QString, Method>::const_iterator Method::Methods::constEnd() const Q_D(const Methods); return d->constEnd(); } + +/*! + \fn QMultiHash<QString, Method>::const_iterator Methods::end() const + Returns an iterator to the end of the methods. + */ + QMultiHash<QString, Method>::const_iterator MethodsPrivate::constEnd() const { return m_methods.constEnd(); @@ -343,15 +533,27 @@ MethodType MethodPrivate::methodType() const \brief Represents a QML method. */ +/*! + Constructs a new Method object. + */ Method::Method() : d_ptr{ new MethodPrivate{ this } } { } +/*! + Creates a copy of \a other. + */ Method::Method(const Method &other) : d_ptr{ new MethodPrivate{ this, *other.d_func() } } { } +/*! + Move-constructs a Method instance. + */ Method::Method(Method &&other) noexcept : d_ptr{ new MethodPrivate{ this, std::move(*other.d_func()) } } { } +/*! + Assigns \a other to this Method instance. + */ Method &Method::operator=(const Method &other) { if (*this == other) @@ -362,6 +564,9 @@ Method &Method::operator=(const Method &other) return *this; } +/*! + Move-assigns \a other to this Method instance. + */ Method &Method::operator=(Method &&other) noexcept { if (*this == other) @@ -372,6 +577,9 @@ Method &Method::operator=(Method &&other) noexcept return *this; } +/*! + Destroys the Method. + */ Method::~Method() = default; /*! @@ -384,8 +592,7 @@ QString Method::methodName() const } /*! - Returns the type of this method. For example, Signal, Slot, Method or - StaticMethod. + Returns the type of this method. */ MethodType Method::methodType() const { @@ -394,6 +601,15 @@ MethodType Method::methodType() const } /*! + \fn friend bool Method::operator==(const Method &lhs, const Method &rhs) + Returns \c true if \a lhs and \a rhs are equal, and \c false otherwise. + */ +/*! + \fn friend bool Method::operator!=(const Method &lhs, const Method &rhs) + Returns \c true if \a lhs and \a rhs are not equal, and \c false otherwise. + */ + +/*! Returns the location in the QML code where this method is defined. */ QQmlSA::SourceLocation Method::sourceLocation() const @@ -493,16 +709,28 @@ QQmlSA::Property PropertyPrivate::createProperty(const QQmlJSMetaProperty &prope \brief Represents a QML property. */ +/*! + Constructs a new Property object. + */ Property::Property() : d_ptr{ new PropertyPrivate{ this } } { } +/*! + Creates a copy of \a other. + */ Property::Property(const Property &other) : d_ptr{ new PropertyPrivate{ this, *other.d_func() } } { } +/*! + Move-constructs a Property instance. + */ Property::Property(Property &&other) noexcept : d_ptr{ new PropertyPrivate{ this, std::move(*other.d_func()) } } { } +/*! + Assigns \a other to this Property instance. + */ Property &Property::operator=(const Property &other) { if (*this == other) @@ -513,6 +741,9 @@ Property &Property::operator=(const Property &other) return *this; } +/*! + Move-assigns \a other to this Property instance. + */ Property &Property::operator=(Property &&other) noexcept { if (*this == other) @@ -523,6 +754,9 @@ Property &Property::operator=(Property &&other) noexcept return *this; } +/*! + Destroys this property. + */ Property::~Property() = default; /*! @@ -534,24 +768,42 @@ QString Property::typeName() const return d->typeName(); } +/*! + Returns \c true if this property is valid, \c false otherwise. + */ bool Property::isValid() const { Q_D(const Property); return d->isValid(); } +/*! + Returns \c true if this property is read-only, \c false otherwise. + */ bool Property::isReadonly() const { Q_D(const Property); return d->isReadonly(); } +/*! + Returns the type of this property. +*/ QQmlSA::Element Property::type() const { Q_D(const Property); return d->type(); } +/*! + \fn friend bool Property::operator==(const Property &lhs, const Property &rhs) + Returns \c true if \a lhs and \a rhs are equal, and \c false otherwise. + */ +/*! + \fn friend bool Property::operator!=(const Property &lhs, const Property &rhs) + Returns \c true if \a lhs and \a rhs are not equal, and \c false otherwise. + */ + bool Property::operatorEqualsImpl(const Property &lhs, const Property &rhs) { @@ -565,16 +817,30 @@ bool Property::operatorEqualsImpl(const Property &lhs, const Property &rhs) \brief Represents a QML type. */ +/*! + Constructs a new Element object. + */ Element::Element() { new (m_data) QQmlJSScope::ConstPtr(); } +/*! + Creates a copy of \a other. + */ Element::Element(const Element &other) { new (m_data) QQmlJSScope::ConstPtr(QQmlJSScope::scope(other)); } +/*! + \fn Element::Element(Element &&other) noexcept + Move-constructs an Element instance. + */ + +/*! + Assigns \a other to this element instance. + */ Element &Element::operator=(const Element &other) { if (this == &other) @@ -584,6 +850,14 @@ Element &Element::operator=(const Element &other) return *this; } +/*! + \fn Element &Element::operator=(Element &&) noexpect; + Move-assigns \a other to this Element instance. + */ + +/*! + Destroys the element. + */ Element::~Element() { (*reinterpret_cast<QQmlJSScope::ConstPtr *>(m_data)).QQmlJSScope::ConstPtr::~ConstPtr(); @@ -637,6 +911,9 @@ bool Element::isFileRootComponent() const return QQmlJSScope::scope(*this)->isFileRootComponent(); } +/*! + Returns \c true if this element is null, \c false otherwise. + */ bool Element::isNull() const { return QQmlJSScope::scope(*this).isNull(); @@ -660,7 +937,7 @@ AccessSemantics Element::accessSemantics() const } /*! - Returns true for objects defined from Qml, and false for objects declared from C++. + Returns \c true for objects defined from Qml, and \c false for objects declared from C++. */ bool QQmlSA::Element::isComposite() const { @@ -838,11 +1115,17 @@ QQmlSA::Binding::Bindings BindingsPrivate::createBindings( return bindings; } +/*! + Returns \c true if this element is not null, \c false otherwise. + */ Element::operator bool() const { return bool(QQmlJSScope::scope(*this)); } +/*! + Returns \c true if this element is null, \c false otherwise. + */ bool Element::operator!() const { return !QQmlJSScope::scope(*this); @@ -858,11 +1141,25 @@ QString Element::name() const return QQmlJSScope::prettyName(QQmlJSScope::scope(*this)->internalName()); } +/*! + \fn friend inline bool Element::operator==(const Element &lhs, const Element &rhs) + Returns \c true if \a lhs and \a rhs are equal, and \c false otherwise. + */ +/*! + \fn friend inline bool Element::operator!=(const Element &lhs, const Element &rhs) + Returns \c true if \a lhs and \a rhs are not equal, and \c false otherwise. + */ + bool Element::operatorEqualsImpl(const Element &lhs, const Element &rhs) { return QQmlJSScope::scope(lhs) == QQmlJSScope::scope(rhs); } +/*! + \fn friend inline qsizetype Element::qHash(const Element &key, qsizetype seed) noexcept + Returns the hash for \a key using \a seed to seed the calculation. +*/ + qsizetype Element::qHashImpl(const Element &key, qsizetype seed) noexcept { return qHash(QQmlJSScope::scope(key), seed); @@ -896,8 +1193,6 @@ private: GenericPass *q_ptr = nullptr; }; -GenericPass::~GenericPass() = default; - /*! Creates a generic pass. */ @@ -905,6 +1200,11 @@ GenericPass::GenericPass(PassManager *manager) : d_ptr{ new GenericPassPrivate{ this, manager } } { } /*! + Destroys the GenericPass instance. + */ +GenericPass::~GenericPass() = default; + +/*! Emits a warning message \a diagnostic about an issue of type \a id. */ void GenericPass::emitWarning(QAnyStringView diagnostic, LoggerWarningId id) @@ -1397,6 +1697,16 @@ void DebugElementPass::run(const Element &element) { */ /*! + \fn LintPlugin::LintPlugin() + Constructs a LintPlugin object. + */ + +/*! + \fn virtual LintPlugin::~LintPlugin() + Destroys the LintPlugin instance. + */ + +/*! \fn void QQmlSA::LintPlugin::registerPasses(PassManager *manager, const Element &rootElement) Adds a pass \a manager that will be executed on \a rootElement. @@ -1452,6 +1762,11 @@ void DebugElementPass::run(const Element &element) { */ /*! + \fn ElementPass::ElementPass(PassManager *manager) + Creates an ElementPass object and uses \a manager to refer to the pass manager. +*/ + +/*! \fn void QQmlSA::ElementPass::run(const Element &element) Executes if \c shouldRun() returns \c true. Performs the real computation @@ -1481,7 +1796,11 @@ bool ElementPass::shouldRun(const Element &element) */ +/*! + Creates a PropertyPass object and uses \a manager to refer to the pass manager. + */ PropertyPass::PropertyPass(PassManager *manager) : GenericPass(manager) { } + /*! Executes whenever a property gets bound to a value. @@ -1718,22 +2037,34 @@ const QQmlJSFixSuggestion &FixSuggestionPrivate::fixSuggestion(const FixSuggesti */ +/*! + Creates a FixSuggestion object. + */ FixSuggestion::FixSuggestion(const QString &fixDescription, const QQmlSA::SourceLocation &location, const QString &replacement) : d_ptr{ new FixSuggestionPrivate{ this, fixDescription, location, replacement } } { } +/*! + Creates a copy of \a other. + */ FixSuggestion::FixSuggestion(const FixSuggestion &other) : d_ptr{ new FixSuggestionPrivate{ this, *other.d_func() } } { } +/*! + Move-constructs a FixSuggestion instance. + */ FixSuggestion::FixSuggestion(FixSuggestion &&other) noexcept : d_ptr{ new FixSuggestionPrivate{ this, std::move(*other.d_func()) } } { } +/*! + Assigns \a other to this FixSuggestion instance. + */ FixSuggestion &FixSuggestion::operator=(const FixSuggestion &other) { if (*this == other) @@ -1743,6 +2074,9 @@ FixSuggestion &FixSuggestion::operator=(const FixSuggestion &other) return *this; } +/*! + Move-assigns \a other to this FixSuggestion instance. + */ FixSuggestion &FixSuggestion::operator=(FixSuggestion &&other) noexcept { if (*this == other) @@ -1752,6 +2086,9 @@ FixSuggestion &FixSuggestion::operator=(FixSuggestion &&other) noexcept return *this; } +/*! + Destorys the FixSuggestion instance. + */ FixSuggestion::~FixSuggestion() = default; /*! @@ -1828,6 +2165,15 @@ bool QQmlSA::FixSuggestion::isAutoApplicable() const return FixSuggestionPrivate::fixSuggestion(*this).isAutoApplicable(); } +/*! + \fn friend bool FixSuggestion::operator==(const FixSuggestion &lhs, const FixSuggestion &rhs) + Returns \c true if \a lhs and \a rhs are equal, and \c false otherwise. + */ +/*! + \fn friend bool FixSuggestion::operator!=(const FixSuggestion &lhs, const FixSuggestion &rhs) + Returns \c true if \a lhs and \a rhs are not equal, and \c false otherwise. + */ + bool FixSuggestion::operatorEqualsImpl(const FixSuggestion &lhs, const FixSuggestion &rhs) { return lhs.d_func()->m_fixSuggestion == rhs.d_func()->m_fixSuggestion; diff --git a/src/qmlcompiler/qqmlsasourcelocation.cpp b/src/qmlcompiler/qqmlsasourcelocation.cpp index bc22d1b93a..021d2a0032 100644 --- a/src/qmlcompiler/qqmlsasourcelocation.cpp +++ b/src/qmlcompiler/qqmlsasourcelocation.cpp @@ -18,16 +18,45 @@ static_assert(SourceLocationPrivate::sizeOfSourceLocation() == sizeof(SourceLoca \brief Represents a location or region in the source code. */ + +/*! + Constructs a new SourceLocation with values given by \a offset, \a length, + \a line, and \a column. + */ QQmlSA::SourceLocation::SourceLocation(quint32 offset, quint32 length, quint32 line, quint32 column) { new (m_data) QQmlJS::SourceLocation{ offset, length, line, column }; } // explicitly defaulted out-of-line for PIMPL +/*! + Creates a copy of \a other. + */ QQmlSA::SourceLocation::SourceLocation(const SourceLocation &other) = default; + +/*! + \fn SourceLocation::SourceLocation(SourceLocation &&other) noexcept + Move-Constructs a SourceLocation from \a other. + */ + +/*! + Assigns \a other to this SourceLocation. + */ QQmlSA::SourceLocation & QQmlSA::SourceLocation::operator=(const QQmlSA::SourceLocation &other) = default; + +/*! + \fn SourceLocation &SourceLocation::operator=(SourceLocation &&other) noexcept + Move-assigns \a other to this SourceLocation. + */ + +/*! + Destructs this SourceLocation instance. + */ SourceLocation::~SourceLocation() = default; +/*! + Returns \c true is this SourceLocation is valid, \c false otherwise. + */ bool QQmlSA::SourceLocation::isValid() const { return QQmlSA::SourceLocationPrivate::sourceLocation(*this).isValid(); @@ -108,6 +137,23 @@ QQmlSA::SourceLocation QQmlSA::SourceLocation::endZeroLengthLocation(QStringView return saLocation; } +/*! + \fn friend qsizetype SourceLocation::qHash(const SourceLocation &location, qsizetype seed) + Returns the hash value for \a location, using \a seed to seed the calculation. + */ + +/*! + \fn friend bool SourceLocation::operator==(const SourceLocation &lhs, const SourceLocation &rhs) + Returns true if \a lhs equals \a rhs, and \c false otherwise. + Two SourceLocations are considered equal if they have the same values for + their offset, length, line, and column members. + */ +/*! + \fn friend bool SourceLocation::operator!=(const SourceLocation &lhs, const SourceLocation &rhs) + Returns true if \a lhs does not equal \a rhs, and \c false otherwise. + See \l {SourceLocation::operator==} for when two source locations are considered equal. + */ + qsizetype QQmlSA::SourceLocation::qHashImpl(const SourceLocation &location, qsizetype seed) { return qHash(QQmlSA::SourceLocationPrivate::sourceLocation(location), seed); |
