with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLOpsProfile_Interface is

   procedure Initialize (This : in out IHTMLOpsProfile_Type) is
   begin
      Set_IID (This, IID_IHTMLOpsProfile);
   end Initialize;

   function Pointer (This : IHTMLOpsProfile_Type)
     return Pointer_To_IHTMLOpsProfile
   is
   begin
      return To_Pointer_To_IHTMLOpsProfile (Address (This));
   end Pointer;

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

   function addRequest
     (This     : IHTMLOpsProfile_Type;
      name     : GNATCOM.Types.BSTR;
      reserved : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free     : Boolean := True)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.addRequest
         (Pointer (This),
          name,
          reserved,
          RetVal'Unchecked_Access));

      if Free then
               GNATCOM.IInterface.Free (name);
               GNATCOM.IInterface.Free (reserved);
      
      end if;

      return RetVal;
   end addRequest;

   procedure clearRequest
     (This : IHTMLOpsProfile_Type)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.clearRequest
         (Pointer (This)));

   end clearRequest;

   procedure doRequest
     (This     : IHTMLOpsProfile_Type;
      usage    : GNATCOM.Types.VARIANT;
      fname    : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      domain   : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      path     : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      expire   : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      reserved : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free     : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.doRequest
         (Pointer (This),
          usage,
          fname,
          domain,
          path,
          expire,
          reserved));

      if Free then
               GNATCOM.IInterface.Free (usage);
               GNATCOM.IInterface.Free (fname);
               GNATCOM.IInterface.Free (domain);
               GNATCOM.IInterface.Free (path);
               GNATCOM.IInterface.Free (expire);
               GNATCOM.IInterface.Free (reserved);
      
      end if;

   end doRequest;

   function getAttribute
     (This  : IHTMLOpsProfile_Type;
      name  : GNATCOM.Types.BSTR;
      Free  : Boolean := True)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.getAttribute
         (Pointer (This),
          name,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end getAttribute;

   function setAttribute
     (This    : IHTMLOpsProfile_Type;
      name    : GNATCOM.Types.BSTR;
      value   : GNATCOM.Types.BSTR;
      prefs   : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free    : Boolean := True)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.setAttribute
         (Pointer (This),
          name,
          value,
          prefs,
          RetVal'Unchecked_Access));

      if Free then
               GNATCOM.IInterface.Free (name);
               GNATCOM.IInterface.Free (value);
               GNATCOM.IInterface.Free (prefs);
      
      end if;

      return RetVal;
   end setAttribute;

   function commitChanges
     (This    : IHTMLOpsProfile_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.commitChanges
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end commitChanges;

   function addReadRequest
     (This     : IHTMLOpsProfile_Type;
      name     : GNATCOM.Types.BSTR;
      reserved : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free     : Boolean := True)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.addReadRequest
         (Pointer (This),
          name,
          reserved,
          RetVal'Unchecked_Access));

      if Free then
               GNATCOM.IInterface.Free (name);
               GNATCOM.IInterface.Free (reserved);
      
      end if;

      return RetVal;
   end addReadRequest;

   procedure doReadRequest
     (This     : IHTMLOpsProfile_Type;
      usage    : GNATCOM.Types.VARIANT;
      fname    : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      domain   : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      path     : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      expire   : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      reserved : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free     : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.doReadRequest
         (Pointer (This),
          usage,
          fname,
          domain,
          path,
          expire,
          reserved));

      if Free then
               GNATCOM.IInterface.Free (usage);
               GNATCOM.IInterface.Free (fname);
               GNATCOM.IInterface.Free (domain);
               GNATCOM.IInterface.Free (path);
               GNATCOM.IInterface.Free (expire);
               GNATCOM.IInterface.Free (reserved);
      
      end if;

   end doReadRequest;

   function doWriteRequest
     (This    : IHTMLOpsProfile_Type)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.doWriteRequest
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end doWriteRequest;

end MSHTML.IHTMLOpsProfile_Interface;

