1------------------------------------------------------------------------------ 2-- -- 3-- GNAT RUN-TIME COMPONENTS -- 4-- -- 5-- ADA.DIRECTORIES.HIERARCHICAL_FILE_NAMES -- 6-- -- 7-- S p e c -- 8-- -- 9-- Copyright (C) 2004-2020, Free Software Foundation, Inc. -- 10-- -- 11-- GNAT is free software; you can redistribute it and/or modify it under -- 12-- terms of the GNU General Public License as published by the Free Soft- -- 13-- ware Foundation; either version 3, or (at your option) any later ver- -- 14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 16-- or FITNESS FOR A PARTICULAR PURPOSE. -- 17-- -- 18-- As a special exception under Section 7 of GPL version 3, you are granted -- 19-- additional permissions described in the GCC Runtime Library Exception, -- 20-- version 3.1, as published by the Free Software Foundation. -- 21-- -- 22-- In particular, you can freely distribute your programs built with the -- 23-- GNAT Pro compiler, including any required library run-time units, using -- 24-- any licensing terms of your choosing. See the AdaCore Software License -- 25-- for full details. -- 26-- -- 27-- GNAT was originally developed by the GNAT team at New York University. -- 28-- Extensive contributions were provided by Ada Core Technologies Inc. -- 29-- -- 30------------------------------------------------------------------------------ 31 32package Ada.Directories.Hierarchical_File_Names is 33 34 function Is_Simple_Name (Name : String) return Boolean; 35 -- Returns True if Name is a simple name, and returns False otherwise. 36 37 function Is_Root_Directory_Name (Name : String) return Boolean; 38 -- Returns True if Name is syntactically a root (a directory that cannot 39 -- be decomposed further), and returns False otherwise. 40 41 function Is_Parent_Directory_Name (Name : String) return Boolean; 42 -- Returns True if Name can be used to indicate symbolically the parent 43 -- directory of any directory, and returns False otherwise. 44 45 function Is_Current_Directory_Name (Name : String) return Boolean; 46 -- Returns True if Name can be used to indicate symbolically the directory 47 -- itself for any directory, and returns False otherwise. 48 49 function Is_Full_Name (Name : String) return Boolean; 50 -- Returns True if the leftmost directory part of Name is a root, and 51 -- returns False otherwise. 52 53 function Is_Relative_Name (Name : String) return Boolean; 54 -- Returns True if Name allows the identification of an external file 55 -- (including directories and special files) but is not a full name, and 56 -- returns False otherwise. 57 58 function Simple_Name (Name : String) return String 59 renames Ada.Directories.Simple_Name; 60 -- Returns the simple name portion of the file name specified by Name. The 61 -- exception Name_Error is propagated if the string given as Name does not 62 -- allow the identification of an external file (including directories and 63 -- special files). 64 65 function Containing_Directory (Name : String) return String 66 renames Ada.Directories.Containing_Directory; 67 -- Returns the name of the containing directory of the external file 68 -- (including directories) identified by Name. If more than one directory 69 -- can contain Name, the directory name returned is implementation-defined. 70 -- The exception Name_Error is propagated if the string given as Name does 71 -- not allow the identification of an external file. The exception 72 -- Use_Error is propagated if the external file does not have a containing 73 -- directory. 74 75 function Initial_Directory (Name : String) return String; 76 -- Returns the leftmost directory part in Name. That is, it returns a root 77 -- directory name (for a full name), or one of a parent directory name, a 78 -- current directory name, or a simple name (for a relative name). The 79 -- exception Name_Error is propagated if the string given as Name does not 80 -- allow the identification of an external file (including directories and 81 -- special files). 82 83 function Relative_Name (Name : String) return String; 84 -- Returns the entire file name except the Initial_Directory portion. The 85 -- exception Name_Error is propagated if the string given as Name does not 86 -- allow the identification of an external file (including directories and 87 -- special files), or if Name has a single part (this includes if any of 88 -- Is_Simple_Name, Is_Root_Directory_Name, Is_Parent_Directory_Name, or 89 -- Is_Current_Directory_Name are True). 90 91 function Compose 92 (Directory : String := ""; 93 Relative_Name : String; 94 Extension : String := "") return String; 95 -- Returns the name of the external file with the specified Directory, 96 -- Relative_Name, and Extension. The exception Name_Error is propagated if 97 -- the string given as Directory is not the null string and does not allow 98 -- the identification of a directory, or if Is_Relative_Name 99 -- (Relative_Name) is False, or if the string given as Extension is not 100 -- the null string and is not a possible extension, or if Extension is not 101 -- the null string and Simple_Name (Relative_Name) is not a base name. 102 -- 103 -- The result of Compose is a full name if Is_Full_Name (Directory) is 104 -- True; result is a relative name otherwise. 105 106end Ada.Directories.Hierarchical_File_Names; 107