with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLCSSMediaList_Interface is

   procedure Initialize (This : in out IHTMLCSSMediaList_Type) is
   begin
      Set_IID (This, IID_IHTMLCSSMediaList);
   end Initialize;

   function Pointer (This : IHTMLCSSMediaList_Type)
     return Pointer_To_IHTMLCSSMediaList
   is
   begin
      return To_Pointer_To_IHTMLCSSMediaList (Address (This));
   end Pointer;

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

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

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

   end Put_mediaText;

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

      return RetVal;
   end Get_mediaText;

   function Get_length
     (This : IHTMLCSSMediaList_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 item
     (This        : IHTMLCSSMediaList_Type;
      index       : Interfaces.C.long)
     return GNATCOM.Types.BSTR
   is
       RetVal : aliased GNATCOM.Types.BSTR;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.item
         (Pointer (This),
          index,
          RetVal'Unchecked_Access));

      return RetVal;
   end item;

   procedure appendMedium
     (This       : IHTMLCSSMediaList_Type;
      bstrMedium : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.appendMedium
         (Pointer (This),
          bstrMedium));

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

   end appendMedium;

   procedure deleteMedium
     (This       : IHTMLCSSMediaList_Type;
      bstrMedium : GNATCOM.Types.BSTR;
      Free       : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.deleteMedium
         (Pointer (This),
          bstrMedium));

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

   end deleteMedium;

end MSHTML.IHTMLCSSMediaList_Interface;

