From 4615415500bfa816b6010cfd47162899dd72c682 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 30 Oct 2018 14:01:00 +0100 Subject: 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 --- src/corelib/tools/qscopeguard.qdoc | 30 +++++++++++++++++++++--------- 1 file 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 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 const QScopeGuard 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 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 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 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 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 */ -- cgit v1.2.3