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>
This commit is contained in:
parent
46a595b047
commit
4615415500
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user