summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qsharedpointer.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2025-01-16 16:31:12 +0100
committerMarc Mutz <marc.mutz@qt.io>2025-01-30 14:33:19 +0000
commit8511149d886e5aef2a065efffc336c7b25e6540e (patch)
tree1b65b9e46ca0f063fe1d8bdb01fc0829569603a0 /src/corelib/tools/qsharedpointer.cpp
parent2ef55de1029281d997a99c67764c239daadf6e08 (diff)
QSharedPointer: document rvalue overloads of various cast methods
The patch provides two documentation snippets: for an arbitrary arg and for \c {*this}. That is because qdoc does not support passing a command (e.g. \c) as a part of the snippet's parameter. Amends e95fb04202b3f786037c10942fd4e912644fd7d2. Found in Qt 6.9 API review. Pick-to: 6.9 Change-Id: I4eed234d18e39f2fc0c30a647a423f3240e31d40 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/tools/qsharedpointer.cpp')
-rw-r--r--src/corelib/tools/qsharedpointer.cpp108
1 files changed, 104 insertions, 4 deletions
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index e19ccca0069..767b7191a17 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -595,8 +595,24 @@
\sa isNull()
*/
+/*
+//! [cast-overload-for-this]
+ The returned QSharedPointer shares ownership with the same set of
+ shared owners as \c {*this}.
+
+ This function \l {reset()}{resets} \c {*this} to \nullptr on success.
+//! [cast-overload-for-this]
+
+//! [cast-overload-for-arg]
+ The returned QSharedPointer shares ownership with the same set of
+ shared owners as \a {\1}.
+
+ This function \l {reset()}{resets} \a {\1} to \nullptr on success.
+//! [cast-overload-for-arg]
+*/
+
/*!
- \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::staticCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::staticCast() const &
Performs a static cast from this pointer's type to \tt X and returns
a QSharedPointer that shares the reference. This function can be
@@ -611,7 +627,17 @@
*/
/*!
- \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::dynamicCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::staticCast() &&
+ \since 6.9
+ \overload staticCast()
+
+ \include qsharedpointer.cpp {cast-overload-for-this}
+
+ \sa dynamicCast(), constCast(), qSharedPointerCast()
+*/
+
+/*!
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::dynamicCast() const &
Performs a dynamic cast from this pointer's type to \tt X and
returns a QSharedPointer that shares the reference. If this
@@ -628,7 +654,17 @@
*/
/*!
- \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::constCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::dynamicCast() &&
+ \since 6.9
+ \overload dynamicCast()
+
+ \include qsharedpointer.cpp {cast-overload-for-this}
+
+ \sa qSharedPointerDynamicCast()
+*/
+
+/*!
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::constCast() const &
Performs a \tt const_cast from this pointer's type to \tt X and returns
a QSharedPointer that shares the reference. This function can be
@@ -639,7 +675,17 @@
*/
/*!
- \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::objectCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::constCast() &&
+ \since 6.9
+ \overload constCast()
+
+ \include qsharedpointer.cpp {cast-overload-for-this}
+
+ \sa isNull(), qSharedPointerConstCast()
+*/
+
+/*!
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::objectCast() const &
\since 4.6
Performs a \l qobject_cast() from this pointer's type to \tt X and
@@ -657,6 +703,16 @@
*/
/*!
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::objectCast() &&
+ \since 6.9
+ \overload objectCast()
+
+ \include qsharedpointer.cpp {cast-overload-for-this}
+
+ \sa qSharedPointerObjectCast()
+*/
+
+/*!
\fn template <class T> template <typename... Args> QSharedPointer<T> QSharedPointer<T>::create(Args &&... args)
\overload
\since 5.1
@@ -1195,6 +1251,17 @@
*/
/*!
+ \fn template <class X, class T> QSharedPointer<X> qSharedPointerCast(QSharedPointer<T> &&other)
+ \relates QSharedPointer
+ \since 6.9
+ \overload qSharedPointerCast(const QSharedPointer<T> &other)
+
+ \include qsharedpointer.cpp {cast-overload-for-arg} {other}
+
+ \sa QSharedPointer::staticCast(), qSharedPointerDynamicCast(), qSharedPointerConstCast()
+*/
+
+/*!
\fn template <class X, class T> QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &other)
\relates QSharedPointer
\relates QWeakPointer
@@ -1232,6 +1299,17 @@
*/
/*!
+ \fn template <class X, class T> QSharedPointer<X> qSharedPointerDynamicCast(QSharedPointer<T> &&src)
+ \relates QSharedPointer
+ \since 6.9
+ \overload qSharedPointerDynamicCast(const QSharedPointer<T> &src)
+
+ \include qsharedpointer.cpp {cast-overload-for-arg} {src}
+
+ \sa QSharedPointer::dynamicCast(), qSharedPointerCast(), qSharedPointerConstCast()
+*/
+
+/*!
\fn template <class X, class T> QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer<T> &src)
\relates QSharedPointer
\relates QWeakPointer
@@ -1266,6 +1344,17 @@
*/
/*!
+ \fn template <class X, class T> QSharedPointer<X> qSharedPointerConstCast(QSharedPointer<T> &&src)
+ \relates QSharedPointer
+ \since 6.9
+ \overload qSharedPointerConstCast(const QSharedPointer<T> &src)
+
+ \include qsharedpointer.cpp {cast-overload-for-arg} {src}
+
+ \sa QSharedPointer::constCast(), qSharedPointerCast(), qSharedPointerDynamicCast()
+*/
+
+/*!
\fn template <class X, class T> QSharedPointer<X> qSharedPointerConstCast(const QWeakPointer<T> &src)
\relates QSharedPointer
\relates QWeakPointer
@@ -1303,6 +1392,17 @@
*/
/*!
+ \fn template <class X, class T> QSharedPointer<X> qSharedPointerObjectCast(QSharedPointer<T> &&src)
+ \relates QSharedPointer
+ \since 6.9
+ \overload qSharedPointerObjectCast(const QSharedPointer<T> &src)
+
+ \include qsharedpointer.cpp {cast-overload-for-arg} {src}
+
+ \sa QSharedPointer::objectCast(), qSharedPointerCast(), qSharedPointerConstCast()
+*/
+
+/*!
\fn template <class X, class T> std::shared_ptr<X> qSharedPointerObjectCast(const std::shared_ptr<T> &src)
\relates QSharedPointer
\since 5.14