--
-- @filename module_interface.ads
-- @author Julien Burdy & Vincent Decorges
-- @date 17.6.02
-- @brief Interface between SAX parser and the AdaDoc modules
--
-- History  :
-- Date     Modification               Author
--

-- from Xml/Ada (http://libre.act-europe.fr/xmlada)
with Sax.Readers, Sax.Attributes, Unicode.CES;

-- from AdaDoc
with Module;
with Dict_TDA; use Dict_TDA;

package Module_Interface is


   type Object is new Sax.Readers.Reader with private;

   --
   -- Purpose : Set a module with the current Reader
   --
   -- Self            : Object itself.
   -- Module_Instance : AdaDoc module instance to fixe-
   -- Dict_Tags       : User defined tags
   -- Options         : Option for the module
   --
   procedure Set_Module (Self : in out Object;
                         Module_Instance : Module.Object_Access;
                         Dict_Tags : in Dict_Tda.Dict_Type;
                         Options : String);


   -- If XML contain false element
   XML_Element_Name_Error : exception;


   --
   --  Purpose : Receive notification of the beginning of an element.
   --            There will always be a matching call to End_Element,
   --            even for empty elements.
   --            The attribute list will only contain attributes with explicit values.
   --
   -- Self    : Object itself.
   -- see SAX documentation
   --
   procedure Start_Element (Self : in out Object;
                            Namespace_URI : Unicode.CES.Byte_Sequence := "";
                            Local_Name    : Unicode.CES.Byte_Sequence := "";
                            Qname         : Unicode.CES.Byte_Sequence := "";
                            Atts          : Sax.Attributes.Attributes'Class);

   --
   --  Purpose : Receive notification of the end of an element.
   --
   -- Self    : Object itself.
   -- see SAX documentation
   --
   procedure End_Element (Self : in out Object;
                          Namespace_URI : Unicode.CES.Byte_Sequence := "";
                          Local_Name    : Unicode.CES.Byte_Sequence := "";
                          Qname         : Unicode.CES.Byte_Sequence := "");


   --
   --  Purpose : Receive notification of the end of a document.
   --            This callback will be called only once once it has reached the end of
   --            the input stream.
   --
   -- Self    : Object itself.
   --
   procedure End_Document (Self : in out Object);


private

   type Object is new Sax.Readers.Reader with
   record
      Modul : Module.Object_Access; -- module instance
      Tags  : Dict_Type;            -- user tags
   end record;

end Module_Interface;
