top | up | prev | next

EnumConstantNode Class

Definition at line 46 of Enumeration.hpp

Constructors

EnumConstantNode(const Span& span_)
EnumConstantNode(const Span& span_, IdentifierNode* id_, Node* value_)

Member Functions

void Accept(Visitor& visitor) override
Node* Clone(CloneContext& cloneContext) const override
Node* GetValue() const
bool HasValue() const
IdentifierNode* Id() const
void Read(AstReader& reader) override
void SetHasValue()
void SetStrValue(const std::u32string& strValue_)
const std::u32string& StrValue() const
void Write(AstWriter& writer) override

Member Variables

bool hasValue
std::unique_ptr<IdentifierNode> id
std::u32string strValue
std::unique_ptr<Node> value

Constructor Details

EnumConstantNode Constructor

sngcm::ast::EnumConstantNode::EnumConstantNode(const Span& span_)

Definition at line 96 of Enumeration.cpp :
 96 : Node(NodeType::enumConstantNodespan_)hasValue(false)
 97 {
 98 }


Declaration at line 49 of Enumeration.hpp


EnumConstantNode Constructor

sngcm::ast::EnumConstantNode::EnumConstantNode(const Span& span_, IdentifierNode * id_, Node * value_)

Definition at line 100 of Enumeration.cpp :
100 : Node(NodeType::enumConstantNodespan_)id(id_)value(value_)hasValue(false)
101 {
102     id->SetParent(this);
103     if (value)
104     {
105         value->SetParent(this);
106     }
107 }


Declaration at line 50 of Enumeration.hpp


Member Function Details

Accept Member Function

void sngcm::ast::EnumConstantNode::Accept(Visitor & visitor) override

Definition at line 119 of Enumeration.cpp :
120 {
121     visitor.Visit(*this);
122 }


Declaration at line 52 of Enumeration.hpp

Base class overridden functions: sngcm::ast::Node::Accept

Calls: sngcm::ast::Visitor::Visit


Clone Member Function

Node * sngcm::ast::EnumConstantNode::Clone(CloneContext & cloneContext) const override

Definition at line 109 of Enumeration.cpp :
110 {
111     EnumConstantNode* clone = new EnumConstantNode(GetSpan()static_cast<IdentifierNode*>(id->Clone(cloneContext))value->Clone(cloneContext));
112     if (hasValue)
113     {
114         clone->SetHasValue();
115     }
116     return clone;
117 }


Declaration at line 51 of Enumeration.hpp

Base class overridden functions: sngcm::ast::Node::Clone

Calls: sngcm::ast::EnumConstantNode::Clone , sngcm::ast::EnumConstantNode::SetHasValue , sngcm::ast::Node::GetSpan

Called by: sngcm::ast::EnumConstantNode::Clone


GetValue Member Function

Node * sngcm::ast::EnumConstantNode::GetValue() const

Definition at line 55 of Enumeration.hpp :
55 { return value.get(); }

Called by: sngcm::ast::SourceWriter::Visit


HasValue Member Function

bool sngcm::ast::EnumConstantNode::HasValue() const

Definition at line 58 of Enumeration.hpp :
58 { return hasValue; }

Called by: sngcm::ast::SourceWriter::Visit


Id Member Function

IdentifierNode * sngcm::ast::EnumConstantNode::Id() const

Definition at line 56 of Enumeration.hpp :
56 { return id.get(); }

Called by: sngcm::ast::SourceWriter::Visit


Read Member Function

void sngcm::ast::EnumConstantNode::Read(AstReader & reader) override

Definition at line 133 of Enumeration.cpp :
134 {
135     Node::Read(reader);
136     id.reset(reader.ReadIdentifierNode());
137     id->SetParent(this);
138     value.reset(reader.ReadNode());
139     value->SetParent(this);
140     hasValue = reader.GetBinaryReader().ReadBool();
141     strValue = reader.GetBinaryReader().ReadUtf32String();
142 }


Declaration at line 54 of Enumeration.hpp

Base class overridden functions: sngcm::ast::Node::Read

Calls: sngcm::ast::AstReader::GetBinaryReader , sngcm::ast::AstReader::ReadIdentifierNode , sngcm::ast::AstReader::ReadNode , sngcm::ast::Node::Read , sngcm::ast::Node::SetParent , soulng::util::BinaryReader::ReadBool , soulng::util::BinaryReader::ReadUtf32String


SetHasValue Member Function

void sngcm::ast::EnumConstantNode::SetHasValue()

Definition at line 57 of Enumeration.hpp :
57 { hasValue = true; }

Called by: sngcm::ast::EnumConstantNode::Clone


SetStrValue Member Function

void sngcm::ast::EnumConstantNode::SetStrValue(const std::u32string& strValue_)

Definition at line 59 of Enumeration.hpp :
59 { strValue = strValue_; }


StrValue Member Function

const std::u32string& sngcm::ast::EnumConstantNode::StrValue() const

Definition at line 60 of Enumeration.hpp :
60 { return strValue; }


Write Member Function

void sngcm::ast::EnumConstantNode::Write(AstWriter & writer) override

Definition at line 124 of Enumeration.cpp :
125 {
126     Node::Write(writer);
127     writer.Write(id.get());
128     writer.Write(value.get());
129     writer.GetBinaryWriter().Write(hasValue);
130     writer.GetBinaryWriter().Write(strValue);
131 }


Declaration at line 53 of Enumeration.hpp

Base class overridden functions: sngcm::ast::Node::Write

Calls: sngcm::ast::AstWriter::GetBinaryWriter , sngcm::ast::Node::Write , soulng::util::BinaryWriter::Write , soulng::util::BinaryWriter::Write


top | up | prev | next