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
4
#
ifndef
QSCOPEDVALUEROLLBACK_H
5
#
define
QSCOPEDVALUEROLLBACK_H
6
7
#
include
<
QtCore
/
qglobal
.
h
>
8
9
#
include
<
QtCore
/
q20utility
.
h
>
10
11
QT_BEGIN_NAMESPACE
12
13
template
<
typename
T>
14
class
QScopedValueRollback
15
{
16
public
:
17
Q_NODISCARD_CTOR
18
explicit
constexpr
QScopedValueRollback(T &var)
19
: varRef(var), oldValue(var)
20
{
21
}
22
23
Q_NODISCARD_CTOR
24
explicit
constexpr
QScopedValueRollback(T &var, T value)
25
: varRef(var), oldValue(q20::exchange(var, std::move(value)))
26
{
27
}
28
29
Q_DECL_CONSTEXPR_DTOR
30
~QScopedValueRollback()
31
{
32
varRef = std::move(oldValue);
33
}
34
35
constexpr
void
commit()
36
{
37
oldValue = varRef;
38
}
39
40
private
:
41
T &varRef;
42
T oldValue;
43
44
Q_DISABLE_COPY_MOVE(QScopedValueRollback)
45
};
46
47
QT_END_NAMESPACE
48
49
#
endif
// QSCOPEDVALUEROLLBACK_H
QProcessEnvironmentPrivate
Definition
qprocess_p.h:104
QProcessEnvironmentPrivate::insert
void insert(const QProcessEnvironmentPrivate &other)
Definition
qprocess.cpp:99
QProcessEnvironmentPrivate::keys
QStringList keys() const
Definition
qprocess.cpp:88
QProcessEnvironment
\inmodule QtCore
Definition
qprocess.h:32
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
__has_include
#define __has_include(x)
Definition
qcompilerdetection.h:445
comparesEqual
bool comparesEqual(const QFileInfo &lhs, const QFileInfo &rhs)
Definition
qfileinfo.cpp:450
qtbase
src
corelib
tools
qscopedvaluerollback.h
Generated on Sun Mar 9 2025 00:39:11 for Qt by
1.13.2