PR c++/54038
[official-gcc.git] / gcc / ada / a-suenst.ads
blob1706cd665e68fdac7575a116bc654b27191012c0
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- ADA.STRINGS.UTF_ENCODING.STRINGS --
6 -- --
7 -- S p e c --
8 -- --
9 -- This specification is derived from the Ada Reference Manual for use with --
10 -- GNAT. In accordance with the copyright of that document, you can freely --
11 -- copy and modify this specification, provided that if you redistribute a --
12 -- modified version, any changes that you have made are clearly indicated. --
13 -- --
14 ------------------------------------------------------------------------------
16 -- This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding
17 -- and decoding String values using UTF encodings. Note: this package is
18 -- consistent with Ada 95, and may be included in Ada 95 implementations.
20 package Ada.Strings.UTF_Encoding.Strings is
21 pragma Pure (Strings);
23 -- The encoding routines take a String as input and encode the result
24 -- using the specified UTF encoding method. The result includes a BOM if
25 -- the Output_BOM argument is set to True. All 256 values of type Character
26 -- are valid, so Encoding_Error cannot be raised for string input data.
28 function Encode
29 (Item : String;
30 Output_Scheme : Encoding_Scheme;
31 Output_BOM : Boolean := False) return UTF_String;
32 -- Encode String using UTF-8, UTF-16LE or UTF-16BE encoding as specified by
33 -- the Output_Scheme parameter.
35 function Encode
36 (Item : String;
37 Output_BOM : Boolean := False) return UTF_8_String;
38 -- Encode String using UTF-8 encoding
40 function Encode
41 (Item : String;
42 Output_BOM : Boolean := False) return UTF_16_Wide_String;
43 -- Encode String using UTF_16 encoding
45 -- The decoding routines take a UTF String as input, and return a decoded
46 -- Wide_String. If the UTF String starts with a BOM that matches the
47 -- encoding method, it is ignored. An incorrect BOM raises Encoding_Error,
48 -- as does a code out of range of type Character.
50 function Decode
51 (Item : UTF_String;
52 Input_Scheme : Encoding_Scheme) return String;
53 -- The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the
54 -- Input_Scheme parameter. It is decoded and returned as a String value.
55 -- Note: a convenient form for scheme may be Encoding (UTF_String).
57 function Decode
58 (Item : UTF_8_String) return String;
59 -- The input is encoded in UTF-8 and returned as a String value
61 function Decode
62 (Item : UTF_16_Wide_String) return String;
63 -- The input is encoded in UTF-16 and returned as a String value
65 end Ada.Strings.UTF_Encoding.Strings;