------------------------------------------------------------------------------
--                                                                          --
--                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.String_Lists;
with Qt4.Strings;
with Qt_Ada.Internals.Value_Class_Sizes;

package Qt4.Reg_Exps is

   --  QRegExp::CaretMode

   type Caret_Mode is
    (Caret_At_Zero,
     Caret_At_Offset,
     Caret_Wont_Match);
   pragma Convention (C, Caret_Mode);
   for Caret_Mode'Size use Interfaces.C.unsigned'Size;

   --  QRegExp::PatternSyntax

   type Reg_Exp_Pattern_Syntax is
    (Reg_Exp,
     Wildcard,
     Fixed_String,
     Reg_Exp_2);
   pragma Convention (C, Reg_Exp_Pattern_Syntax);
   for Reg_Exp_Pattern_Syntax'Size use Interfaces.C.unsigned'Size;

   type Q_Reg_Exp is tagged private;

   function Create
    (Pattern : in Qt4.Strings.Q_String'Class;
     Cs : in Qt4.Case_Sensitivity
       := Case_Sensitive;
     Syntax : in Reg_Exp_Pattern_Syntax
       := Reg_Exp)
       return Q_Reg_Exp;

   function Cap
    (Self : not null access Q_Reg_Exp'Class;
     Nth : in Qt4.Q_Integer
       := 0)
       return Qt4.Strings.Q_String;

   function Captured_Texts
    (Self : not null access Q_Reg_Exp'Class)
       return Qt4.String_Lists.Q_String_List;

   function Case_Sensitivity
    (Self : in Q_Reg_Exp'Class)
       return Qt4.Case_Sensitivity;

   function Error_String
    (Self : not null access Q_Reg_Exp'Class)
       return Qt4.Strings.Q_String;

   function Exact_Match
    (Self : in Q_Reg_Exp'Class;
     Str : in Qt4.Strings.Q_String'Class)
       return Boolean;

   function Index_In
    (Self : in Q_Reg_Exp'Class;
     Str : in Qt4.Strings.Q_String'Class;
     Offset : in Qt4.Q_Integer
       := 0;
     Mode : in Caret_Mode
       := Caret_At_Zero)
       return Qt4.Q_Integer;

   function Is_Empty
    (Self : in Q_Reg_Exp'Class)
       return Boolean;

   function Is_Minimal
    (Self : in Q_Reg_Exp'Class)
       return Boolean;

   function Is_Valid
    (Self : in Q_Reg_Exp'Class)
       return Boolean;

   function Last_Index_In
    (Self : in Q_Reg_Exp'Class;
     Str : in Qt4.Strings.Q_String'Class;
     Offset : in Qt4.Q_Integer
       := -1;
     Mode : in Caret_Mode
       := Caret_At_Zero)
       return Qt4.Q_Integer;

   function Matched_Length
    (Self : in Q_Reg_Exp'Class)
       return Qt4.Q_Integer;

   function Num_Captures
    (Self : in Q_Reg_Exp'Class)
       return Qt4.Q_Integer;

   function Pattern
    (Self : in Q_Reg_Exp'Class)
       return Qt4.Strings.Q_String;

   function Pattern_Syntax
    (Self : in Q_Reg_Exp'Class)
       return Reg_Exp_Pattern_Syntax;

   function Pos
    (Self : not null access Q_Reg_Exp'Class;
     Nth : in Qt4.Q_Integer
       := 0)
       return Qt4.Q_Integer;

   procedure Set_Case_Sensitivity
    (Self : in out Q_Reg_Exp'Class;
     Cs : in Qt4.Case_Sensitivity);

   procedure Set_Minimal
    (Self : in out Q_Reg_Exp'Class;
     Minimal : in Boolean);

   procedure Set_Pattern
    (Self : in out Q_Reg_Exp'Class;
     Pattern : in Qt4.Strings.Q_String'Class);

   procedure Set_Pattern_Syntax
    (Self : in out Q_Reg_Exp'Class;
     Syntax : in Reg_Exp_Pattern_Syntax);

   function Escape
    (Str : in Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   function "="
    (Self : in Q_Reg_Exp;
     Rx : in Q_Reg_Exp)
       return Boolean;

   package Internals is

      type QRegExp is private;

      type QRegExp_Access is access all QRegExp;
      pragma Convention (C, QRegExp_Access);

      function QRegExp_View
       (Item : in Q_Reg_Exp'Class)
          return QRegExp_Access;
      pragma Inline (QRegExp_View);

      function Create_Wrapper
       (Item : in Internals.QRegExp_Access)
          return Q_Reg_Exp;

   private

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

   end Internals;

private

   type Q_Reg_Exp is new Ada.Finalization.Controlled with record
      Storage : aliased Internals.QRegExp;
      Object  : Internals.QRegExp_Access := null;
      Wrapper : Boolean := False;
   end record;

   overriding
   procedure Adjust (Self : in out Q_Reg_Exp);

   overriding
   procedure Finalize (Self : in out Q_Reg_Exp);

   overriding
   procedure Initialize (Self : in out Q_Reg_Exp);

end Qt4.Reg_Exps;
