with GNATCOM.Errors;

package body MSHTML.IElementNamespaceTable_Interface is

   procedure Initialize (This : in out IElementNamespaceTable_Type) is
   begin
      Set_IID (This, IID_IElementNamespaceTable);
   end Initialize;

   function Pointer (This : IElementNamespaceTable_Type)
     return Pointer_To_IElementNamespaceTable
   is
   begin
      return To_Pointer_To_IElementNamespaceTable (Address (This));
   end Pointer;

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

   procedure AddNamespace
     (This          : IElementNamespaceTable_Type;
      bstrNamespace : GNATCOM.Types.BSTR;
      bstrUrn       : GNATCOM.Types.BSTR;
      lFlags        : Interfaces.C.long;
      pvarFactory   : access GNATCOM.Types.VARIANT :=
        GNATCOM.Types.PVARIANT_MISSING;
      Free          : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.AddNamespace
         (Pointer (This),
          bstrNamespace,
          bstrUrn,
          lFlags,
          pvarFactory));

      if Free then
               GNATCOM.IInterface.Free (bstrNamespace);
               GNATCOM.IInterface.Free (bstrUrn);
      
      end if;

   end AddNamespace;

end MSHTML.IElementNamespaceTable_Interface;

