1 |
706 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- ADA.STRINGS.UTF_ENCODING.CONVERSIONS --
|
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 |
|
|
------------------------------------------------------------------------------
|
15 |
|
|
|
16 |
|
|
-- This is an Ada 2012 package defined in AI05-0137-1. It provides conversions
|
17 |
|
|
-- from one UTF encoding method to another. Note: this package is consistent
|
18 |
|
|
-- with Ada 95, and may be used in Ada 95 or Ada 2005 mode.
|
19 |
|
|
|
20 |
|
|
package Ada.Strings.UTF_Encoding.Conversions is
|
21 |
|
|
pragma Pure (Conversions);
|
22 |
|
|
|
23 |
|
|
-- In the following conversion routines, a BOM in the input that matches
|
24 |
|
|
-- the encoding scheme is ignored, an incorrect BOM causes Encoding_Error
|
25 |
|
|
-- to be raised. A BOM is present in the output if the Output_BOM parameter
|
26 |
|
|
-- is set to True.
|
27 |
|
|
|
28 |
|
|
function Convert
|
29 |
|
|
(Item : UTF_String;
|
30 |
|
|
Input_Scheme : Encoding_Scheme;
|
31 |
|
|
Output_Scheme : Encoding_Scheme;
|
32 |
|
|
Output_BOM : Boolean := False) return UTF_String;
|
33 |
|
|
-- Convert from input encoded in UTF-8, UTF-16LE, or UTF-16BE as specified
|
34 |
|
|
-- by the Input_Scheme argument, and generate an output encoded in one of
|
35 |
|
|
-- these three schemes as specified by the Output_Scheme argument.
|
36 |
|
|
|
37 |
|
|
function Convert
|
38 |
|
|
(Item : UTF_String;
|
39 |
|
|
Input_Scheme : Encoding_Scheme;
|
40 |
|
|
Output_BOM : Boolean := False) return UTF_16_Wide_String;
|
41 |
|
|
-- Convert from input encoded in UTF-8, UTF-16LE, or UTF-16BE as specified
|
42 |
|
|
-- by the Input_Scheme argument, and generate an output encoded in UTF-16.
|
43 |
|
|
|
44 |
|
|
function Convert
|
45 |
|
|
(Item : UTF_8_String;
|
46 |
|
|
Output_BOM : Boolean := False) return UTF_16_Wide_String;
|
47 |
|
|
-- Convert from UTF-8 to UTF-16
|
48 |
|
|
|
49 |
|
|
function Convert
|
50 |
|
|
(Item : UTF_16_Wide_String;
|
51 |
|
|
Output_Scheme : Encoding_Scheme;
|
52 |
|
|
Output_BOM : Boolean := False) return UTF_String;
|
53 |
|
|
-- Convert from UTF-16 to UTF-8, UTF-16LE, or UTF-16BE as specified by
|
54 |
|
|
-- the Output_Scheme argument.
|
55 |
|
|
|
56 |
|
|
function Convert
|
57 |
|
|
(Item : UTF_16_Wide_String;
|
58 |
|
|
Output_BOM : Boolean := False) return UTF_8_String;
|
59 |
|
|
-- Convert from UTF-16 to UTF-8
|
60 |
|
|
|
61 |
|
|
end Ada.Strings.UTF_Encoding.Conversions;
|