top | up | prev | next

Attributes Class

Definition at line 42 of Attribute.hpp

Constructors

Attributes()
Attributes(const Attributes&) delete

Member Functions

void Accept(Visitor& visitor)
void AddAttribute(Attribute* attribute)
void AddAttribute(const Span& span, const std::u32string& name)
void AddAttribute(const Span& span, const std::u32string& name, const std::u32string& value)
Attributes* Clone() const
Attribute* GetAttribute(const std::u32string& name) const
const std::vector<std::unique_ptr<Attribute>>& GetAttributes() const
void Read(AstReader& reader)
void Write(AstWriter& writer)
Attributes& operator=(const Attributes&) delete

Member Variables

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

Constructor Details

Attributes Constructor

sngcm::ast::Attributes::Attributes()

Definition at line 42 of Attribute.cpp :
 43 {
 44 }


Declaration at line 45 of Attribute.hpp


Attributes Constructor

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

Definition at line 46 of Attribute.hpp


Member Function Details

Accept Member Function

void sngcm::ast::Attributes::Accept(Visitor & visitor)

Definition at line 88 of Attribute.cpp :
 89 {
 90     visitor.Visit(*this);
 91 }


Declaration at line 53 of Attribute.hpp

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::Attributes::AddAttribute(Attribute * attribute)

Definition at line 72 of Attribute.cpp :
 73 {
 74     attributes.push_back(std::unique_ptr<Attribute>(attribute));
 75     attributeMap[attribute->Name()] = attribute;
 76 }


Declaration at line 59 of Attribute.hpp

Calls: sngcm::ast::Attribute::Name

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


AddAttribute Member Function

void sngcm::ast::Attributes::AddAttribute(const Span& span, const std::u32string& name)

Definition at line 56 of Attribute.cpp :
 57 {
 58     AddAttribute(spannameU"true");
 59 }


Calls: sngcm::ast::Attributes::AddAttribute


AddAttribute Member Function

void sngcm::ast::Attributes::AddAttribute(const Span& span, const std::u32string& name, const std::u32string& value)

Definition at line 61 of Attribute.cpp :
 62 {
 63     Attribute* prev = GetAttribute(name);
 64     if (prev != nullptr)
 65     {
 66         throw AttributeNotUniqueException("attribute '" + ToUtf8(name) + "' not unique"spanprev->GetSpan());
 67     }
 68     Attribute* attribute = new Attribute(spannamevalue);
 69     AddAttribute(attribute);
 70 }


Calls: sngcm::ast::Attribute::GetSpan , sngcm::ast::Attributes::AddAttribute , sngcm::ast::Attributes::GetAttribute

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


Clone Member Function

Attributes * sngcm::ast::Attributes::Clone() const

Definition at line 78 of Attribute.cpp :
 79 {
 80     std::unique_ptr<Attributes> clone(new Attributes());
 81     for (const std::std::unique_ptr<Attribute>&attribute : attributes)
 82     {
 83         clone->AddAttribute(attribute->GetSpan()attribute->Name()attribute->Value());
 84     }
 85     return clone.release();
 86 }


Declaration at line 52 of Attribute.hpp

Calls: sngcm::ast::Attributes::AddAttribute


GetAttribute Member Function

Attribute * sngcm::ast::Attributes::GetAttribute(const std::u32string& name) const

Definition at line 46 of Attribute.cpp :
 47 {
 48     std::map<std::u32stringAttribute*>::const_iterator it = attributeMap.find(name);
 49     if (it != attributeMap.cend())
 50     {
 51         return it->second;
 52     }
 53     return nullptr;
 54 }


Declaration at line 51 of Attribute.hpp

Called by: sngcm::ast::Attributes::AddAttribute


GetAttributes Member Function

const std::vector<std::unique_ptr<Attribute >>& sngcm::ast::Attributes::GetAttributes() const

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

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


Read Member Function

void sngcm::ast::Attributes::Read(AstReader & reader)

Definition at line 102 of Attribute.cpp :
103 {
104     uint32_t n = reader.GetBinaryReader().ReadULEB128UInt();
105     for (uint32_t i = 0u; i < n; ++i)
106     {
107         Attribute* attribute = new Attribute();
108         attribute->Read(reader);
109         AddAttribute(attribute);
110     }
111 }


Declaration at line 55 of Attribute.hpp

Calls: sngcm::ast::AstReader::GetBinaryReader , sngcm::ast::Attribute::Read , sngcm::ast::Attributes::AddAttribute , soulng::util::BinaryReader::ReadULEB128UInt


Write Member Function

void sngcm::ast::Attributes::Write(AstWriter & writer)

Definition at line 93 of Attribute.cpp :
 94 {
 95     writer.GetBinaryWriter().WriteULEB128UInt(static_cast<uint32_t>(attributes.size()));
 96     for (const std::std::unique_ptr<Attribute>&attribute : attributes)
 97     {
 98         attribute->Write(writer);
 99     }
100 }


Declaration at line 54 of Attribute.hpp

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

Called by: sngcm::ast::Attributes::Write


operator= Member Function

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

Definition at line 47 of Attribute.hpp


top | up | prev | next