with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLAreasCollection_Interface is

   procedure Initialize (This : in out IHTMLAreasCollection_Type) is
   begin
      Set_IID (This, IID_IHTMLAreasCollection);
   end Initialize;

   function Pointer (This : IHTMLAreasCollection_Type)
     return Pointer_To_IHTMLAreasCollection
   is
   begin
      return To_Pointer_To_IHTMLAreasCollection (Address (This));
   end Pointer;

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

   procedure Put_length
     (This : IHTMLAreasCollection_Type;
      p    : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_length
         (Pointer (This),
          p));

   end Put_length;

   function Get_length
     (This : IHTMLAreasCollection_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 Getu_newEnum
     (This : IHTMLAreasCollection_Type)
     return GNATCOM.Types.Pointer_To_IUnknown
   is
       RetVal : aliased GNATCOM.Types.Pointer_To_IUnknown;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Getu_newEnum
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Getu_newEnum;

   function item
     (This  : IHTMLAreasCollection_Type;
      name  : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      index : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_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.item
         (Pointer (This),
          name,
          index,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end item;

   function tags
     (This    : IHTMLAreasCollection_Type;
      tagName : GNATCOM.Types.VARIANT;
      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.tags
         (Pointer (This),
          tagName,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end tags;

   procedure add
     (This    : IHTMLAreasCollection_Type;
      element : Pointer_To_IHTMLElement;
      before  : GNATCOM.Types.VARIANT  := GNATCOM.Types.VARIANT_MISSING;
      Free    : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.add
         (Pointer (This),
          element,
          before));

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

   end add;

   procedure remove
     (This  : IHTMLAreasCollection_Type;
      index : Interfaces.C.long)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.remove
         (Pointer (This),
          index));

   end remove;

end MSHTML.IHTMLAreasCollection_Interface;

