Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qscopedvaluerollback.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QSCOPEDVALUEROLLBACK_H
6
#
define
QSCOPEDVALUEROLLBACK_H
7
8
#
include
<
QtCore
/
qglobal
.
h
>
9
10
#
include
<
QtCore
/
q20utility
.
h
>
11
12
QT_BEGIN_NAMESPACE
13
14
template
<
typename
T>
15
class
QScopedValueRollback
16
{
17
public
:
18
Q_NODISCARD_CTOR
19
explicit
constexpr
QScopedValueRollback(T &var)
20
: varRef(var), oldValue(var)
21
{
22
}
23
24
Q_NODISCARD_CTOR
25
explicit
constexpr
QScopedValueRollback(T &var, T value)
26
: varRef(var), oldValue(q20::exchange(var, std::move(value)))
27
{
28
}
29
30
Q_DECL_CONSTEXPR_DTOR
31
~QScopedValueRollback()
32
{
33
varRef = std::move(oldValue);
34
}
35
36
constexpr
void
commit()
37
{
38
oldValue = varRef;
39
}
40
41
private
:
42
T &varRef;
43
T oldValue;
44
45
Q_DISABLE_COPY_MOVE(QScopedValueRollback)
46
};
47
48
QT_END_NAMESPACE
49
50
#
endif
// QSCOPEDVALUEROLLBACK_H
QProcessEnvironmentPrivate
Definition
qprocess_p.h:105
QProcessEnvironmentPrivate::insert
void insert(const QProcessEnvironmentPrivate &other)
Definition
qprocess.cpp:100
QProcessEnvironmentPrivate::keys
QStringList keys() const
Definition
qprocess.cpp:89
QProcessEnvironment
\inmodule QtCore
Definition
qprocess.h:33
QProcess
Definition
qprocess.h:290
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
__has_include
#define __has_include(x)
Definition
qcompilerdetection.h:458
comparesEqual
bool comparesEqual(const QFileInfo &lhs, const QFileInfo &rhs)
Definition
qfileinfo.cpp:451
QProcessEnvironmentPrivate::OrderedMutexLocker
Definition
qprocess_p.h:143
qtbase
src
corelib
tools
qscopedvaluerollback.h
Generated on
for Qt by
1.16.1