blob: 62ef97380104216158d22a19acabf0f8854a1878 [file] [log] [blame]
yshang1d1f95002007-06-19 10:12:02 +00001/** @file
2 Unicode Collation protocol that follows the EFI 1.0 specification.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
yshang1d1f95002007-06-19 10:12:02 +000013**/
14
15#ifndef __UNICODE_COLLATION_H__
16#define __UNICODE_COLLATION_H__
17
18#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
19 { \
20 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
21 }
22
yshang1a6508c02007-06-21 07:16:27 +000023typedef struct _EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL;
24
25
26//
27// Protocol GUID name defined in EFI1.1.
28//
29#define UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL_GUID
30
31//
32// Protocol defined in EFI1.1.
33//
34typedef EFI_UNICODE_COLLATION_PROTOCOL UNICODE_COLLATION_INTERFACE;
yshang1d1f95002007-06-19 10:12:02 +000035
36//
37// Protocol data structures and defines
38//
39#define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16) (0xfeff)
40
41//
42// Protocol member functions
43//
44/**
45 Performs a case-insensitive comparison of two Null-terminated Unicode
46 strings.
47
48 @param This Protocol instance pointer.
49 @param Str1 A pointer to a Null-terminated Unicode string.
50 @param Str2 A pointer to a Null-terminated Unicode string.
51
52 @retval 0 Str1 is equivalent to Str2
53 @retval >_0 Str1 is lexically greater than Str2
54 @retval <_0 Str1 is lexically less than Str2
55
56**/
57typedef
58INTN
59(EFIAPI *EFI_UNICODE_COLLATION_STRICOLL) (
60 IN EFI_UNICODE_COLLATION_PROTOCOL *This,
61 IN CHAR16 *Str1,
62 IN CHAR16 *Str2
63 )
64;
65
66/**
67 Performs a case-insensitive comparison of a Null-terminated Unicode
68 pattern string and a Null-terminated Unicode string.
69
70 @param This Protocol instance pointer.
71 @param String A pointer to a Null-terminated Unicode string.
72 @param Pattern A pointer to a Null-terminated Unicode pattern string.
73
74 @retval TRUE Pattern was found in String.
75 @retval FALSE Pattern was not found in String.
76
77**/
78typedef
79BOOLEAN
80(EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH) (
81 IN EFI_UNICODE_COLLATION_PROTOCOL *This,
82 IN CHAR16 *String,
83 IN CHAR16 *Pattern
84 )
85;
86
87/**
88 Converts all the Unicode characters in a Null-terminated Unicode string to
89 lower case Unicode characters.
90
91 @param This Protocol instance pointer.
92 @param String A pointer to a Null-terminated Unicode string.
93
94 NONE
95
96**/
97typedef
98VOID
99(EFIAPI *EFI_UNICODE_COLLATION_STRLWR) (
100 IN EFI_UNICODE_COLLATION_PROTOCOL *This,
101 IN OUT CHAR16 *Str
102 )
103;
104
105/**
106 Converts all the Unicode characters in a Null-terminated Unicode string to upper
107 case Unicode characters.
108
109 @param This Protocol instance pointer.
110 @param String A pointer to a Null-terminated Unicode string.
111
112 NONE
113
114**/
115typedef
116VOID
117(EFIAPI *EFI_UNICODE_COLLATION_STRUPR) (
118 IN EFI_UNICODE_COLLATION_PROTOCOL *This,
119 IN OUT CHAR16 *Str
120 )
121;
122
123/**
124 Converts an 8.3 FAT file name in an OEM character set to a Null-terminated
125 Unicode string.
126
127 @param This Protocol instance pointer.
128 @param FatSize The size of the string Fat in bytes.
129 @param Fat A pointer to a Null-terminated string that contains an 8.3 file
130 name using an OEM character set.
131 @param String A pointer to a Null-terminated Unicode string. The string must
132 be preallocated to hold FatSize Unicode characters.
133
134 NONE
135
136**/
137typedef
138VOID
139(EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR) (
140 IN EFI_UNICODE_COLLATION_PROTOCOL *This,
141 IN UINTN FatSize,
142 IN CHAR8 *Fat,
143 OUT CHAR16 *String
144 )
145;
146
147/**
148 Converts a Null-terminated Unicode string to legal characters in a FAT
149 filename using an OEM character set.
150
151 @param This Protocol instance pointer.
152 @param String A pointer to a Null-terminated Unicode string. The string must
153 be preallocated to hold FatSize Unicode characters.
154 @param FatSize The size of the string Fat in bytes.
155 @param Fat A pointer to a Null-terminated string that contains an 8.3 file
156 name using an OEM character set.
157
158 @retval TRUE Fat is a Long File Name
159 @retval FALSE Fat is an 8.3 file name
160
161**/
162typedef
163BOOLEAN
164(EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT) (
165 IN EFI_UNICODE_COLLATION_PROTOCOL *This,
166 IN CHAR16 *String,
167 IN UINTN FatSize,
168 OUT CHAR8 *Fat
169 )
170;
171
172struct _EFI_UNICODE_COLLATION_PROTOCOL {
173 //
174 // general
175 //
176 EFI_UNICODE_COLLATION_STRICOLL StriColl;
177 EFI_UNICODE_COLLATION_METAIMATCH MetaiMatch;
178 EFI_UNICODE_COLLATION_STRLWR StrLwr;
179 EFI_UNICODE_COLLATION_STRUPR StrUpr;
180
181 //
182 // for supporting fat volumes
183 //
184 EFI_UNICODE_COLLATION_FATTOSTR FatToStr;
185 EFI_UNICODE_COLLATION_STRTOFAT StrToFat;
186
187 CHAR8 *SupportedLanguages;
188};
189
190extern EFI_GUID gEfiUnicodeCollationProtocolGuid;
yshang1fd21d1a2007-07-20 13:46:48 +0000191extern EFI_GUID gEfiUnicodeCollation2ProtocolGuid;
yshang1d1f95002007-06-19 10:12:02 +0000192
193#endif