1
2
3
4
5
6 #ifndef SNGCM_AST_CONSTANT_INCLUDED
7 #define SNGCM_AST_CONSTANT_INCLUDED
8 #include <sngcm/ast/Node.hpp>
9 #include <sngcm/ast/Specifier.hpp>
10
11 namespace sngcm { namespace ast {
12
13 class IdentifierNode;
14
15 class ConstantNode : public Node
16 {
17 public:
18 ConstantNode(const Span& span_, const boost::uuids::uuid& moduleId_);
19 ConstantNode(const Span& span_, const boost::uuids::uuid& moduleId_, Specifiers specifiers_, Node* typeExpr_, IdentifierNode* id_, Node* value_);
20 Node* Clone(CloneContext& cloneContext) const override;
21 void Accept(Visitor& visitor) override;
22 void Write(AstWriter& writer) override;
23 void Read(AstReader& reader) override;
24 Specifiers GetSpecifiers() const override { return specifiers; }
25 const Node* TypeExpr() const { return typeExpr.get(); }
26 Node* TypeExpr() { return typeExpr.get(); }
27 const IdentifierNode* Id() const { return id.get(); }
28 IdentifierNode* Id() { return id.get(); }
29 const Node* Value() const { return value.get(); }
30 Node* Value() { return value.get(); }
31 void SetStrValue(const std::u32string& strValue_) { strValue = strValue_; }
32 const std::u32string& StrValue() const { return strValue; }
33 private:
34 Specifiers specifiers;
35 std::unique_ptr<Node> typeExpr;
36 std::unique_ptr<IdentifierNode> id;
37 std::unique_ptr<Node> value;
38 std::u32string strValue;
39 };
40
41 } }
42
43 #endif // SNGCM_AST_CONSTANT_INCLUDED