with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLAttributeCollection3_Interface is

   procedure Initialize (This : in out IHTMLAttributeCollection3_Type) is
   begin
      Set_IID (This, IID_IHTMLAttributeCollection3);
   end Initialize;

   function Pointer (This : IHTMLAttributeCollection3_Type)
     return Pointer_To_IHTMLAttributeCollection3
   is
   begin
      return To_Pointer_To_IHTMLAttributeCollection3 (Address (This));
   end Pointer;

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

   function getNamedItem
     (This      : IHTMLAttributeCollection3_Type;
      bstrName  : GNATCOM.Types.BSTR;
      Free      : Boolean := True)
     return Pointer_To_IHTMLDOMAttribute
   is
       RetVal : aliased Pointer_To_IHTMLDOMAttribute;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.getNamedItem
         (Pointer (This),
          bstrName,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end getNamedItem;

   function setNamedItem
     (This      : IHTMLAttributeCollection3_Type;
      pNodeIn   : Pointer_To_IHTMLDOMAttribute)
     return Pointer_To_IHTMLDOMAttribute
   is
       RetVal : aliased Pointer_To_IHTMLDOMAttribute;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.setNamedItem
         (Pointer (This),
          pNodeIn,
          RetVal'Unchecked_Access));

      return RetVal;
   end setNamedItem;

   function removeNamedItem
     (This      : IHTMLAttributeCollection3_Type;
      bstrName  : GNATCOM.Types.BSTR;
      Free      : Boolean := True)
     return Pointer_To_IHTMLDOMAttribute
   is
       RetVal : aliased Pointer_To_IHTMLDOMAttribute;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.removeNamedItem
         (Pointer (This),
          bstrName,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end removeNamedItem;

   function item
     (This      : IHTMLAttributeCollection3_Type;
      index     : Interfaces.C.long)
     return Pointer_To_IHTMLDOMAttribute
   is
       RetVal : aliased Pointer_To_IHTMLDOMAttribute;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.item
         (Pointer (This),
          index,
          RetVal'Unchecked_Access));

      return RetVal;
   end item;

   function Get_length
     (This : IHTMLAttributeCollection3_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;

end MSHTML.IHTMLAttributeCollection3_Interface;

