with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLDOMTextNode2_Interface is

   procedure Initialize (This : in out IHTMLDOMTextNode2_Type) is
   begin
      Set_IID (This, IID_IHTMLDOMTextNode2);
   end Initialize;

   function Pointer (This : IHTMLDOMTextNode2_Type)
     return Pointer_To_IHTMLDOMTextNode2
   is
   begin
      return To_Pointer_To_IHTMLDOMTextNode2 (Address (This));
   end Pointer;

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

   function substringData
     (This           : IHTMLDOMTextNode2_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       : IHTMLDOMTextNode2_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       : IHTMLDOMTextNode2_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   : IHTMLDOMTextNode2_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       : IHTMLDOMTextNode2_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.IHTMLDOMTextNode2_Interface;

