------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2007-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.     --
------------------------------------------------------------------------------
private with Ada.Finalization;
with Interfaces.C;
with Qt4.Chars;
with Qt4.Date_Times;
with Qt4.Dates;
with Qt4.Line_Fs;
with Qt4.Lines;
with Qt4.Meta_Types;
with Qt4.Point_Fs;
with Qt4.Points;
with Qt4.Rect_Fs;
with Qt4.Rects;
with Qt4.Reg_Exps;
with Qt4.Size_Fs;
with Qt4.Sizes;
with Qt4.Strings;
with Qt4.Times;
private with Qt_Ada.Internals.Value_Class_Sizes;
with System;

package Qt4.Variants is

   --  QVariant::Type

   type Variant_Type is new Interfaces.C.unsigned;

   Invalid      : constant Variant_Type := 0;
   Bool         : constant Variant_Type := 1;
   Int          : constant Variant_Type := 2;
   U_Int        : constant Variant_Type := 3;
   Long_Long    : constant Variant_Type := 4;
   U_Long_Long  : constant Variant_Type := 5;
   Double       : constant Variant_Type := 6;
   Char         : constant Variant_Type := 7;
   Map          : constant Variant_Type := 8;
   List         : constant Variant_Type := 9;
   String       : constant Variant_Type := 10;
   String_List  : constant Variant_Type := 11;
   Byte_Array   : constant Variant_Type := 12;
   Bit_Array    : constant Variant_Type := 13;
   Date         : constant Variant_Type := 14;
   Time         : constant Variant_Type := 15;
   Date_Time    : constant Variant_Type := 16;
   Url          : constant Variant_Type := 17;
   Locale       : constant Variant_Type := 18;
   Rect         : constant Variant_Type := 19;
   Rect_F       : constant Variant_Type := 20;
   Size         : constant Variant_Type := 21;
   Size_F       : constant Variant_Type := 22;
   Line         : constant Variant_Type := 23;
   Line_F       : constant Variant_Type := 24;
   Point        : constant Variant_Type := 25;
   Point_F      : constant Variant_Type := 26;
   Reg_Exp      : constant Variant_Type := 27;
   Font         : constant Variant_Type := 64;
   Pixmap       : constant Variant_Type := 65;
   Brush        : constant Variant_Type := 66;
   Color        : constant Variant_Type := 67;
   Palette      : constant Variant_Type := 68;
   Icon         : constant Variant_Type := 69;
   Image        : constant Variant_Type := 70;
   Polygon      : constant Variant_Type := 71;
   Region       : constant Variant_Type := 72;
   Bitmap       : constant Variant_Type := 73;
   Cursor       : constant Variant_Type := 74;
   Size_Policy  : constant Variant_Type := 75;
   Key_Sequence : constant Variant_Type := 76;
   Pen          : constant Variant_Type := 77;
   Text_Length  : constant Variant_Type := 78;
   Text_Format  : constant Variant_Type := 79;
   Matrix       : constant Variant_Type := 80;
   Transform    : constant Variant_Type := 81;
   User_Type    : constant Variant_Type := 127;
   Last_Type    : constant Variant_Type := 4294967295;

   Last_Core_Type : constant Variant_Type := Reg_Exp;
   Last_Gui_Type  : constant Variant_Type := Transform;

   type Q_Variant is tagged private;

   function Create
     return Q_Variant;

   function Create
    (the_type : Variant_Type)
       return Q_Variant;

   function Create
    (I : Qt4.Q_Integer)
       return Q_Variant;

   function Create
    (B : Boolean)
       return Q_Variant;

   function Create
    (D : Qt4.Q_Double)
       return Q_Variant;

   function Create
    (String : Qt4.Strings.Q_String'Class)
       return Q_Variant;

   function Create
    (Qchar : Qt4.Chars.Q_Char'Class)
       return Q_Variant;

   function Create
    (Date : Qt4.Dates.Q_Date'Class)
       return Q_Variant;

   function Create
    (Time : Qt4.Times.Q_Time'Class)
       return Q_Variant;

   function Create
    (Datetime : Qt4.Date_Times.Q_Date_Time'Class)
       return Q_Variant;

   function Create
    (Size : Qt4.Sizes.Q_Size'Class)
       return Q_Variant;

   function Create
    (Size : Qt4.Size_Fs.Q_Size_F'Class)
       return Q_Variant;

   function Create
    (Pt : Qt4.Points.Q_Point'Class)
       return Q_Variant;

   function Create
    (Pt : Qt4.Point_Fs.Q_Point_F'Class)
       return Q_Variant;

   function Create
    (Line : Qt4.Lines.Q_Line'Class)
       return Q_Variant;

   function Create
    (Line : Qt4.Line_Fs.Q_Line_F'Class)
       return Q_Variant;

   function Create
    (Rect : Qt4.Rects.Q_Rect'Class)
       return Q_Variant;

   function Create
    (Rect : Qt4.Rect_Fs.Q_Rect_F'Class)
       return Q_Variant;

   function Create
    (Reg_Exp : Qt4.Reg_Exps.Q_Reg_Exp'Class)
       return Q_Variant;

   function Create
    (Color : Qt4.Global_Color)
       return Q_Variant;

   function Can_Convert
    (Self : Q_Variant'Class;
     T : Variant_Type)
       return Boolean;

   procedure Clear
    (Self : in out Q_Variant'Class);

   function Is_Null
    (Self : Q_Variant'Class)
       return Boolean;

   function Is_Valid
    (Self : Q_Variant'Class)
       return Boolean;

   function To_Bool
    (Self : Q_Variant'Class)
       return Boolean;

   function To_Double
    (Self : Q_Variant'Class)
       return Qt4.Q_Double;

   function To_Integer
    (Self : Q_Variant'Class)
       return Qt4.Q_Integer;

   function To_Char
    (Self : Q_Variant'Class)
       return Qt4.Chars.Q_Char;

   function To_Date
    (Self : Q_Variant'Class)
       return Qt4.Dates.Q_Date;

   function To_Time
    (Self : Q_Variant'Class)
       return Qt4.Times.Q_Time;

   function To_Date_Time
    (Self : Q_Variant'Class)
       return Qt4.Date_Times.Q_Date_Time;

   function To_Line
    (Self : Q_Variant'Class)
       return Qt4.Lines.Q_Line;

   function To_Line_F
    (Self : Q_Variant'Class)
       return Qt4.Line_Fs.Q_Line_F;

   function To_Point
    (Self : Q_Variant'Class)
       return Qt4.Points.Q_Point;

   function To_Point_F
    (Self : Q_Variant'Class)
       return Qt4.Point_Fs.Q_Point_F;

   function To_Rect
    (Self : Q_Variant'Class)
       return Qt4.Rects.Q_Rect;

   function To_Rect_F
    (Self : Q_Variant'Class)
       return Qt4.Rect_Fs.Q_Rect_F;

   function To_Size
    (Self : Q_Variant'Class)
       return Qt4.Sizes.Q_Size;

   function To_Size_F
    (Self : Q_Variant'Class)
       return Qt4.Size_Fs.Q_Size_F;

   function To_String
    (Self : Q_Variant'Class)
       return Qt4.Strings.Q_String;

   function To_Reg_Exp
    (Self : Q_Variant'Class)
       return Qt4.Reg_Exps.Q_Reg_Exp;

   function Get_Type
    (Self : Q_Variant'Class)
       return Variant_Type;

   function Get_User_Type
    (Self : Q_Variant'Class)
       return Qt4.Meta_Types.Meta_Type_Type;

   overriding function "="
    (Self : Q_Variant;
     V : Q_Variant)
       return Boolean;

   package Internals is

      type QVariant is private;

      type QVariant_Access is access all QVariant;
      pragma Convention (C, QVariant_Access);

      function QVariant_View
       (Item : Q_Variant'Class)
          return QVariant_Access;
      pragma Inline (QVariant_View);

      function To_Pointer
       (Address : System.Address)
          return QVariant_Access;
      pragma Inline (To_Pointer);

      function To_Address
       (Pointer : QVariant_Access)
          return System.Address;
      pragma Inline (To_Address);

      function Create_Wrapper
       (Item : Internals.QVariant_Access)
          return Q_Variant;

      function Create
        (The_Type : Qt4.Meta_Types.Meta_Type_Type;
         Copy     : System.Address)
           return Q_Variant;

      function Const_Data (Item : Q_Variant'Class) return System.Address;

   private

      type QVariant is record
         Placeholder : Interfaces.C.char_array (1 .. Qt_Ada.Internals.Value_Class_Sizes.QVariant_C_Size_Of);
      end record;
      pragma Convention (C, QVariant);

   end Internals;

   package Thin is

      function copy_QVariant
       (Cpp_Object : not null access Internals.QVariant)
        return not null access Internals.QVariant;
      pragma Import (C, copy_QVariant, "__Qt4Ada_copy_QVariant");

      procedure assign_QVariant
       (S_1 : not null access          Internals.QVariant;
        S_2 : not null access constant Internals.QVariant);
      pragma Import (C, assign_QVariant, "__Qt4Ada_assing_QVariant");

   end Thin;

private

   type Q_Variant is new Ada.Finalization.Controlled with record
      Storage : aliased Internals.QVariant;
      Object  : Internals.QVariant_Access := null;
      Wrapper : Boolean := False;
   end record;

   overriding
   procedure Adjust (Self : in out Q_Variant);

   overriding
   procedure Finalize (Self : in out Q_Variant);

   overriding
   procedure Initialize (Self : in out Q_Variant);

end Qt4.Variants;
