------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2009-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.String_Lists;
with Qt4.Strings;
with Qt_Ada.Internals.Generic_Q_Flags;
private with Qt_Ada.Internals.Value_Class_Sizes;

package Qt4.Dirs is

   --  QDir::Filter

   type Filter is
    (Dirs,
     Files,
     Drives,
     No_Sym_Links,
     Readable,
     Writable,
     Executable,
     Modified,
     Hidden,
     System,
     All_Dirs,
     Case_Sensitive,
     No_Dot_And_Dot_Dot);
   pragma Convention (C, Filter);
   for Filter'Size use Interfaces.C.unsigned'Size;
   for Filter use
    (Dirs               => 1,
     Files              => 2,
     Drives             => 4,
     No_Sym_Links       => 8,
     Readable           => 16,
     Writable           => 32,
     Executable         => 64,
     Modified           => 128,
     Hidden             => 256,
     System             => 512,
     All_Dirs           => 1024,
     Case_Sensitive     => 2048,
     No_Dot_And_Dot_Dot => 4096);

   --  Qt::Filters

   package Q_Flags_Of_Filter is
     new Qt_Ada.Internals.Generic_Q_Flags (Filter);

   type Filters is new Q_Flags_Of_Filter.Flags;

   Type_Mask       : constant Filters
     := Dirs or Files or Drives or No_Sym_Links;
   Permission_Mask : constant Filters
     := Readable or Writable or Executable;
   Access_Mask     : constant Filters
     := Readable or Writable or Executable or Modified or Hidden or System;

   type Q_Dir is tagged private;

   function Create
    (Path : Qt4.Strings.Q_String'Class)
       return Q_Dir;

   function Absolute_File_Path
    (Self : Q_Dir'Class;
     File_Name : Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   function Absolute_Path
    (Self : Q_Dir'Class)
       return Qt4.Strings.Q_String;

   function Canonical_Path
    (Self : Q_Dir'Class)
       return Qt4.Strings.Q_String;

   function Cd
    (Self : not null access Q_Dir'Class;
     Dir_Name : Qt4.Strings.Q_String'Class)
       return Boolean;

   procedure Cd_Up
    (Self : in out Q_Dir'Class);

   function Count
    (Self : Q_Dir'Class)
       return Qt4.Q_Unsigned_Integer;

   function Dir_Name
    (Self : Q_Dir'Class)
       return Qt4.Strings.Q_String;

   function Exists
    (Self : Q_Dir'Class;
     Name : Qt4.Strings.Q_String'Class)
       return Boolean;

   function Exists
    (Self : Q_Dir'Class)
       return Boolean;

   function File_Path
    (Self : Q_Dir'Class;
     File_Name : Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   function Is_Absolute
    (Self : Q_Dir'Class)
       return Boolean;

   function Is_Readable
    (Self : Q_Dir'Class)
       return Boolean;

   function Is_Relative
    (Self : Q_Dir'Class)
       return Boolean;

   function Is_Root
    (Self : Q_Dir'Class)
       return Boolean;

   procedure Make_Absolute
    (Self : in out Q_Dir'Class);

   function Mkdir
    (Self : not null access Q_Dir'Class;
     Dir_Name : Qt4.Strings.Q_String'Class)
       return Boolean;

   function Mkpath
    (Self : not null access Q_Dir'Class;
     Dir_Path : Qt4.Strings.Q_String'Class)
       return Boolean;

   function Name_Filters
    (Self : Q_Dir'Class)
       return Qt4.String_Lists.Q_String_List;

   function Path
    (Self : Q_Dir'Class)
       return Qt4.Strings.Q_String;

   procedure Refresh
    (Self : Q_Dir'Class);

   function Relative_File_Path
    (Self : Q_Dir'Class;
     File_Name : Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   function Remove
    (Self : not null access Q_Dir'Class;
     File_Name : Qt4.Strings.Q_String'Class)
       return Boolean;

   function Rename
    (Self : not null access Q_Dir'Class;
     Old_Name : Qt4.Strings.Q_String'Class;
     New_Name : Qt4.Strings.Q_String'Class)
       return Boolean;

   function Rmdir
    (Self : not null access Q_Dir'Class;
     Dir_Name : Qt4.Strings.Q_String'Class)
       return Boolean;

   function Rmpath
    (Self : not null access Q_Dir'Class;
     Dir_Path : Qt4.Strings.Q_String'Class)
       return Boolean;

   procedure Set_Filter
    (Self : in out Q_Dir'Class;
     Filters : Filter);

   procedure Set_Name_Filters
    (Self : in out Q_Dir'Class;
     Name_Filters : Qt4.String_Lists.Q_String_List'Class);

   procedure Set_Path
    (Self : in out Q_Dir'Class;
     Path : Qt4.Strings.Q_String'Class);

   procedure Add_Search_Path
    (Prefix : in Qt4.Strings.Q_String'Class;
     Path : in Qt4.Strings.Q_String'Class);

   function Clean_Path
    (Path : in Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   function Current
     return Q_Dir;

   function Current_Path
     return Qt4.Strings.Q_String;

   function From_Native_Separators
    (Path_Name : in Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   function Home
     return Q_Dir;

   function Home_Path
     return Qt4.Strings.Q_String;

   function Is_Absolute_Path
    (Path : in Qt4.Strings.Q_String'Class)
       return Boolean;

   function Is_Relative_Path
    (Path : in Qt4.Strings.Q_String'Class)
       return Boolean;

   function Match
    (Filter : in Qt4.Strings.Q_String'Class;
     File_Name : in Qt4.Strings.Q_String'Class)
       return Boolean;

   function Match
    (Filters : in Qt4.String_Lists.Q_String_List'Class;
     File_Name : in Qt4.Strings.Q_String'Class)
       return Boolean;

   function Root
     return Q_Dir;

   function Root_Path
     return Qt4.Strings.Q_String;

   function Search_Paths
    (Prefix : in Qt4.Strings.Q_String'Class)
       return Qt4.String_Lists.Q_String_List;

   function Separator
     return Qt4.Chars.Q_Char;

   function Set_Current
    (Path : in Qt4.Strings.Q_String'Class)
       return Boolean;

   procedure Set_Search_Paths
    (Prefix : in Qt4.Strings.Q_String'Class;
     Search_Paths : in Qt4.String_Lists.Q_String_List'Class);

   function Temp
     return Q_Dir;

   function Temp_Path
     return Qt4.Strings.Q_String;

   function To_Native_Separators
    (Path_Name : in Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String;

   overriding function "="
    (Self : Q_Dir;
     Dir : Q_Dir)
       return Boolean;

   package Internals is

      type QDir is private;

      type QDir_Access is access all QDir;
      pragma Convention (C, QDir_Access);

      function QDir_View
       (Item : Q_Dir'Class)
          return QDir_Access;
      pragma Inline (QDir_View);

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

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

      function Create_Wrapper
       (Item : Internals.QDir_Access)
          return Q_Dir;

   private

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

   end Internals;

private

   type Q_Dir is new Ada.Finalization.Controlled with record
      Storage : aliased Internals.QDir;
      Object  : Internals.QDir_Access := null;
      Wrapper : Boolean := False;
   end record;

   overriding
   procedure Adjust (Self : in out Q_Dir);

   overriding
   procedure Finalize (Self : in out Q_Dir);

   overriding
   procedure Initialize (Self : in out Q_Dir);

end Qt4.Dirs;
