1-------------------------------------------------------------------------------
2--
3--  This file is part of AdaBrowse.
4--
5-- <STRONG>Copyright (c) 2002 by Thomas Wolf.</STRONG>
6-- <BLOCKQUOTE>
7--    AdaBrowse is free software; you can redistribute it and/or modify it
8--    under the terms of the  GNU General Public License as published by the
9--    Free Software  Foundation; either version 2, or (at your option) any
10--    later version. AdaBrowse is distributed in the hope that it will be
11--    useful, but <EM>without any warranty</EM>; without even the implied
12--    warranty of <EM>merchantability or fitness for a particular purpose.</EM>
13--    See the GNU General Public License for  more details. You should have
14--    received a copy of the GNU General Public License with this distribution,
15--    see file "<A HREF="GPL.txt">GPL.txt</A>". If not, write to the Free
16--    Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17--    USA.
18-- </BLOCKQUOTE>
19--
20-- <DL><DT><STRONG>
21-- Author:</STRONG><DD>
22--   Thomas Wolf  (TW)
23--   <ADDRESS><A HREF="mailto:twolf@acm.org">twolf@acm.org</A></ADDRESS></DL>
24--
25-- <DL><DT><STRONG>
26-- Purpose:</STRONG><DD>
27--   Miscellaneous text utilities.</DL>
28--
29-- <!--
30-- Revision History
31--
32--   02-FEB-2002   TW  First release.
33--   07-FEB-2002   TW  Added 'Quote'.
34--   06-JUN-2003   TW  Added 'To_Lower' and 'To_Upper'.
35--   11-JUN-2003   TW  Added 'Canonical'.
36--   22-JUL-2003   TW  Removed 'To_Lower' and 'To_Upper'.
37-- -->
38-------------------------------------------------------------------------------
39
40pragma License (GPL);
41
42with Ada.Characters.Handling;
43
44package AD.Text_Utilities is
45
46   pragma Elaborate_Body;
47
48   function To_String
49     (S          : in Wide_String;
50      Substitute : in Character := ' ')
51     return String
52     renames Ada.Characters.Handling.To_String;
53
54   function To_Wide_String
55     (S : in String)
56     return Wide_String
57     renames Ada.Characters.Handling.To_Wide_String;
58
59   function Canonical
60     (Suspicious_Name : in String)
61     return String;
62   --  Canonicalized the file name to make sure that all \ or / are replaced
63   --  by the current directory separator.
64
65   function To_File_Name
66     (Unit_Name : in String;
67      Suffix    : in String := "ads")
68     return String;
69   --  Replaces all '.' in Unit_Name by '-', maps the whole thing to lower
70   --  case, appends '.' & Suffix, and returns the resulting string.
71
72   function Quote
73     (S : in String)
74     return String;
75   --  If 'S' does not contain white space nor single or double quotes,
76   --  returns 'S'. Otherwise, encloses 'S' in double quotes and inserts
77   --  a backslash ('\') before any double quote within 'S'.
78
79end AD.Text_Utilities;
80