with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLAreasCollection4_Interface is

   procedure Initialize (This : in out IHTMLAreasCollection4_Type) is
   begin
      Set_IID (This, IID_IHTMLAreasCollection4);
   end Initialize;

   function Pointer (This : IHTMLAreasCollection4_Type)
     return Pointer_To_IHTMLAreasCollection4
   is
   begin
      return To_Pointer_To_IHTMLAreasCollection4 (Address (This));
   end Pointer;

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

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

      return RetVal;
   end item;

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

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

      return RetVal;
   end namedItem;

end MSHTML.IHTMLAreasCollection4_Interface;

