A.4.8 Wide_Wide_String Handling
1/2
{
AI95-00285-01}
{
AI95-00395-01}
Facilities for handling strings of Wide_Wide_Character
elements are found in the packages Strings.Wide_Wide_Maps, Strings.Wide_Wide_Fixed,
Strings.Wide_Wide_Bounded, Strings.Wide_Wide_Unbounded, and Strings.Wide_Wide_Maps.Wide_Wide_Constants,
and in the functions Strings.Wide_Wide_Hash, Strings.Wide_Wide_Fixed.Wide_Wide_Hash,
Strings.Wide_Wide_Bounded.Wide_Wide_Hash, and Strings.Wide_Wide_Unbounded.Wide_Wide_Hash.
They provide the same string-handling operations as the corresponding
packages and functions for strings of Character elements.
Static Semantics
2/2
{
AI95-00285-01}
The library package Strings.Wide_Wide_Maps has
the following declaration.
3/2
package Ada.Strings.Wide_Wide_Maps is
pragma Preelaborate(Wide_Wide_Maps);
4/2
-- Representation for a set of Wide_Wide_Character values:
type Wide_Wide_Character_Set is private;
pragma Preelaborable_Initialization(Wide_Wide_Character_Set);
5/2
Null_Set : constant Wide_Wide_Character_Set;
6/2
type Wide_Wide_Character_Range is
record
Low : Wide_Wide_Character;
High : Wide_Wide_Character;
end record;
-- Represents Wide_Wide_Character range Low..High
7/2
type Wide_Wide_Character_Ranges is array (Positive range <>)
of Wide_Wide_Character_Range;
8/2
function To_Set (Ranges : in Wide_Wide_Character_Ranges)
return Wide_Wide_Character_Set;
9/2
function To_Set (Span : in Wide_Wide_Character_Range)
return Wide_Wide_Character_Set;
10/2
function To_Ranges (Set : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Ranges;
11/2
function "=" (Left, Right : in Wide_Wide_Character_Set) return Boolean;
12/2
function "not" (Right : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Set;
function "and" (Left, Right : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Set;
function "or" (Left, Right : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Set;
function "xor" (Left, Right : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Set;
function "-" (Left, Right : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Set;
13/2
function Is_In (Element : in Wide_Wide_Character;
Set : in Wide_Wide_Character_Set)
return Boolean;
14/2
function Is_Subset (Elements : in Wide_Wide_Character_Set;
Set : in Wide_Wide_Character_Set)
return Boolean;
15/2
function "<=" (Left : in Wide_Wide_Character_Set;
Right : in Wide_Wide_Character_Set)
return Boolean renames Is_Subset;
16/2
-- Alternative representation for a set of Wide_Wide_Character values:
subtype Wide_Wide_Character_Sequence is Wide_Wide_String;
17/2
function To_Set (Sequence : in Wide_Wide_Character_Sequence)
return Wide_Wide_Character_Set;
18/2
function To_Set (Singleton : in Wide_Wide_Character)
return Wide_Wide_Character_Set;
19/2
function To_Sequence (Set : in Wide_Wide_Character_Set)
return Wide_Wide_Character_Sequence;
20/2
-- Representation for a Wide_Wide_Character to Wide_Wide_Character
-- mapping:
type Wide_Wide_Character_Mapping is private;
pragma Preelaborable_Initialization(Wide_Wide_Character_Mapping);
21/2
function Value (Map : in Wide_Wide_Character_Mapping;
Element : in Wide_Wide_Character)
return Wide_Wide_Character;
22/2
Identity : constant Wide_Wide_Character_Mapping;
23/2
function To_Mapping (From, To : in Wide_Wide_Character_Sequence)
return Wide_Wide_Character_Mapping;
24/2
function To_Domain (Map : in Wide_Wide_Character_Mapping)
return Wide_Wide_Character_Sequence;
25/2
function To_Range (Map : in Wide_Wide_Character_Mapping)
return Wide_Wide_Character_Sequence;
26/2
type Wide_Wide_Character_Mapping_Function is
access function (From : in Wide_Wide_Character)
return Wide_Wide_Character;
27/2
private
... -- not specified by the language
end Ada.Strings.Wide_Wide_Maps;
28/2
{
AI95-00285-01}
The context clause for each
of the packages Strings.Wide_Wide_Fixed, Strings.Wide_Wide_Bounded, and
Strings.Wide_Wide_Unbounded identifies Strings.Wide_Wide_Maps instead
of Strings.Maps.
28.1/3
{
AI05-0223-1}
Types Wide_Wide_Character_Set and Wide_Wide_Character_Mapping
need finalization.
29/2
{
AI95-00285-01}
For each of the packages Strings.Fixed, Strings.Bounded,
Strings.Unbounded, and Strings.Maps.Constants, and for functions Strings.Hash,
Strings.Fixed.Hash, Strings.Bounded.Hash, and Strings.Unbounded.Hash,
the corresponding wide wide string package or function has the same contents
except that
30/2
Wide_Wide_Space replaces
Space
31/2
Wide_Wide_Character replaces
Character
32/2
Wide_Wide_String replaces
String
33/2
Wide_Wide_Character_Set replaces
Character_Set
34/2
Wide_Wide_Character_Mapping
replaces Character_Mapping
35/2
Wide_Wide_Character_Mapping_Function
replaces Character_Mapping_Function
36/2
Wide_Wide_Maps replaces Maps
37/2
Bounded_Wide_Wide_String
replaces Bounded_String
38/2
Null_Bounded_Wide_Wide_String
replaces Null_Bounded_String
39/2
To_Bounded_Wide_Wide_String
replaces To_Bounded_String
40/2
To_Wide_Wide_String replaces
To_String
41/2
{
AI95-00301-01}
Set_Bounded_Wide_Wide_String replaces Set_Bounded_String
42/2
Unbounded_Wide_Wide_String
replaces Unbounded_String
43/2
Null_Unbounded_Wide_Wide_String
replaces Null_Unbounded_String
44/2
Wide_Wide_String_Access replaces
String_Access
45/2
To_Unbounded_Wide_Wide_String
replaces To_Unbounded_String
46/2
{
AI95-00301-01}
Set_Unbounded_Wide_Wide_String replaces Set_Unbounded_String
47/2
48/2
Character_Set : constant Wide_Wide_Maps.Wide_Wide_Character_Set;
-- Contains each Wide_Wide_Character value WWC such that
-- Characters.Conversions.Is_Character(WWC) is True
Wide_Character_Set : constant Wide_Wide_Maps.Wide_Wide_Character_Set;
-- Contains each Wide_Wide_Character value WWC such that
-- Characters.Conversions.Is_Wide_Character(WWC) is True
49/2
{
AI95-00395-01}
Each Wide_Wide_Character_Set constant in the package
Strings.Wide_Wide_Maps.Wide_Wide_Constants contains no values outside
the Character portion of Wide_Wide_Character. Similarly, each Wide_Wide_Character_Mapping
constant in this package is the identity mapping when applied to any
element outside the Character portion of Wide_Wide_Character.
50/2
51/2
16 {
AI95-00285-01}
If a null Wide_Wide_Character_Mapping_Function
is passed to any of the Wide_Wide_String handling subprograms, Constraint_Error
is propagated.
Extensions to Ada 95
51.a/2
{
AI95-00285-01}
{
AI95-00395-01}
The double-wide string-handling
packages (Strings.Wide_Wide_Maps, Strings.Wide_Wide_Fixed, Strings.Wide_Wide_Bounded,
Strings.Wide_Wide_Unbounded, and Strings.Wide_Wide_Maps.Wide_Wide_Constants),
and functions Strings.Wide_Wide_Hash and Strings.Wide_Wide_Unbounded.Wide_Wide_Hash
are new.
Wording Changes from Ada 2005
51.b/3
{
AI05-0223-1}
Correction: Identified Wide_Wide_Character_Set
and Wide_Wide_Character_Mapping as needing finalization. It is likely
that they are implemented with a controlled type, so this change is unlikely
to make any difference in practice.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe