1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- A D A . W I D E _ C H A R A C T E R S . H A N D L I N G --
9 -- Copyright (C) 2010-2013, Free Software Foundation, Inc. --
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. --
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. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 with Ada
.Wide_Characters
.Unicode
; use Ada
.Wide_Characters
.Unicode
;
34 package body Ada
.Wide_Characters
.Handling
is
36 function Character_Set_Version
return String is
39 end Character_Set_Version
;
45 function Is_Alphanumeric
(Item
: Wide_Character) return Boolean is
47 return Is_Letter
(Item
) or else Is_Digit
(Item
);
54 function Is_Control
(Item
: Wide_Character) return Boolean is
56 return Get_Category
(Item
) = Cc
;
63 function Is_Digit
(Item
: Wide_Character) return Boolean
64 renames Ada
.Wide_Characters
.Unicode
.Is_Digit
;
70 function Is_Graphic
(Item
: Wide_Character) return Boolean is
72 return not Is_Non_Graphic
(Item
);
75 --------------------------
76 -- Is_Hexadecimal_Digit --
77 --------------------------
79 function Is_Hexadecimal_Digit
(Item
: Wide_Character) return Boolean is
81 return Is_Digit
(Item
)
82 or else Item
in 'A' .. 'F'
83 or else Item
in 'a' .. 'f';
84 end Is_Hexadecimal_Digit
;
90 function Is_Letter
(Item
: Wide_Character) return Boolean
91 renames Ada
.Wide_Characters
.Unicode
.Is_Letter
;
93 ------------------------
94 -- Is_Line_Terminator --
95 ------------------------
97 function Is_Line_Terminator
(Item
: Wide_Character) return Boolean
98 renames Ada
.Wide_Characters
.Unicode
.Is_Line_Terminator
;
104 function Is_Lower
(Item
: Wide_Character) return Boolean is
106 return Get_Category
(Item
) = Ll
;
113 function Is_Mark
(Item
: Wide_Character) return Boolean
114 renames Ada
.Wide_Characters
.Unicode
.Is_Mark
;
116 ---------------------
117 -- Is_Other_Format --
118 ---------------------
120 function Is_Other_Format
(Item
: Wide_Character) return Boolean
121 renames Ada
.Wide_Characters
.Unicode
.Is_Other
;
123 ------------------------------
124 -- Is_Punctuation_Connector --
125 ------------------------------
127 function Is_Punctuation_Connector
(Item
: Wide_Character) return Boolean
128 renames Ada
.Wide_Characters
.Unicode
.Is_Punctuation
;
134 function Is_Space
(Item
: Wide_Character) return Boolean
135 renames Ada
.Wide_Characters
.Unicode
.Is_Space
;
141 function Is_Special
(Item
: Wide_Character) return Boolean is
143 return Is_Graphic
(Item
) and then not Is_Alphanumeric
(Item
);
150 function Is_Upper
(Item
: Wide_Character) return Boolean is
152 return Get_Category
(Item
) = Lu
;
159 function To_Lower
(Item
: Wide_Character) return Wide_Character
160 renames Ada
.Wide_Characters
.Unicode
.To_Lower_Case
;
162 function To_Lower
(Item
: Wide_String) return Wide_String is
163 Result
: Wide_String (Item
'Range);
166 for J
in Result
'Range loop
167 Result
(J
) := To_Lower
(Item
(J
));
177 function To_Upper
(Item
: Wide_Character) return Wide_Character
178 renames Ada
.Wide_Characters
.Unicode
.To_Upper_Case
;
180 function To_Upper
(Item
: Wide_String) return Wide_String is
181 Result
: Wide_String (Item
'Range);
184 for J
in Result
'Range loop
185 Result
(J
) := To_Upper
(Item
(J
));
191 end Ada
.Wide_Characters
.Handling
;