top | up | prev | next

AttributesNode Class

Definition at line 30 of Attribute.hpp

Constructors

AttributesNode(const AttributesNode&) delete
AttributesNode(const Span& span_, const boost::uuids::uuid& moduleId_)

Member Functions

void Accept(Visitor& visitor) override
void AddAttribute(AttributeNode* attribute)
void AddAttribute(const Span& span, const boost::uuids::uuid& moduleId, const std::u32string& name)
void AddAttribute(const Span& span, const boost::uuids::uuid& moduleId, const std::u32string& name, const std::u32string& value)
Node* Clone(CloneContext& cloneContext) const override
AttributeNode* GetAttribute(const std::u32string& name) const
const std::vector<std::unique_ptr<AttributeNode>>& GetAttributes() const
void Read(AstReader& reader) override
void Write(AstWriter& writer) override
AttributesNode& operator=(const AttributesNode&) delete

Member Variables

std::map<std::u32string, AttributeNode*> attributeMap
std::vector<std::unique_ptr<AttributeNode>> attributes

Constructor Details

AttributesNode Constructor

sngcm::ast::AttributesNode::AttributesNode(const AttributesNode &) delete

Definition at line 34 of Attribute.hpp


AttributesNode Constructor

sngcm::ast::AttributesNode::AttributesNode(const Span& span_, const boost::uuids::uuid& moduleId_)

Definition at line 49 of Attribute.cpp :
 49 : Node(NodeType::attributesNodespan_moduleId_)
 50 {
 51 }


Declaration at line 33 of Attribute.hpp


Member Function Details

Accept Member Function

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

Definition at line 95 of Attribute.cpp :
 96 {
 97     visitor.Visit(*this);
 98 }


Declaration at line 41 of Attribute.hpp

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

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

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


AddAttribute Member Function

void sngcm::ast::AttributesNode::AddAttribute(AttributeNode * attribute)

Definition at line 79 of Attribute.cpp :
 80 {
 81     attributes.push_back(std::unique_ptr<AttributeNode>(attribute));
 82     attributeMap[attribute->Name()] = attribute;
 83 }


Declaration at line 47 of Attribute.hpp

Calls: sngcm::ast::AttributeNode::Name

Called by: sngcm::ast::AttributesNode::AddAttribute , sngcm::ast::AttributesNode::Read


AddAttribute Member Function

void sngcm::ast::AttributesNode::AddAttribute(const Span& span, const boost::uuids::uuid& moduleId, const std::u32string& name)

Definition at line 63 of Attribute.cpp :
 64 {
 65     AddAttribute(spanmoduleIdnameU"true");
 66 }


Declaration at line 37 of Attribute.hpp

Calls: sngcm::ast::AttributesNode::AddAttribute


AddAttribute Member Function

void sngcm::ast::AttributesNode::AddAttribute(const Span& span, const boost::uuids::uuid& moduleId, const std::u32string& name, const std::u32string& value)

Definition at line 68 of Attribute.cpp :
 69 {
 70     AttributeNode* prev = GetAttribute(name);
 71     if (prev != nullptr)
 72     {
 73         throw AttributeNotUniqueException("attribute '" + ToUtf8(name) + "' not unique"spanmoduleIdprev->GetSpan()prev->ModuleId());
 74     }
 75     AttributeNode* attribute = new AttributeNode(spanmoduleIdnamevalue);
 76     AddAttribute(attribute);
 77 }


Declaration at line 38 of Attribute.hpp

Calls: sngcm::ast::AttributesNode::AddAttribute , sngcm::ast::AttributesNode::GetAttribute , sngcm::ast::Node::GetSpan , sngcm::ast::Node::ModuleId

Called by: sngcm::ast::AttributesNode::AddAttribute , sngcm::ast::AttributesNode::Clone


Clone Member Function

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

Definition at line 85 of Attribute.cpp :
 86 {
 87     std::unique_ptr<AttributesNode> clone(new AttributesNode(GetSpan()ModuleId()));
 88     for (const std::std::unique_ptr<AttributeNode>&attribute : attributes)
 89     {
 90         clone->AddAttribute(attribute->GetSpan()attribute->ModuleId()attribute->Name()attribute->Value());
 91     }
 92     return clone.release();
 93 }


Declaration at line 40 of Attribute.hpp

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

Calls: sngcm::ast::AttributesNode::AddAttribute , sngcm::ast::Node::GetSpan , sngcm::ast::Node::ModuleId


GetAttribute Member Function

AttributeNode * sngcm::ast::AttributesNode::GetAttribute(const std::u32string& name) const

Definition at line 53 of Attribute.cpp :
 54 {
 55     std::map<std::u32stringAttributeNode*>::const_iterator it = attributeMap.find(name);
 56     if (it != attributeMap.cend())
 57     {
 58         return it->second;
 59     }
 60     return nullptr;
 61 }


Declaration at line 39 of Attribute.hpp

Called by: sngcm::ast::AttributesNode::AddAttribute


GetAttributes Member Function

const std::vector<std::unique_ptr<AttributeNode >>& sngcm::ast::AttributesNode::GetAttributes() const

Definition at line 36 of Attribute.hpp :
36 { return attributes; }

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


Read Member Function

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

Definition at line 110 of Attribute.cpp :
111 {
112     Node::Read(reader);
113     uint32_t n = reader.GetBinaryReader().ReadULEB128UInt();
114     for (uint32_t i = 0u; i < n; ++i)
115     {
116         AttributeNode* attribute = reader.ReadAttributeNode();
117         AddAttribute(attribute);
118     }
119 }


Declaration at line 43 of Attribute.hpp

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

Calls: sngcm::ast::AstReader::GetBinaryReader , sngcm::ast::AstReader::ReadAttributeNode , sngcm::ast::AttributesNode::AddAttribute , sngcm::ast::Node::Read , soulng::util::BinaryReader::ReadULEB128UInt


Write Member Function

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

Definition at line 100 of Attribute.cpp :
101 {
102     Node::Write(writer);
103     writer.GetBinaryWriter().WriteULEB128UInt(static_cast<uint32_t>(attributes.size()));
104     for (const std::std::unique_ptr<AttributeNode>&attribute : attributes)
105     {
106         writer.Write(attribute.get());
107     }
108 }


Declaration at line 42 of Attribute.hpp

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

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


operator= Member Function

AttributesNode & sngcm::ast::AttributesNode::operator=(const AttributesNode &) delete

Definition at line 35 of Attribute.hpp


top | up | prev | next