Hosted by
|
with Ada.Tags;
with Writers; use Writers;
with Readers; use Readers;
with Token_Readers; use Token_Readers;
with Notations.Slurs; use Notations.Slurs;
with Notations.Simple; use Notations.Simple;
with Notations.Articulations; use Notations.Articulations;
with Notations.Slurs.MusicXML; use Notations.Slurs.MusicXML;
with Notations.Simple.MusicXML; use Notations.Simple.MusicXML;
with Notations.Articulations.MusicXML; use Notations.Articulations.MusicXML;
with Placements; use Placements;
package body Notations.MusicXML is
function Read_Notation
(XML : access XML_Reader)
return Notation_Access
is
use Notations.Simple;
begin
if not Context_Is(XML, "slur") then
Exit_Tag(XML);
end if;
if Context_Is(XML, "slur") then
return Notation_Access(Read_Slur(XML));
elsif Context_Is(XML, "arpeggiate") then
return Notation_Access(Create(Arpeggiate));
else
XML_Expect_Error(XML, "/notations", "slur");
end if;
return null;
end Read_Notation;
procedure Write_Notation
(XML : access XML_Writer;
This : access Notation'Class;
Arti : in out Boolean)
is
Tag : String := Ada.Tags.External_Tag(This.all'Tag);
begin
if Tag = Articulation_Tag and not Arti then
Start_Element(XML, "articulations");
Arti := True;
end if;
if Arti and Tag /= Articulation_Tag then
Close_Element(XML, "articulations");
Arti := False;
end if;
if Tag = Slur_Tag then
Write_Slur(XML, Slur_Access(This));
elsif Tag = Simple_Tag then
Write_Simple(XML, Simple_Access(This));
elsif Tag = Articulation_Tag then
Write_Articulation(XML, Articulation_Access(This));
else
Unknown_Tag_Error("Write_Notation", Tag);
end if;
end Write_Notation;
end Notations.MusicXML;
|