with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLCommentElement2_Interface is

   procedure Initialize (This : in out IHTMLCommentElement2_Type) is
   begin
      Set_IID (This, IID_IHTMLCommentElement2);
   end Initialize;

   function Pointer (This : IHTMLCommentElement2_Type)
     return Pointer_To_IHTMLCommentElement2
   is
   begin
      return To_Pointer_To_IHTMLCommentElement2 (Address (This));
   end Pointer;

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

   procedure Put_data
     (This : IHTMLCommentElement2_Type;
      p    : GNATCOM.Types.BSTR;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_data
         (Pointer (This),
          p));

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

   end Put_data;

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

      return RetVal;
   end Get_data;

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

      return RetVal;
   end Get_length;

   function substringData
     (This           : IHTMLCommentElement2_Type;
      offset         : Interfaces.C.long;
      Count          : Interfaces.C.long)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.substringData
         (Pointer (This),
          offset,
          Count,
          RetVal'Unchecked_Access));

      return RetVal;
   end substringData;

   procedure appendData
     (This       : IHTMLCommentElement2_Type;
      bstrstring : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.appendData
         (Pointer (This),
          bstrstring));

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

   end appendData;

   procedure insertData
     (This       : IHTMLCommentElement2_Type;
      offset     : Interfaces.C.long;
      bstrstring : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.insertData
         (Pointer (This),
          offset,
          bstrstring));

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

   end insertData;

   procedure deleteData
     (This   : IHTMLCommentElement2_Type;
      offset : Interfaces.C.long;
      Count  : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.deleteData
         (Pointer (This),
          offset,
          Count));

   end deleteData;

   procedure replaceData
     (This       : IHTMLCommentElement2_Type;
      offset     : Interfaces.C.long;
      Count      : Interfaces.C.long;
      bstrstring : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.replaceData
         (Pointer (This),
          offset,
          Count,
          bstrstring));

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

   end replaceData;

end MSHTML.IHTMLCommentElement2_Interface;

