top | up | prev | next

EnumConstantNode Class

Definition at line 46 of Enumeration.hpp

Constructors

EnumConstantNode(const Span& span_, const boost::uuids::uuid& moduleId_)
EnumConstantNode(const Span& span_, const boost::uuids::uuid& moduleId_, 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_, const boost::uuids::uuid& moduleId_)

Definition at line 98 of Enumeration.cpp :
 98 :
 99 Node(NodeType::enumConstantNodespan_moduleId_)hasValue(false)
100 {
101 }


Declaration at line 49 of Enumeration.hpp


EnumConstantNode Constructor

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

Definition at line 103 of Enumeration.cpp :
103 :
104 Node(NodeType::enumConstantNodespan_moduleId_)id(id_)value(value_)hasValue(false)
105 {
106     id->SetParent(this);
107     if (value)
108     {
109         value->SetParent(this);
110     }
111 }


Declaration at line 50 of Enumeration.hpp


Member Function Details

Accept Member Function

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

Definition at line 123 of Enumeration.cpp :
124 {
125     visitor.Visit(*this);
126 }


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 113 of Enumeration.cpp :
114 {
115     EnumConstantNode* clone = new EnumConstantNode(GetSpan()ModuleId()static_cast<IdentifierNode*>(id->Clone(cloneContext))value->Clone(cloneContext));
116     if (hasValue)
117     {
118         clone->SetHasValue();
119     }
120     return clone;
121 }


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 , sngcm::ast::Node::ModuleId

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 137 of Enumeration.cpp :
138 {
139     Node::Read(reader);
140     id.reset(reader.ReadIdentifierNode());
141     id->SetParent(this);
142     value.reset(reader.ReadNode());
143     value->SetParent(this);
144     hasValue = reader.GetBinaryReader().ReadBool();
145     strValue = reader.GetBinaryReader().ReadUtf32String();
146 }


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 128 of Enumeration.cpp :
129 {
130     Node::Write(writer);
131     writer.Write(id.get());
132     writer.Write(value.get());
133     writer.GetBinaryWriter().Write(hasValue);
134     writer.GetBinaryWriter().Write(strValue);
135 }


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