4 with Ada
.Iterator_Interfaces
;
8 subtype Size
is Ada
.Directories
.File_Size
;
10 type Folder
is new String;
12 function Folder_Separator
return Character;
14 function "+" (Directory
: String) return Folder
;
16 function "+" (Left
, Right
: String) return Folder
;
18 function "+" (Left
: Folder
;
19 Right
: String) return Folder
;
21 function Composure
(Directory
: Folder
;
23 Extension
: String) return String;
25 function Composure
(Directory
: String;
27 Extension
: String) return String;
30 function Base_Name_Of
(Name
: String) return String
31 renames Ada
.Directories
.Base_Name
;
33 function Extension_Of
(Name
: String) return String
34 renames Ada
.Directories
.Extension
;
36 function Containing_Directory_Of
(Name
: String) return String
37 renames Ada
.Directories
.Containing_Directory
;
39 function Exists
(Name
: String) return Boolean;
42 function Size_Of
(Name
: String) return Size
renames Ada
.Directories
.Size
;
44 function Directory_Exists
(Name
: String) return Boolean;
47 function Modification_Time_Of
(Name
: String) return Ada
.Calendar
.Time
48 renames Ada
.Directories
.Modification_Time
;
50 function Is_Newer
(The_Name
: String;
51 Than_Name
: String) return Boolean;
53 procedure Delete
(Name
: String);
54 -- no exception if no existance
56 procedure Create_Directory
(Path
: String);
57 -- creates the whole directory path
59 procedure Delete_Directory
(Name
: String); -- including contents
60 -- no exception if no existance
62 procedure Rename
(Old_Name
: String;
63 New_Name
: String) renames Ada
.Directories
.Rename
;
65 procedure Copy
(Source_Name
: String;
68 renames Ada
.Directories
.Copy_File
;
70 function Is_Leaf_Directory
(Directory
: String) return Boolean;
72 procedure Iterate_Over_Leaf_Directories
(From_Directory
: String;
73 Iterator
: access procedure
74 (Leaf_Directory
: String));
76 function Found_Directory
(Simple_Name
: String;
77 In_Directory
: String) return String;
79 Not_Found
: exception;
81 Name_Error
: exception renames Ada
.Directories
.Name_Error
;
82 Use_Error
: exception renames Ada
.Directories
.Use_Error
;
84 ------------------------
85 -- File Iterator Loop --
86 ------------------------
88 -- for The_Filename of Iter5_Pkg.Iterator_For ("C:\Program_Files") loop
89 -- Log.Write (The_Filename);
92 type Item
(Name_Length
: Natural) is limited private;
94 function Iterator_For
(Name
: String) return Item
;
99 function Has_More
(Data
: Cursor
) return Boolean;
101 package List_Iterator_Interfaces
is
102 new Ada
.Iterator_Interfaces
(Cursor
, Has_More
);
104 function Iterate
(The_Item
: Item
)
105 return List_Iterator_Interfaces
.Forward_Iterator
'class;
107 type Cursor_Data
is record
108 Has_More
: Boolean := False;
109 Position
: Ada
.Directories
.Search_Type
;
112 type Cursor
is access all Cursor_Data
;
114 function Constant_Reference
(The_Item
: aliased Item
;
115 Unused_Index
: Cursor
) return String;
117 type Item
(Name_Length
: Natural) is tagged limited record
118 Name
: String(1..Name_Length
);
119 Actual
: Ada
.Directories
.Directory_Entry_Type
;
120 Data
: aliased Cursor_Data
;
123 Constant_Indexing
=> Constant_Reference
,
124 Default_Iterator
=> Iterate
,
125 Iterator_Element
=> String;