]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/UnicodeCollation.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / UnicodeCollation.h
CommitLineData
d1f95000 1/** @file\r
8a7d75b0 2 Unicode Collation protocol that follows the UEFI 2.0 specification.\r
9095d37b 3 This protocol is used to allow code running in the boot services environment\r
4ca9b6c4 4 to perform lexical comparison functions on Unicode strings for given languages.\r
d1f95000 5\r
9095d37b 6Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 8\r
d1f95000 9**/\r
10\r
11#ifndef __UNICODE_COLLATION_H__\r
12#define __UNICODE_COLLATION_H__\r
13\r
14#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \\r
15 { \\r
16 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \\r
17 }\r
18\r
d24236bf 19#define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \\r
20 { \\r
21 0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49 } \\r
22 }\r
23\r
a6508c05 24typedef struct _EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL;\r
25\r
26\r
99e8ed21 27///\r
28/// Protocol GUID name defined in EFI1.1.\r
9095d37b 29///\r
a6508c05 30#define UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL_GUID\r
31\r
99e8ed21 32///\r
33/// Protocol defined in EFI1.1.\r
9095d37b 34///\r
a6508c05 35typedef EFI_UNICODE_COLLATION_PROTOCOL UNICODE_COLLATION_INTERFACE;\r
d1f95000 36\r
99e8ed21 37///\r
38/// Protocol data structures and defines\r
39///\r
d1f95000 40#define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16) (0xfeff)\r
41\r
42//\r
43// Protocol member functions\r
44//\r
45/**\r
fbf926ad 46 Performs a case-insensitive comparison of two Null-terminated strings.\r
d1f95000 47\r
fbf926ad 48 @param This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
49 @param Str1 A pointer to a Null-terminated string.\r
50 @param Str2 A pointer to a Null-terminated string.\r
d1f95000 51\r
af2dc6a7 52 @retval 0 Str1 is equivalent to Str2.\r
53 @retval >0 Str1 is lexically greater than Str2.\r
54 @retval <0 Str1 is lexically less than Str2.\r
d1f95000 55\r
56**/\r
57typedef\r
58INTN\r
8b13229b 59(EFIAPI *EFI_UNICODE_COLLATION_STRICOLL)(\r
d1f95000 60 IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
61 IN CHAR16 *Str1,\r
62 IN CHAR16 *Str2\r
ed66e1bc 63 );\r
d1f95000 64\r
65/**\r
9095d37b 66 Performs a case-insensitive comparison of a Null-terminated\r
fbf926ad 67 pattern string and a Null-terminated string.\r
d1f95000 68\r
fbf926ad 69 @param This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
70 @param String A pointer to a Null-terminated string.\r
71 @param Pattern A pointer to a Null-terminated pattern string.\r
d1f95000 72\r
73 @retval TRUE Pattern was found in String.\r
74 @retval FALSE Pattern was not found in String.\r
75\r
76**/\r
77typedef\r
78BOOLEAN\r
8b13229b 79(EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH)(\r
d1f95000 80 IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
81 IN CHAR16 *String,\r
82 IN CHAR16 *Pattern\r
ed66e1bc 83 );\r
d1f95000 84\r
85/**\r
9095d37b 86 Converts all the characters in a Null-terminated string to\r
fbf926ad 87 lower case characters.\r
d1f95000 88\r
fbf926ad 89 @param This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
90 @param String A pointer to a Null-terminated string.\r
d1f95000 91\r
d1f95000 92**/\r
93typedef\r
94VOID\r
8b13229b 95(EFIAPI *EFI_UNICODE_COLLATION_STRLWR)(\r
d1f95000 96 IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
97 IN OUT CHAR16 *Str\r
ed66e1bc 98 );\r
d1f95000 99\r
100/**\r
fbf926ad 101 Converts all the characters in a Null-terminated string to upper\r
102 case characters.\r
d1f95000 103\r
fbf926ad 104 @param This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
105 @param String A pointer to a Null-terminated string.\r
d1f95000 106\r
d1f95000 107**/\r
108typedef\r
109VOID\r
8b13229b 110(EFIAPI *EFI_UNICODE_COLLATION_STRUPR)(\r
d1f95000 111 IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
112 IN OUT CHAR16 *Str\r
ed66e1bc 113 );\r
d1f95000 114\r
115/**\r
9095d37b 116 Converts an 8.3 FAT file name in an OEM character set to a Null-terminated\r
fbf926ad 117 string.\r
d1f95000 118\r
fbf926ad 119 @param This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
d1f95000 120 @param FatSize The size of the string Fat in bytes.\r
121 @param Fat A pointer to a Null-terminated string that contains an 8.3 file\r
4f077902 122 name using an 8-bit OEM character set.\r
fbf926ad 123 @param String A pointer to a Null-terminated string. The string must\r
124 be allocated in advance to hold FatSize characters.\r
d1f95000 125\r
d1f95000 126**/\r
127typedef\r
128VOID\r
8b13229b 129(EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR)(\r
d1f95000 130 IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
131 IN UINTN FatSize,\r
132 IN CHAR8 *Fat,\r
133 OUT CHAR16 *String\r
ed66e1bc 134 );\r
d1f95000 135\r
136/**\r
9095d37b
LG
137 Converts a Null-terminated string to legal characters in a FAT\r
138 filename using an OEM character set.\r
d1f95000 139\r
fbf926ad 140 @param This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
141 @param String A pointer to a Null-terminated string.\r
d1f95000 142 @param FatSize The size of the string Fat in bytes.\r
9095d37b 143 @param Fat A pointer to a string that contains the converted version of\r
fbf926ad 144 String using legal FAT characters from an OEM character set.\r
d1f95000 145\r
fbf926ad 146 @retval TRUE One or more conversions failed and were substituted with '_'\r
147 @retval FALSE None of the conversions failed.\r
d1f95000 148\r
149**/\r
150typedef\r
151BOOLEAN\r
8b13229b 152(EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT)(\r
d1f95000 153 IN EFI_UNICODE_COLLATION_PROTOCOL *This,\r
154 IN CHAR16 *String,\r
155 IN UINTN FatSize,\r
156 OUT CHAR8 *Fat\r
ed66e1bc 157 );\r
d1f95000 158\r
44717a39 159///\r
9095d37b
LG
160/// The EFI_UNICODE_COLLATION_PROTOCOL is used to perform case-insensitive\r
161/// comparisons of strings.\r
44717a39 162///\r
d1f95000 163struct _EFI_UNICODE_COLLATION_PROTOCOL {\r
d1f95000 164 EFI_UNICODE_COLLATION_STRICOLL StriColl;\r
165 EFI_UNICODE_COLLATION_METAIMATCH MetaiMatch;\r
166 EFI_UNICODE_COLLATION_STRLWR StrLwr;\r
167 EFI_UNICODE_COLLATION_STRUPR StrUpr;\r
168\r
169 //\r
170 // for supporting fat volumes\r
171 //\r
172 EFI_UNICODE_COLLATION_FATTOSTR FatToStr;\r
173 EFI_UNICODE_COLLATION_STRTOFAT StrToFat;\r
9095d37b 174\r
258cce13 175 ///\r
e69ccf58
LG
176 /// A Null-terminated ASCII string array that contains one or more language codes.\r
177 /// When this field is used for UnicodeCollation2, it is specified in RFC 4646 format.\r
178 /// When it is used for UnicodeCollation, it is specified in ISO 639-2 format.\r
258cce13 179 ///\r
d1f95000 180 CHAR8 *SupportedLanguages;\r
181};\r
182\r
183extern EFI_GUID gEfiUnicodeCollationProtocolGuid;\r
fd21d1aa 184extern EFI_GUID gEfiUnicodeCollation2ProtocolGuid;\r
d1f95000 185\r
186#endif\r