with GNATCOM.Errors;

package body MSHTML.IElementNamespaceFactory2_Interface is

   procedure Initialize (This : in out IElementNamespaceFactory2_Type) is
   begin
      Set_IID (This, IID_IElementNamespaceFactory2);
   end Initialize;

   function Pointer (This : IElementNamespaceFactory2_Type)
     return Pointer_To_IElementNamespaceFactory2
   is
   begin
      return To_Pointer_To_IElementNamespaceFactory2 (Address (This));
   end Pointer;

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

   procedure create
     (This       : IElementNamespaceFactory2_Type;
      pNamespace : Pointer_To_IElementNamespace)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.create
         (Pointer (This),
          pNamespace));

   end create;

   procedure CreateWithImplementation
     (This               : IElementNamespaceFactory2_Type;
      pNamespace         : Pointer_To_IElementNamespace;
      bstrImplementation : GNATCOM.Types.BSTR;
      Free               : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.CreateWithImplementation
         (Pointer (This),
          pNamespace,
          bstrImplementation));

      if Free then
               GNATCOM.IInterface.Free (bstrImplementation);
      
      end if;

   end CreateWithImplementation;

end MSHTML.IElementNamespaceFactory2_Interface;

