Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sérgio Martins <sergio.martins@kdab.com> |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the documentation of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:FDL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Free Documentation License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Free |
19 | ** Documentation License version 1.3 as published by the Free Software |
20 | ** Foundation and appearing in the file included in the packaging of |
21 | ** this file. Please review the following information to ensure |
22 | ** the GNU Free Documentation License version 1.3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/fdl-1.3.html. |
24 | ** $QT_END_LICENSE$ |
25 | ** |
26 | ****************************************************************************/ |
27 | |
28 | #include "qscopeguard.h" |
29 | |
30 | QT_BEGIN_NAMESPACE |
31 | |
32 | /*! |
33 | \class QScopeGuard |
34 | \since 5.12 |
35 | \inmodule QtCore |
36 | \brief Provides a scope guard for calling a function at the end of |
37 | a scope. |
38 | */ |
39 | |
40 | /*! \fn template <typename F> void QScopeGuard<F>::dismiss() |
41 | |
42 | Disarms the scope guard, so that the function \e F will not be called at |
43 | the end of the scope. |
44 | */ |
45 | |
46 | /*! |
47 | \fn template <typename F> const QScopeGuard<F> qScopeGuard(F f) |
48 | \inmodule QtCore |
49 | \relates QScopeGuard |
50 | \brief The qScopeGuard function can be used to call a function at the end |
51 | of the scope. |
52 | \ingroup misc |
53 | |
54 | QScopeGuard<F> is a class which sole purpose is to run a function \e F in |
55 | its destructor. This is useful for guaranteeing your cleanup code is |
56 | executed, whether the function is exited normally, exited early by a return |
57 | statement, or exited by an exception. |
58 | |
59 | If \e F is a lambda then you cannot instantiate the template directly, |
60 | therefore the qScopeGuard() helper is provided and QScopeGuard<F> is made a |
61 | private implementation detail. |
62 | |
63 | Example usage is as follows: |
64 | |
65 | \snippet code/src_corelib_tools_qscopeguard.cpp 0 |
66 | |
67 | \note Exceptions are not supported. The callable shouldn't throw when |
68 | executed, copied or moved. |
69 | |
70 | \sa QScopedValueRollback |
71 | */ |
72 | |
73 | QT_END_NAMESPACE |
74 |
Warning: That file was not part of the compilation database. It may have many parsing errors.