with GNATCOM.IInterface;

with GNATCOM.Errors;

package body MSHTML.IHTMLNamespace_Interface is

   procedure Initialize (This : in out IHTMLNamespace_Type) is
   begin
      Set_IID (This, IID_IHTMLNamespace);
   end Initialize;

   function Pointer (This : IHTMLNamespace_Type)
     return Pointer_To_IHTMLNamespace
   is
   begin
      return To_Pointer_To_IHTMLNamespace (Address (This));
   end Pointer;

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

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

      return RetVal;
   end Get_name;

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

      return RetVal;
   end Get_urn;

   function Get_tagNames
     (This : IHTMLNamespace_Type)
     return GNATCOM.Types.Pointer_To_IDispatch
   is
       RetVal : aliased GNATCOM.Types.Pointer_To_IDispatch;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_tagNames
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_tagNames;

   function Get_readyState
     (This : IHTMLNamespace_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_readyState
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_readyState;

   procedure Put_onreadystatechange
     (This : IHTMLNamespace_Type;
      p    : GNATCOM.Types.VARIANT;
      Free : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Put_onreadystatechange
         (Pointer (This),
          p));

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

   end Put_onreadystatechange;

   function Get_onreadystatechange
     (This : IHTMLNamespace_Type)
     return GNATCOM.Types.VARIANT
   is
       RetVal : aliased GNATCOM.Types.VARIANT;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.Get_onreadystatechange
         (Pointer (This),
          RetVal'Unchecked_Access));

      return RetVal;
   end Get_onreadystatechange;

   procedure doImport
     (This                  : IHTMLNamespace_Type;
      bstrImplementationUrl : GNATCOM.Types.BSTR;
      Free                  : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.doImport
         (Pointer (This),
          bstrImplementationUrl));

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

   end doImport;

   function attachEvent
     (This     : IHTMLNamespace_Type;
      event    : GNATCOM.Types.BSTR;
      pdisp    : GNATCOM.Types.Pointer_To_IDispatch;
      Free     : Boolean := True)
     return GNATCOM.Types.VARIANT_BOOL
   is
       RetVal : aliased GNATCOM.Types.VARIANT_BOOL;
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.attachEvent
         (Pointer (This),
          event,
          pdisp,
          RetVal'Unchecked_Access));

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

      return RetVal;
   end attachEvent;

   procedure detachEvent
     (This  : IHTMLNamespace_Type;
      event : GNATCOM.Types.BSTR;
      pdisp : GNATCOM.Types.Pointer_To_IDispatch;
      Free  : Boolean := True)
   is
   begin
      GNATCOM.Errors.Error_Check
        (Pointer (This).Vtbl.detachEvent
         (Pointer (This),
          event,
          pdisp));

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

   end detachEvent;

end MSHTML.IHTMLNamespace_Interface;

