summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qscopeguard.qdoc
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2018-10-30 14:01:00 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2018-11-06 12:44:28 +0000
commit4615415500bfa816b6010cfd47162899dd72c682 (patch)
treed3194c567850fc590b04411180722d9eeff37a9f /src/corelib/tools/qscopeguard.qdoc
parent46a595b047a928b1a5d527065c6814ef05e3a97b (diff)
Doc: Tie the QScopeGuard documentation to a class
Previously no documentation was generated for the global qScopeGuard() function. Create a class documentation page and add the the function as a related non-member using \relates. Task-number: QTBUG-71502 Change-Id: Ida5d7044f4de962360dfee9321feb49005d4b299 Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/corelib/tools/qscopeguard.qdoc')
-rw-r--r--src/corelib/tools/qscopeguard.qdoc30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc
index 7cbc3e9c7b..70e13ab2fd 100644
--- a/src/corelib/tools/qscopeguard.qdoc
+++ b/src/corelib/tools/qscopeguard.qdoc
@@ -30,24 +30,36 @@
QT_BEGIN_NAMESPACE
/*!
- \fn const QScopeGuard<F> qScopeGuard(F f)
- \inmodule QtCore
- \brief The qScopeGuard function can be used to call a function at the end of the scope.
+ \class QScopeGuard
\since 5.12
+ \inmodule QtCore
+ \brief Provides a scope guard for calling a function at the of
+ a scope.
+*/
+
+/*!
+ \fn template <typename F> const QScopeGuard<F> qScopeGuard(F f)
+ \inmodule QtCore
+ \relates QScopeGuard
+ \brief The qScopeGuard function can be used to call a function at the end
+ of the scope.
\ingroup misc
- QScopeGuard<F> is a class which sole purpose is to run a function F in its destructor.
- This is useful for guaranteeing your cleanup code is executed whether the function is exited normally,
- exited early by a return statement, or exited by an exception.
+ QScopeGuard<F> is a class which sole purpose is to run a function \e F in
+ its destructor. This is useful for guaranteeing your cleanup code is
+ executed, whether the function is exited normally, exited early by a return
+ statement, or exited by an exception.
- If F is a lambda then you cannot instantiate the template directly, therefore the qScopeGuard() helper
- is provided and QScopeGuard<F> is made a private implementation detail.
+ If \e F is a lambda then you cannot instantiate the template directly,
+ therefore the qScopeGuard() helper is provided and QScopeGuard<F> is made a
+ private implementation detail.
Example usage is as follows:
\snippet code/src_corelib_tools_qscopeguard.cpp 0
- \note Exceptions are not supported. The callable shouldn't throw when executed, copied or moved.
+ \note Exceptions are not supported. The callable shouldn't throw when
+ executed, copied or moved.
\sa QScopedValueRollback
*/