1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT RUN-TIME COMPONENTS                         --
4--                                                                          --
5--                ADA.STRINGS.UTF_ENCODING.WIDE_WIDE_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------------------------------------------------------------------------------
15
16--  This is an Ada 2012 package defined in AI05-0137-1. It is used for encoding
17--  and decoding Wide_String values using UTF encodings. Note: this package is
18--  consistent with Ada 2005, and may be used in Ada 2005 mode, but cannot be
19--  used in Ada 95 mode, since Wide_Wide_Character is an Ada 2005 feature.
20
21package Ada.Strings.UTF_Encoding.Wide_Wide_Strings is
22   pragma Pure (Wide_Wide_Strings);
23
24   --  The encoding routines take a Wide_Wide_String as input and encode the
25   --  result using the specified UTF encoding method. The result includes a
26   --  BOM if the Output_BOM parameter is set to True.
27
28   function Encode
29     (Item          : Wide_Wide_String;
30      Output_Scheme : Encoding_Scheme;
31      Output_BOM    : Boolean  := False) return UTF_String;
32   --  Encode Wide_Wide_String using UTF-8, UTF-16LE or UTF-16BE encoding as
33   --  specified by the Output_Scheme parameter.
34
35   function Encode
36     (Item       : Wide_Wide_String;
37      Output_BOM : Boolean  := False) return UTF_8_String;
38   --  Encode Wide_Wide_String using UTF-8 encoding
39
40   function Encode
41     (Item       : Wide_Wide_String;
42      Output_BOM : Boolean  := False) return UTF_16_Wide_String;
43   --  Encode Wide_Wide_String using UTF_16 encoding
44
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
49   function Decode
50     (Item         : UTF_String;
51      Input_Scheme : Encoding_Scheme) return Wide_Wide_String;
52   --  The input is encoded in UTF_8, UTF_16LE or UTF_16BE as specified by the
53   --  Input_Scheme parameter. It is decoded and returned as a Wide_Wide_String
54   --  value. Note: a convenient form for Scheme may be Encoding (UTF_String).
55
56   function Decode
57     (Item : UTF_8_String) return Wide_Wide_String;
58   --  The input is encoded in UTF-8 and returned as a Wide_Wide_String value
59
60   function Decode
61     (Item : UTF_16_Wide_String) return Wide_Wide_String;
62   --  The input is encoded in UTF-16 and returned as a Wide_String value
63
64end Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
65