with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLXMLHttpRequest2_Interface is

   procedure Initialize (This : in out IHTMLXMLHttpRequest2_Type) is
   begin
      Set_IID (This, IID_IHTMLXMLHttpRequest2);
   end Initialize;

   function Pointer (This : IHTMLXMLHttpRequest2_Type)
     return Pointer_To_IHTMLXMLHttpRequest2
   is
   begin
      return To_Pointer_To_IHTMLXMLHttpRequest2 (Address (This));
   end Pointer;

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

   procedure Put_timeout
     (This : IHTMLXMLHttpRequest2_Type;
      p    : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_timeout
         (Pointer (This),
          p));

   end Put_timeout;

   function Get_timeout
     (This : IHTMLXMLHttpRequest2_Type)
     return Interfaces.C.long
   is
       RetVal : aliased Interfaces.C.long;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_timeout
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_timeout;

   procedure Put_ontimeout
     (This : IHTMLXMLHttpRequest2_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_ontimeout
         (Pointer (This),
          p));

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

   end Put_ontimeout;

   function Get_ontimeout
     (This : IHTMLXMLHttpRequest2_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_ontimeout
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_ontimeout;

end MSHTML.IHTMLXMLHttpRequest2_Interface;

