]>
Commit | Line | Data |
---|---|---|
805b8b88 AC |
1 | /** @file\r |
2 | UCS2 to UTF8 manipulation library header file.\r | |
3 | \r | |
4 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r | |
5 | (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>\r | |
6 | \r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | \r | |
11 | #ifndef BASE_UCS2UTF8_LIB_H_\r | |
12 | #define BASE_UCS2UTF8_LIB_H_\r | |
13 | \r | |
14 | ///\r | |
15 | /// L"\u0000"\r | |
16 | ///\r | |
39de741e MK |
17 | #define UNICODE_FORMAT_LEN 6\r |
18 | #define UNICODE_FORMAT_CHAR_LEN 2\r | |
19 | #define UNICODE_FORMAT_CHAR_SIZE 3\r | |
805b8b88 | 20 | \r |
39de741e | 21 | #define UTF8_BUFFER_FOR_UCS2_MAX_SIZE 3\r |
805b8b88 AC |
22 | \r |
23 | /**\r | |
24 | Convert a UCS2 string to a UTF8 encoded string.\r | |
25 | \r | |
26 | @param[in] Ucs2Str The provided UCS2 string.\r | |
27 | @param[out] Utf8StrAddr The converted UTF8 string address. Caller\r | |
28 | is responsible for Free this string.\r | |
29 | \r | |
30 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
31 | @retval EFI_OUT_OF_RESOURCES System runs out of resources.\r | |
32 | @retval EFI_SUCCESS The UTF8 encoded string has been converted.\r | |
33 | \r | |
34 | **/\r | |
35 | EFI_STATUS\r | |
36 | UCS2StrToUTF8 (\r | |
39de741e MK |
37 | IN CHAR16 *Ucs2Str,\r |
38 | OUT CHAR8 **Utf8StrAddr\r | |
805b8b88 AC |
39 | );\r |
40 | \r | |
41 | /**\r | |
42 | Convert a UTF8 encoded string to a UCS2 string.\r | |
43 | \r | |
44 | @param[in] Utf8Str The provided UTF8 encoded string.\r | |
45 | @param[out] Ucs2StrAddr The converted UCS2 string address. Caller\r | |
46 | is responsible for Free this string.\r | |
47 | \r | |
48 | @retval EFI_INVALID_PARAMETER The UTF8 encoded string is not valid to\r | |
49 | convert to UCS2 string.\r | |
50 | One or more parameters are invalid.\r | |
51 | @retval EFI_OUT_OF_RESOURCES System runs out of resources.\r | |
52 | @retval EFI_SUCCESS The UCS2 string has been converted.\r | |
53 | \r | |
54 | **/\r | |
55 | EFI_STATUS\r | |
56 | UTF8StrToUCS2 (\r | |
39de741e MK |
57 | IN CHAR8 *Utf8Str,\r |
58 | OUT CHAR16 **Ucs2StrAddr\r | |
805b8b88 AC |
59 | );\r |
60 | \r | |
61 | #endif\r |