Hosted by
|
with Token_Readers; use Token_Readers;
package body Music.Barlines.MusicXML is
function Read_Barline
(XML : access XML_Reader)
return Barline_Access
is
Location : Location_Enum := Right;
Bar_Style : Bar_Style_Enum;
begin
if not End_Of_Tag(XML) then
Assert_Attribute_Name(XML, "location");
Read_Attribute_Value(XML);
Location := To_Location_Enum(Get_Token(XML));
end if;
Exit_Tag(XML);
while Descend(XML) loop
Exit_Tag(XML);
if Context_Is(XML, "bar-style") then
Bar_Style := To_Bar_Style_Enum(Read_Data(XML));
else
XML_Expect_Error(XML, "/barline", "bar-style");
end if;
Exit_Element(XML);
end loop;
Exit_Tag(XML); -- </barline>
return Create(Location, Bar_Style);
end Read_Barline;
procedure Write_Barline
(XML : access XML_Writer;
This : access Barline)
is
begin
Start_Element(XML, "barline", "location", To_XML(Get_Location(This)'Img));
Write_Element(XML, "bar-style", To_XML(Get_Bar_Style(This)'Img));
Close_Element(XML, "barline");
end Write_Barline;
end Music.Barlines.MusicXML;
|