mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 03:40:26 +08:00
a-direct.ads, [...] (Search): New procedure in Ada 2005
2006-10-31 Vincent Celier <celier@adacore.com> * a-direct.ads, a-direct.adb (Search): New procedure in Ada 2005 From-SVN: r118322
This commit is contained in:
parent
271ae089f3
commit
57d9e177cc
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- B o d y --
|
||||
-- --
|
||||
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- GNAT 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- --
|
||||
@ -835,6 +835,30 @@ package body Ada.Directories is
|
||||
end if;
|
||||
end Rename;
|
||||
|
||||
------------
|
||||
-- Search --
|
||||
------------
|
||||
|
||||
procedure Search
|
||||
(Directory : String;
|
||||
Pattern : String;
|
||||
Filter : Filter_Type := (others => True);
|
||||
Process : not null access procedure
|
||||
(Directory_Entry : Directory_Entry_Type))
|
||||
is
|
||||
Srch : Search_Type;
|
||||
Directory_Entry : Directory_Entry_Type;
|
||||
begin
|
||||
Start_Search (Srch, Directory, Pattern, Filter);
|
||||
|
||||
while More_Entries (Srch) loop
|
||||
Get_Next_Entry (Srch, Directory_Entry);
|
||||
Process (Directory_Entry);
|
||||
end loop;
|
||||
|
||||
End_Search (Srch);
|
||||
end Search;
|
||||
|
||||
-------------------
|
||||
-- Set_Directory --
|
||||
-------------------
|
||||
|
@ -6,7 +6,7 @@
|
||||
-- --
|
||||
-- S p e c --
|
||||
-- --
|
||||
-- Copyright (C) 2004-2005, Free Software Foundation, Inc. --
|
||||
-- Copyright (C) 2004-2006, Free Software Foundation, Inc. --
|
||||
-- --
|
||||
-- This specification is derived for use with GNAT from AI-00248, which is --
|
||||
-- expected to be a part of a future expected revised Ada Reference Manual. --
|
||||
@ -340,6 +340,24 @@ package Ada.Directories is
|
||||
-- environment does not support continued searching of the directory
|
||||
-- represented by Search.
|
||||
|
||||
procedure Search
|
||||
(Directory : String;
|
||||
Pattern : String;
|
||||
Filter : Filter_Type := (others => True);
|
||||
Process : not null access procedure
|
||||
(Directory_Entry : Directory_Entry_Type));
|
||||
-- Searches in the directory named by Directory for entries matching
|
||||
-- Pattern. The subprogram designated by Process is called with each
|
||||
-- matching entry in turn. Pattern represents a pattern for matching file
|
||||
-- names. If Pattern is null, all items in the directory are matched;
|
||||
-- otherwise, the interpretation of Pattern is implementation-defined.
|
||||
-- Only items that match Filter will be returned. The exception Name_Error
|
||||
-- is propagated if the string given by Directory does not identify
|
||||
-- an existing directory, or if Pattern does not allow the identification
|
||||
-- of any possible external file or directory. The exception Use_Error is
|
||||
-- propagated if the external environment does not support the searching
|
||||
-- of the directory with the given name (in the absence of Name_Error).
|
||||
|
||||
-------------------------------------
|
||||
-- Operations on Directory Entries --
|
||||
-------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user