--
-- @filename : adadoc_tree-list.ads
-- @author Julien Burdy & Vincent Decorges
-- @date 10.4.02
-- @brief Management of the tree (Tree structure and operations)
--
-- History  :
-- Date     Modification               Author
--
package AdaDoc_Tree.List is

   --The type Node is public because the package offer
   --function to find an element from a certain node in the list
   type Node_Type is private;
   type Node_Ptr_Type is private;

   type Tree_Type is limited private;

   --
   -- Purpose : Insert a node to the parse tree
   --
   -- in out  : Tree : The parse tree
   -- in      : Object : the content of the node
   --
   procedure Insert(Tree : in out Tree_Type; Object : in Object_Token_Ptr);

   --
   -- Purpose : Return true if the list is empty
   --
   -- in      : Tree : The parse tree
   -- return  : Boolean
   --
   function Is_Empty (Tree : Tree_Type) return Boolean;


   --
   -- Purpose : Return true if a Tag_Name object exist in the tree
   --
   -- in      : Tree : The parse tree
   -- in      : Tag_Name : The tag of the type
   -- return  : Boolean
   --
   function Exist (Tree : Tree_Type; Tag_Name : String) return Boolean;

   --
   -- Purpose : Return true if a Tag_Name object exist in the tree
   --
   -- in      : Node : The node to begin
   -- in      : Tag_Name : The tag of the type
   -- return  : Boolean
   --
   function Exist (Node : Node_Ptr_Type; Tag_Name : String) return Boolean;


   --
   -- Purpose : Return a pointer on the object to find
   --           or null if not find
   --
   -- in      : Tree : The parse tree
   -- in      : Tag_Name : First search criteria
   -- out     : Object found. Null if not found
   --
   procedure Find_Next (Tree : in out Tree_Type;
                        Tag_Name : in String;
                        Object : out Object_Token_Ptr);

   --
   -- Purpose : Return a pointer on the object to find
   --           or null if not find
   --
   -- in      : Tree : The parse tree
   -- in      : Tag_Name : First search criteria
   -- in      : Tag_Name2 : Second search criteria
   -- out     : Object found. Null if not found
   --
   procedure Find_Next (Tree : in out Tree_Type;
                        Tag_Name : in String;
                        Tag_Name2 : in String;
                        Object : out Object_Token_Ptr);

   --
   -- Purpose : Free the list
   --
   -- in out  : Tree : The parse tree
   --
   procedure Empty (Tree : in out Tree_Type);

private

   type Node_Ptr_Type is access Node_Type;
   type Node_Type is
      record
         Element : Object_Token_Ptr;
         Next    : Node_Ptr_Type;
      end record;

   type Tree_Type is
      record
         Head : Node_Ptr_Type := null;
         Tail : Node_Ptr_Type := null;
      end record;

end AdaDoc_Tree.List;