]>
Commit | Line | Data |
---|---|---|
d23b8f57 RK |
1 | ------------------------------------------------------------------------------ |
2 | -- -- | |
3 | -- GNAT RUN-TIME COMPONENTS -- | |
4 | -- -- | |
5 | -- A D A . C H A R A C T E R S . H A N D L I N G -- | |
6 | -- -- | |
7 | -- S p e c -- | |
8 | -- -- | |
748086b7 | 9 | -- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- |
d23b8f57 RK |
10 | -- -- |
11 | -- This specification is derived from the Ada Reference Manual for use with -- | |
12 | -- GNAT. The copyright notice above, and the license provisions that follow -- | |
13 | -- apply solely to the contents of the part following the private keyword. -- | |
14 | -- -- | |
15 | -- GNAT is free software; you can redistribute it and/or modify it under -- | |
16 | -- terms of the GNU General Public License as published by the Free Soft- -- | |
748086b7 | 17 | -- ware Foundation; either version 3, or (at your option) any later ver- -- |
d23b8f57 RK |
18 | -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
19 | -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- | |
748086b7 JJ |
20 | -- or FITNESS FOR A PARTICULAR PURPOSE. -- |
21 | -- -- | |
22 | -- As a special exception under Section 7 of GPL version 3, you are granted -- | |
23 | -- additional permissions described in the GCC Runtime Library Exception, -- | |
24 | -- version 3.1, as published by the Free Software Foundation. -- | |
25 | -- -- | |
26 | -- You should have received a copy of the GNU General Public License and -- | |
27 | -- a copy of the GCC Runtime Library Exception along with this program; -- | |
28 | -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- | |
29 | -- <http://www.gnu.org/licenses/>. -- | |
d23b8f57 RK |
30 | -- -- |
31 | -- GNAT was originally developed by the GNAT team at New York University. -- | |
71ff80dc | 32 | -- Extensive contributions were provided by Ada Core Technologies Inc. -- |
d23b8f57 RK |
33 | -- -- |
34 | ------------------------------------------------------------------------------ | |
35 | ||
d23b8f57 | 36 | package Ada.Characters.Handling is |
009186e0 AC |
37 | pragma Preelaborate; |
38 | pragma Pure_05; | |
39 | -- In accordance with Ada 2005 AI-362 | |
d23b8f57 RK |
40 | |
41 | ---------------------------------------- | |
42 | -- Character Classification Functions -- | |
43 | ---------------------------------------- | |
44 | ||
82c80734 RD |
45 | function Is_Control (Item : Character) return Boolean; |
46 | function Is_Graphic (Item : Character) return Boolean; | |
47 | function Is_Letter (Item : Character) return Boolean; | |
48 | function Is_Lower (Item : Character) return Boolean; | |
49 | function Is_Upper (Item : Character) return Boolean; | |
50 | function Is_Basic (Item : Character) return Boolean; | |
51 | function Is_Digit (Item : Character) return Boolean; | |
52 | function Is_Decimal_Digit (Item : Character) return Boolean | |
53 | renames Is_Digit; | |
54 | function Is_Hexadecimal_Digit (Item : Character) return Boolean; | |
55 | function Is_Alphanumeric (Item : Character) return Boolean; | |
56 | function Is_Special (Item : Character) return Boolean; | |
d23b8f57 RK |
57 | |
58 | --------------------------------------------------- | |
59 | -- Conversion Functions for Character and String -- | |
60 | --------------------------------------------------- | |
61 | ||
82c80734 RD |
62 | function To_Lower (Item : Character) return Character; |
63 | function To_Upper (Item : Character) return Character; | |
64 | function To_Basic (Item : Character) return Character; | |
d23b8f57 | 65 | |
82c80734 RD |
66 | function To_Lower (Item : String) return String; |
67 | function To_Upper (Item : String) return String; | |
68 | function To_Basic (Item : String) return String; | |
d23b8f57 RK |
69 | |
70 | ---------------------------------------------------------------------- | |
71 | -- Classifications of and Conversions Between Character and ISO 646 -- | |
72 | ---------------------------------------------------------------------- | |
73 | ||
74 | subtype ISO_646 is | |
75 | Character range Character'Val (0) .. Character'Val (127); | |
76 | ||
82c80734 RD |
77 | function Is_ISO_646 (Item : Character) return Boolean; |
78 | function Is_ISO_646 (Item : String) return Boolean; | |
d23b8f57 RK |
79 | |
80 | function To_ISO_646 | |
82c80734 RD |
81 | (Item : Character; |
82 | Substitute : ISO_646 := ' ') return ISO_646; | |
d23b8f57 RK |
83 | |
84 | function To_ISO_646 | |
82c80734 RD |
85 | (Item : String; |
86 | Substitute : ISO_646 := ' ') return String; | |
d23b8f57 RK |
87 | |
88 | ------------------------------------------------------ | |
89 | -- Classifications of Wide_Character and Characters -- | |
90 | ------------------------------------------------------ | |
91 | ||
6d158291 | 92 | -- Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions |
4378d234 RD |
93 | -- and are considered obsolete in Ada.Characters.Handling. However we do |
94 | -- not complain about this obsolescence, since in practice it is necessary | |
8fc789c8 | 95 | -- to use these routines when creating code that is intended to run in |
4378d234 | 96 | -- either Ada 95 or Ada 2005 mode. |
d23b8f57 | 97 | |
6d158291 | 98 | function Is_Character (Item : Wide_Character) return Boolean; |
4378d234 | 99 | function Is_String (Item : Wide_String) return Boolean; |
6d158291 RD |
100 | |
101 | ------------------------------------------------------ | |
102 | -- Conversions between Wide_Character and Character -- | |
103 | ------------------------------------------------------ | |
104 | ||
105 | -- Ada 2005 AI 395: these functions are moved to Ada.Characters.Conversions | |
4378d234 RD |
106 | -- and are considered obsolete in Ada.Characters.Handling. However we do |
107 | -- not complain about this obsolescence, since in practice it is necessary | |
8fc789c8 | 108 | -- to use these routines when creating code that is intended to run in |
4378d234 | 109 | -- either Ada 95 or Ada 2005 mode. |
82c80734 RD |
110 | |
111 | function To_Character | |
6d158291 RD |
112 | (Item : Wide_Character; |
113 | Substitute : Character := ' ') return Character; | |
d23b8f57 RK |
114 | |
115 | function To_String | |
82c80734 | 116 | (Item : Wide_String; |
6d158291 | 117 | Substitute : Character := ' ') return String; |
82c80734 RD |
118 | |
119 | function To_Wide_Character | |
6d158291 | 120 | (Item : Character) return Wide_Character; |
82c80734 RD |
121 | |
122 | function To_Wide_String | |
4378d234 | 123 | (Item : String) return Wide_String; |
d23b8f57 RK |
124 | |
125 | private | |
126 | pragma Inline (Is_Control); | |
127 | pragma Inline (Is_Graphic); | |
128 | pragma Inline (Is_Letter); | |
129 | pragma Inline (Is_Lower); | |
130 | pragma Inline (Is_Upper); | |
131 | pragma Inline (Is_Basic); | |
132 | pragma Inline (Is_Digit); | |
133 | pragma Inline (Is_Hexadecimal_Digit); | |
134 | pragma Inline (Is_Alphanumeric); | |
135 | pragma Inline (Is_Special); | |
136 | pragma Inline (To_Lower); | |
137 | pragma Inline (To_Upper); | |
138 | pragma Inline (To_Basic); | |
139 | pragma Inline (Is_ISO_646); | |
140 | pragma Inline (Is_Character); | |
141 | pragma Inline (To_Character); | |
142 | pragma Inline (To_Wide_Character); | |
143 | ||
144 | end Ada.Characters.Handling; |