with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLAudioElementFactory_Interface is

   procedure Initialize (This : in out IHTMLAudioElementFactory_Type) is
   begin
      Set_IID (This, IID_IHTMLAudioElementFactory);
   end Initialize;

   function Pointer (This : IHTMLAudioElementFactory_Type)
     return Pointer_To_IHTMLAudioElementFactory
   is
   begin
      return To_Pointer_To_IHTMLAudioElementFactory (Address (This));
   end Pointer;

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

   function create
     (This                                 : IHTMLAudioElementFactory_Type;
      src                                  : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free                                 : Boolean := True)
     return Pointer_To_IHTMLAudioElement
   is
       RetVal : aliased Pointer_To_IHTMLAudioElement;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.create
         (Pointer (This),
          src,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end create;

end MSHTML.IHTMLAudioElementFactory_Interface;

