aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmlsasourcelocation.cpp
diff options
context:
space:
mode:
authorOlivier De Cannière <olivier.decanniere@qt.io>2025-02-25 14:28:40 +0100
committerOlivier De Cannière <olivier.decanniere@qt.io>2025-02-28 20:11:31 +0100
commitd08f9c1b785645f2c0e66f95476348cb71cfdc86 (patch)
treea09e0635656865ed643a3f81772ec9925843414c /src/qmlcompiler/qqmlsasourcelocation.cpp
parentab72fde37ce25f37411b4b5ed3e2971633a77010 (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>
Diffstat (limited to 'src/qmlcompiler/qqmlsasourcelocation.cpp')
-rw-r--r--src/qmlcompiler/qqmlsasourcelocation.cpp46
1 files changed, 46 insertions, 0 deletions
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);