with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLXDomainRequest_Interface is

   procedure Initialize (This : in out IHTMLXDomainRequest_Type) is
   begin
      Set_IID (This, IID_IHTMLXDomainRequest);
   end Initialize;

   function Pointer (This : IHTMLXDomainRequest_Type)
     return Pointer_To_IHTMLXDomainRequest
   is
   begin
      return To_Pointer_To_IHTMLXDomainRequest (Address (This));
   end Pointer;

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

   function Get_responseText
     (This : IHTMLXDomainRequest_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_responseText
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_responseText;

   procedure Put_timeout
     (This : IHTMLXDomainRequest_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 : IHTMLXDomainRequest_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;

   function Get_contentType
     (This : IHTMLXDomainRequest_Type)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_contentType
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_contentType;

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

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

   end Put_onprogress;

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

      return RetVal;
   end Get_onprogress;

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

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

   end Put_onerror;

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

      return RetVal;
   end Get_onerror;

   procedure Put_ontimeout
     (This : IHTMLXDomainRequest_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 : IHTMLXDomainRequest_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;

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

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

   end Put_onload;

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

      return RetVal;
   end Get_onload;

   procedure uabort
     (This : IHTMLXDomainRequest_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.uabort
         (Pointer (This)));

   end uabort;

   procedure open
     (This       : IHTMLXDomainRequest_Type;
      bstrMethod : GNATCOM.Types.BSTR;
      bstrURL    : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.open
         (Pointer (This),
          bstrMethod,
          bstrURL));

      if Free then
               GNATCOM.IInterface.Free (bstrMethod);
               GNATCOM.IInterface.Free (bstrURL);
      
      end if;

   end open;

   procedure send
     (This    : IHTMLXDomainRequest_Type;
      varBody : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free    : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.send
         (Pointer (This),
          varBody));

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

   end send;

end MSHTML.IHTMLXDomainRequest_Interface;

