------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008 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 Qt_Ada.Internals.Objects;

with Qt_Ada.Internals.Objects.Sql_Table_Model_Proxies;
pragma Warnings (Off, Qt_Ada.Internals.Objects.Sql_Table_Model_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.Sql_Table_Models is

   procedure database_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Sql_Databases.Internals.QSqlDatabase);
   pragma Import (C, database_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_database_0_wrapper");

   function editStrategy_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.Sql_Table_Models.Sql_Table_Model_Edit_Strategy;
   pragma Import (C, editStrategy_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_editStrategy_0_wrapper");

   function fieldIndex_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Field_Name : not null access constant Qt4.Strings.Internals.QString)
       return Qt4.Q_Integer;
   pragma Import (C, fieldIndex_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_fieldIndex_0_wrapper");

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

   function insertRecord_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Row : Qt4.Q_Integer;
     Rec : not null access constant Qt4.Sql_Records.Internals.QSqlRecord)
       return Qt4.bool;
   pragma Import (C, insertRecord_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_insertRecord_0_wrapper");

   function isDirty_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Index : not null access constant Qt4.Model_Indices.Internals.QModelIndex)
       return Qt4.bool;
   pragma Import (C, isDirty_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_isDirty_0_wrapper");

   function setRecord_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Row : Qt4.Q_Integer;
     Rec : not null access constant Qt4.Sql_Records.Internals.QSqlRecord)
       return Qt4.bool;
   pragma Import (C, setRecord_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_setRecord_0_wrapper");

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

   procedure revertAll_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, revertAll_0_wrapper,
                     "__Qt4Ada_QSqlTableModel_revertAll_0_wrapper");

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

   ------------------
   -- Select_Query --
   ------------------

   procedure Select_Query (Self : not null access Q_Sql_Table_Model'Class) is
   begin
      if not Self.Select_Query then
         raise Program_Error;
      end if;
   end Select_Query;

   pragma Style_Checks ("N");

   --------------
   -- Database --
   --------------

   function Database
    (Self : not null access constant Q_Sql_Table_Model'Class)
       return Qt4.Sql_Databases.Q_Sql_Database
   is
      Returns : Qt4.Sql_Databases.Q_Sql_Database;

   begin
      database_0_wrapper
       (Self.QObject_View,
        Qt4.Sql_Databases.Internals.QSqlDatabase_View (Returns));

      return Returns;
   end Database;

   -------------------
   -- Edit_Strategy --
   -------------------

   function Edit_Strategy
    (Self : not null access constant Q_Sql_Table_Model'Class)
       return Qt4.Sql_Table_Models.Sql_Table_Model_Edit_Strategy
   is
   begin
      return
        editStrategy_0_wrapper
         (Self.QObject_View);
   end Edit_Strategy;

   -----------------
   -- Field_Index --
   -----------------

   function Field_Index
    (Self : not null access constant Q_Sql_Table_Model'Class;
     Field_Name : Qt4.Strings.Q_String)
       return Qt4.Q_Integer
   is
   begin
      return
        fieldIndex_0_wrapper
         (Self.QObject_View,
          Qt4.Strings.Internals.QString_View (Field_Name));
   end Field_Index;

   ------------
   -- Filter --
   ------------

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

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

      return Returns;
   end Filter;

   -------------------
   -- Insert_Record --
   -------------------

   function Insert_Record
    (Self : not null access Q_Sql_Table_Model'Class;
     Row : Qt4.Q_Integer;
     Rec : Qt4.Sql_Records.Q_Sql_Record)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (insertRecord_0_wrapper
           (Self.QObject_View,
            Row,
            Qt4.Sql_Records.Internals.QSqlRecord_View (Rec)));
   end Insert_Record;

   --------------
   -- Is_Dirty --
   --------------

   function Is_Dirty
    (Self : not null access constant Q_Sql_Table_Model'Class;
     Index : Qt4.Model_Indices.Q_Model_Index)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isDirty_0_wrapper
           (Self.QObject_View,
            Qt4.Model_Indices.Internals.QModelIndex_View (Index)));
   end Is_Dirty;

   ----------------
   -- Set_Record --
   ----------------

   function Set_Record
    (Self : not null access Q_Sql_Table_Model'Class;
     Row : Qt4.Q_Integer;
     Rec : Qt4.Sql_Records.Q_Sql_Record)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (setRecord_0_wrapper
           (Self.QObject_View,
            Row,
            Qt4.Sql_Records.Internals.QSqlRecord_View (Rec)));
   end Set_Record;

   ----------------
   -- Table_Name --
   ----------------

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

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

      return Returns;
   end Table_Name;

   ----------------
   -- Revert_All --
   ----------------

   procedure Revert_All
    (Self : not null access Q_Sql_Table_Model'Class)
   is
   begin
      revertAll_0_wrapper
       (Self.QObject_View);
   end Revert_All;

   ----------------
   -- Submit_All --
   ----------------

   function Submit_All
    (Self : not null access Q_Sql_Table_Model'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (submitAll_0_wrapper
           (Self.QObject_View));
   end Submit_All;

end Qt4.Sql_Table_Models;
