with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLObjectElement2_Interface is

   procedure Initialize (This : in out IHTMLObjectElement2_Type) is
   begin
      Set_IID (This, IID_IHTMLObjectElement2);
   end Initialize;

   function Pointer (This : IHTMLObjectElement2_Type)
     return Pointer_To_IHTMLObjectElement2
   is
   begin
      return To_Pointer_To_IHTMLObjectElement2 (Address (This));
   end Pointer;

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

   function namedRecordset
     (This        : IHTMLObjectElement2_Type;
      dataMember  : GNATCOM.Types.BSTR;
      hierarchy   : access GNATCOM.Types.VARIANT :=
        GNATCOM.Types.PVARIANT_MISSING;
      Free        : Boolean := True)
     return GNATCOM.Types.Pointer_To_IDispatch
   is
       RetVal : aliased GNATCOM.Types.Pointer_To_IDispatch;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.namedRecordset
         (Pointer (This),
          dataMember,
          hierarchy,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end namedRecordset;

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

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

   end Put_classid;

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

      return RetVal;
   end Get_classid;

   procedure Put_data
     (This : IHTMLObjectElement2_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 : IHTMLObjectElement2_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;

end MSHTML.IHTMLObjectElement2_Interface;

