1 | // Copyright (C) 2014 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_QBACKENDNODE_H |
5 | #define QT3DCORE_QBACKENDNODE_H |
6 | |
7 | #include <Qt3DCore/qnodeid.h> |
8 | #include <Qt3DCore/qt3dcore_global.h> |
9 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | namespace Qt3DCore { |
13 | |
14 | class QNode; |
15 | class QBackendNodePrivate; |
16 | class QBackendNode; |
17 | class QAspectEngine; |
18 | |
19 | #if defined(QT_BUILD_INTERNAL) |
20 | class QBackendNodeTester; |
21 | #endif |
22 | |
23 | class Q_3DCORESHARED_EXPORT QBackendNodeMapper |
24 | { |
25 | public: |
26 | virtual ~QBackendNodeMapper(); |
27 | virtual QBackendNode *create(QNodeId id) const = 0; |
28 | virtual QBackendNode *get(QNodeId id) const = 0; |
29 | virtual void destroy(QNodeId id) const = 0; |
30 | }; |
31 | |
32 | typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr; |
33 | |
34 | class Q_3DCORESHARED_EXPORT QBackendNode |
35 | { |
36 | public: |
37 | enum Mode { |
38 | ReadOnly = 0, |
39 | ReadWrite |
40 | }; |
41 | |
42 | explicit QBackendNode(Mode mode = ReadOnly); |
43 | virtual ~QBackendNode(); |
44 | |
45 | QNodeId peerId() const noexcept; |
46 | |
47 | void setEnabled(bool enabled) noexcept; |
48 | bool isEnabled() const noexcept; |
49 | |
50 | Mode mode() const noexcept; |
51 | |
52 | virtual void syncFromFrontEnd(const QNode *frontEnd, bool firstTime); |
53 | |
54 | protected: |
55 | Q_DECLARE_PRIVATE(QBackendNode) |
56 | explicit QBackendNode(QBackendNodePrivate &dd); |
57 | |
58 | QBackendNodePrivate *d_ptr; |
59 | |
60 | private: |
61 | Q_DISABLE_COPY(QBackendNode) |
62 | void setPeerId(QNodeId id) noexcept; |
63 | |
64 | friend class QAbstractAspectPrivate; |
65 | #if defined(QT_BUILD_INTERNAL) |
66 | friend class QBackendNodeTester; |
67 | #endif |
68 | }; |
69 | |
70 | } // namespace Qt3DCore |
71 | |
72 | QT_END_NAMESPACE |
73 | |
74 | #endif // QT3DCORE_QBACKENDNODE_H |
75 |