| 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 "genustypes.h" |
| 9 | #include "node.h" |
| 10 | |
| 11 | #include <QtCore/qglobal.h> |
| 12 | #include <QtCore/qstring.h> |
| 13 | |
| 14 | QT_BEGIN_NAMESPACE |
| 15 | |
| 16 | class VariableNode : public Node |
| 17 | { |
| 18 | public: |
| 19 | VariableNode(Aggregate *parent, const QString &name); |
| 20 | |
| 21 | void setLeftType(const QString &leftType) { m_leftType = leftType; } |
| 22 | void setRightType(const QString &rightType) { m_rightType = rightType; } |
| 23 | void setStatic(bool b) { m_static = b; } |
| 24 | |
| 25 | [[nodiscard]] const QString &leftType() const { return m_leftType; } |
| 26 | [[nodiscard]] const QString &rightType() const { return m_rightType; } |
| 27 | [[nodiscard]] QString dataType() const { return m_leftType + m_rightType; } |
| 28 | [[nodiscard]] bool isStatic() const override { return m_static; } |
| 29 | Node *clone(Aggregate *parent) override; |
| 30 | |
| 31 | private: |
| 32 | QString m_leftType {}; |
| 33 | QString m_rightType {}; |
| 34 | bool m_static { false }; |
| 35 | }; |
| 36 | |
| 37 | inline VariableNode::VariableNode(Aggregate *parent, const QString &name) |
| 38 | : Node(NodeType::Variable, parent, name) |
| 39 | { |
| 40 | setGenus(Genus::CPP); |
| 41 | } |
| 42 | |
| 43 | QT_END_NAMESPACE |
| 44 | |
| 45 | #endif // VARIABLENODE_H |
| 46 |
