------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-2010 Vadim Godunko <vgodunko@gmail.com>                 --
--                                                                          --
-- QtAda is free software;  you can  redistribute it and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion. QtAda is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License distributed with QtAda;  see file COPYING.  If not, write --
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
-- Boston, MA 02110-1301, USA.                                              --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
------------------------------------------------------------------------------
--    This file has been generated automatically. Please don't edit it.     --
------------------------------------------------------------------------------
with Ada.IO_Exceptions;
with Qt_Ada.Internals.Objects;

with Qt_Ada.Internals.Objects.IO_Device_Proxies;
pragma Warnings (Off, Qt_Ada.Internals.Objects.IO_Device_Proxies);
--  Elaboration of the proxy tagged type package register proxy object
--  constructor. Bindings must be able to create proxy object of the
--  corresponding tagged type for works properly.

package body Qt4.IO_Devices is

   procedure errorString_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Strings.Internals.QString);
   pragma Import (C, errorString_0_wrapper,
                     "__Qt4Ada_QIODevice_errorString_0_wrapper");

   function isOpen_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isOpen_0_wrapper,
                     "__Qt4Ada_QIODevice_isOpen_0_wrapper");

   function isReadable_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isReadable_0_wrapper,
                     "__Qt4Ada_QIODevice_isReadable_0_wrapper");

   function isTextModeEnabled_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isTextModeEnabled_0_wrapper,
                     "__Qt4Ada_QIODevice_isTextModeEnabled_0_wrapper");

   function isWritable_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isWritable_0_wrapper,
                     "__Qt4Ada_QIODevice_isWritable_0_wrapper");

   procedure peek_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Maxlen : Qt4.Q_Integer_64;
     Returns : not null access Qt4.Byte_Arrays.Internals.QByteArray);
   pragma Import (C, peek_0_wrapper,
                     "__Qt4Ada_QIODevice_peek_0_wrapper");

   procedure read_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Maxlen : Qt4.Q_Integer_64;
     Returns : not null access Qt4.Byte_Arrays.Internals.QByteArray);
   pragma Import (C, read_0_wrapper,
                     "__Qt4Ada_QIODevice_read_0_wrapper");

   procedure readAll_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Byte_Arrays.Internals.QByteArray);
   pragma Import (C, readAll_0_wrapper,
                     "__Qt4Ada_QIODevice_readAll_0_wrapper");

   procedure readLine_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Maxlen : Qt4.Q_Integer_64;
     Returns : not null access Qt4.Byte_Arrays.Internals.QByteArray);
   pragma Import (C, readLine_0_wrapper,
                     "__Qt4Ada_QIODevice_readLine_0_wrapper");

   procedure setTextModeEnabled_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Enabled : Qt4.bool);
   pragma Import (C, setTextModeEnabled_0_wrapper,
                     "__Qt4Ada_QIODevice_setTextModeEnabled_0_wrapper");

   function write_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Data : not null access constant Qt4.Byte_Arrays.Internals.QByteArray)
       return Qt4.Q_Integer_64;
   pragma Import (C, write_0_wrapper,
                     "__Qt4Ada_QIODevice_write_0_wrapper");

   ----------
   -- Open --
   ----------

   procedure Open
    (Self : not null access Q_IO_Device'Class;
     Mode : Qt4.IO_Devices.Open_Mode)
   is
   begin
      if not Self.Open (Mode) then
         raise Ada.IO_Exceptions.Name_Error;
      end if;
   end Open;

   pragma Style_Checks ("N");

   ------------------
   -- Error_String --
   ------------------

   function Error_String
    (Self : not null access constant Q_IO_Device'Class)
       return Qt4.Strings.Q_String
   is
      Returns : Qt4.Strings.Q_String;

   begin
      errorString_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Returns));

      return Returns;
   end Error_String;

   -------------
   -- Is_Open --
   -------------

   function Is_Open
    (Self : not null access constant Q_IO_Device'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isOpen_0_wrapper
           (Self.QObject_View));
   end Is_Open;

   -----------------
   -- Is_Readable --
   -----------------

   function Is_Readable
    (Self : not null access constant Q_IO_Device'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isReadable_0_wrapper
           (Self.QObject_View));
   end Is_Readable;

   --------------------------
   -- Is_Text_Mode_Enabled --
   --------------------------

   function Is_Text_Mode_Enabled
    (Self : not null access constant Q_IO_Device'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isTextModeEnabled_0_wrapper
           (Self.QObject_View));
   end Is_Text_Mode_Enabled;

   -----------------
   -- Is_Writable --
   -----------------

   function Is_Writable
    (Self : not null access constant Q_IO_Device'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isWritable_0_wrapper
           (Self.QObject_View));
   end Is_Writable;

   ----------
   -- Peek --
   ----------

   function Peek
    (Self : not null access Q_IO_Device'Class;
     Maxlen : Qt4.Q_Integer_64)
       return Qt4.Byte_Arrays.Q_Byte_Array
   is
      Returns : Qt4.Byte_Arrays.Q_Byte_Array;

   begin
      peek_0_wrapper
       (Self.QObject_View,
        Maxlen,
        Qt4.Byte_Arrays.Internals.QByteArray_View (Returns));

      return Returns;
   end Peek;

   ----------
   -- Read --
   ----------

   function Read
    (Self : not null access Q_IO_Device'Class;
     Maxlen : Qt4.Q_Integer_64)
       return Qt4.Byte_Arrays.Q_Byte_Array
   is
      Returns : Qt4.Byte_Arrays.Q_Byte_Array;

   begin
      read_0_wrapper
       (Self.QObject_View,
        Maxlen,
        Qt4.Byte_Arrays.Internals.QByteArray_View (Returns));

      return Returns;
   end Read;

   --------------
   -- Read_All --
   --------------

   function Read_All
    (Self : not null access Q_IO_Device'Class)
       return Qt4.Byte_Arrays.Q_Byte_Array
   is
      Returns : Qt4.Byte_Arrays.Q_Byte_Array;

   begin
      readAll_0_wrapper
       (Self.QObject_View,
        Qt4.Byte_Arrays.Internals.QByteArray_View (Returns));

      return Returns;
   end Read_All;

   ---------------
   -- Read_Line --
   ---------------

   function Read_Line
    (Self : not null access Q_IO_Device'Class;
     Maxlen : Qt4.Q_Integer_64
       :=  0)
       return Qt4.Byte_Arrays.Q_Byte_Array
   is
      Returns : Qt4.Byte_Arrays.Q_Byte_Array;

   begin
      readLine_0_wrapper
       (Self.QObject_View,
        Maxlen,
        Qt4.Byte_Arrays.Internals.QByteArray_View (Returns));

      return Returns;
   end Read_Line;

   ---------------------------
   -- Set_Text_Mode_Enabled --
   ---------------------------

   procedure Set_Text_Mode_Enabled
    (Self : not null access Q_IO_Device'Class;
     Enabled : Standard.Boolean)
   is
   begin
      setTextModeEnabled_0_wrapper
       (Self.QObject_View,
        Qt4.To_bool (Enabled));
   end Set_Text_Mode_Enabled;

   -----------
   -- Write --
   -----------

   function Write
    (Self : not null access Q_IO_Device'Class;
     Data : Qt4.Byte_Arrays.Q_Byte_Array)
       return Qt4.Q_Integer_64
   is
   begin
      return
        write_0_wrapper
         (Self.QObject_View,
          Qt4.Byte_Arrays.Internals.QByteArray_View (Data));
   end Write;

end Qt4.IO_Devices;
