Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qrecursionwatcher_p.h
Go to the documentation of this file.
1
// Copyright (C) 2018 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
4
5
#
ifndef
QRECURSIONWATCHER_P_H
6
#
define
QRECURSIONWATCHER_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
<
QtCore
/
private
/
qglobal_p
.
h
>
20
21
QT_BEGIN_NAMESPACE
22
23
class
QRecursionNode;
24
class
QRecursionNode
{
25
public
:
26
inline
QRecursionNode
();
27
bool
*
_r
;
28
};
29
30
template
<
class
T,
QRecursionNode
T::*Node>
31
class
QRecursionWatcher
{
32
public
:
33
inline
QRecursionWatcher
(T *);
34
inline
~
QRecursionWatcher
();
35
inline
bool
hasRecursed
()
const
;
36
private
:
37
T *_t;
38
bool
_r;
39
};
40
41
QRecursionNode
::
QRecursionNode
()
42
:
_r
(
nullptr
)
43
{
44
}
45
46
template
<
class
T, QRecursionNode T::*Node>
47
QRecursionWatcher<T, Node>::QRecursionWatcher(T *t)
48
: _t(t), _r(
false
)
49
{
50
if
((_t->*Node)._r) *(_t->*Node)._r =
true
;
51
(_t->*Node)._r = &_r;
52
}
53
54
template
<
class
T, QRecursionNode T::*Node>
55
QRecursionWatcher<T, Node>::~QRecursionWatcher()
56
{
57
if
((_t->*Node)._r == &_r) (_t->*Node)._r =
nullptr
;
58
}
59
60
template
<
class
T, QRecursionNode T::*Node>
61
bool
QRecursionWatcher<T, Node>::hasRecursed()
const
62
{
63
return
_r;
64
}
65
66
QT_END_NAMESPACE
67
68
#
endif
// QRECURSIONWATCHER_P_H
QRecursionNode
Definition
qrecursionwatcher_p.h:24
QRecursionNode::QRecursionNode
QRecursionNode()
Definition
qrecursionwatcher_p.h:41
QRecursionNode::_r
bool * _r
Definition
qrecursionwatcher_p.h:27
QRecursionWatcher
Definition
qrecursionwatcher_p.h:31
QRecursionWatcher::QRecursionWatcher
QRecursionWatcher(T *)
Definition
qrecursionwatcher_p.h:47
QRecursionWatcher::hasRecursed
bool hasRecursed() const
Definition
qrecursionwatcher_p.h:61
QRecursionWatcher::~QRecursionWatcher
~QRecursionWatcher()
Definition
qrecursionwatcher_p.h:55
qtdeclarative
src
qml
qml
ftw
qrecursionwatcher_p.h
Generated on
for Qt by
1.18.0