1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
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 QT3DCORE_QIDTYPEVISITOR_H |
5 | #define QT3DCORE_QIDTYPEVISITOR_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DCore/private/qentity_p.h> |
19 | #include <Qt3DCore/private/qnodevisitor_p.h> |
20 | |
21 | QT_BEGIN_NAMESPACE |
22 | |
23 | namespace Qt3DCore { |
24 | |
25 | class QDestructionIdAndTypeCollector |
26 | { |
27 | public: |
28 | QDestructionIdAndTypeCollector(QNode *rootNode); |
29 | |
30 | QList<QNodeIdTypePair> subtreeIdsAndTypes() const { return m_subtreeIdsAndTypes; } |
31 | |
32 | private: |
33 | void collectIdAndType(QNode *node) |
34 | { |
35 | QNodeIdTypePair idAndType(node->id(), QNodePrivate::get(q: node)->m_typeInfo); |
36 | m_subtreeIdsAndTypes.push_back(t: idAndType); |
37 | |
38 | // Mark this node as having been handled for destruction so we don't |
39 | // repeat it unnecessarily in an O(n^2) manner |
40 | QNodePrivate::get(q: node)->m_hasBackendNode = false; |
41 | } |
42 | |
43 | QList<QNodeIdTypePair> m_subtreeIdsAndTypes; |
44 | }; |
45 | |
46 | } // namespace Qt3DCore |
47 | |
48 | QT_END_NAMESPACE |
49 | |
50 | #endif // QT3DCORE_QIDTYPEVISITOR_H |
51 | |