-- $Date: 2004/01/28 05:01:41 $
-- $Revision: 1.3 $
-- $Author: jcrocholl $

with Integer_Strings; use Integer_Strings;

package body Music.Forwards.MusicXML is

   -- Read forward data from an XML reader.
   function Read_Forward
     (XML : access XML_Reader-- Use this XML reader.
     return Forward_Access     -- The newly created forward.
   is
      Duration : Positive;
      Voice    : Positive;
      Staff    : Positive;
   begin
      Exit_Tag(XML);
      Duration := To_Number(Read_Element_Data(XML, "duration"));
      Voice := To_Number(Read_Element_Data(XML, "voice"));
      Staff := To_Number(Read_Element_Data(XML, "staff"));
      Assert_Tag(XML, "/forward");
      return Create(Duration, Voice, Staff);
   end Read_Forward;

   -- Write forward data to an XML writer.
   procedure Write_Forward
     (XML  : access XML_Writer-- Use this XML writer.
      This : access Forward)    -- Write this forward.
   is
   begin
      Start_Element(XML, "forward");
      Write_Element(XML, "duration", To_String(Get_Duration(This)));
      Write_Element(XML, "voice", To_String(Get_Voice(This)));
      Write_Element(XML, "staff", To_String(Get_Staff(This)));
      Close_Element(XML, "forward");
   end Write_Forward;

end Music.Forwards.MusicXML;