with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IDocumentTraversal_Interface is

   procedure Initialize (This : in out IDocumentTraversal_Type) is
   begin
      Set_IID (This, IID_IDocumentTraversal);
   end Initialize;

   function Pointer (This : IDocumentTraversal_Type)
     return Pointer_To_IDocumentTraversal
   is
   begin
      return To_Pointer_To_IDocumentTraversal (Address (This));
   end Pointer;

   procedure Attach (This    : in out IDocumentTraversal_Type;
                     Pointer : in     Pointer_To_IDocumentTraversal)
   is
   begin
      Attach (This, GNATCOM.IInterface.To_Pointer_To_IUnknown
              (Pointer.all'Address));
   end Attach;

   function createNodeIterator
     (This                      : IDocumentTraversal_Type;
      pRootNode                 : GNATCOM.Types.Pointer_To_IDispatch;
      ulWhatToShow              : Interfaces.C.long;
      pFilter                   : access GNATCOM.Types.VARIANT :=
        GNATCOM.Types.PVARIANT_MISSING;
      fEntityReferenceExpansion : GNATCOM.Types.VARIANT_BOOL)
     return Pointer_To_IDOMNodeIterator
   is
       RetVal : aliased Pointer_To_IDOMNodeIterator;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.createNodeIterator
         (Pointer (This),
          pRootNode,
          ulWhatToShow,
          pFilter,
          fEntityReferenceExpansion,
          RetVal'Unchecked_Access));

      return RetVal;
   end createNodeIterator;

   function createTreeWalker
     (This                      : IDocumentTraversal_Type;
      pRootNode                 : GNATCOM.Types.Pointer_To_IDispatch;
      ulWhatToShow              : Interfaces.C.long;
      pFilter                   : access GNATCOM.Types.VARIANT :=
        GNATCOM.Types.PVARIANT_MISSING;
      fEntityReferenceExpansion : GNATCOM.Types.VARIANT_BOOL)
     return Pointer_To_IDOMTreeWalker
   is
       RetVal : aliased Pointer_To_IDOMTreeWalker;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.createTreeWalker
         (Pointer (This),
          pRootNode,
          ulWhatToShow,
          pFilter,
          fEntityReferenceExpansion,
          RetVal'Unchecked_Access));

      return RetVal;
   end createTreeWalker;

end MSHTML.IDocumentTraversal_Interface;

