1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef VARIABLENODE_H |
5 | #define VARIABLENODE_H |
6 | |
7 | #include "aggregate.h" |
8 | #include "node.h" |
9 | |
10 | #include <QtCore/qglobal.h> |
11 | #include <QtCore/qstring.h> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class VariableNode : public Node |
16 | { |
17 | public: |
18 | VariableNode(Aggregate *parent, const QString &name); |
19 | |
20 | void setLeftType(const QString &leftType) { m_leftType = leftType; } |
21 | void setRightType(const QString &rightType) { m_rightType = rightType; } |
22 | void setStatic(bool b) { m_static = b; } |
23 | |
24 | [[nodiscard]] const QString &leftType() const { return m_leftType; } |
25 | [[nodiscard]] const QString &rightType() const { return m_rightType; } |
26 | [[nodiscard]] QString dataType() const { return m_leftType + m_rightType; } |
27 | [[nodiscard]] bool isStatic() const override { return m_static; } |
28 | Node *clone(Aggregate *parent) override; |
29 | |
30 | private: |
31 | QString m_leftType {}; |
32 | QString m_rightType {}; |
33 | bool m_static { false }; |
34 | }; |
35 | |
36 | inline VariableNode::VariableNode(Aggregate *parent, const QString &name) |
37 | : Node(Variable, parent, name) |
38 | { |
39 | setGenus(Node::CPP); |
40 | } |
41 | |
42 | QT_END_NAMESPACE |
43 | |
44 | #endif // VARIABLENODE_H |
45 |