iPXE
UnicodeCollation.h
Go to the documentation of this file.
00001 /** @file
00002   Unicode Collation protocol that follows the UEFI 2.0 specification.
00003   This protocol is used to allow code running in the boot services environment
00004   to perform lexical comparison functions on Unicode strings for given languages.
00005 
00006 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
00007 This program and the accompanying materials are licensed and made available under
00008 the terms and conditions of the BSD License that accompanies this distribution.
00009 The full text of the license may be found at
00010 http://opensource.org/licenses/bsd-license.php.
00011 
00012 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00013 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00014 
00015 **/
00016 
00017 #ifndef __UNICODE_COLLATION_H__
00018 #define __UNICODE_COLLATION_H__
00019 
00020 FILE_LICENCE ( BSD3 );
00021 
00022 #define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
00023   { \
00024     0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
00025   }
00026 
00027 #define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
00028   { \
00029     0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49 } \
00030   }
00031 
00032 typedef struct _EFI_UNICODE_COLLATION_PROTOCOL  EFI_UNICODE_COLLATION_PROTOCOL;
00033 
00034 
00035 ///
00036 /// Protocol GUID name defined in EFI1.1.
00037 ///
00038 #define UNICODE_COLLATION_PROTOCOL              EFI_UNICODE_COLLATION_PROTOCOL_GUID
00039 
00040 ///
00041 /// Protocol defined in EFI1.1.
00042 ///
00043 typedef EFI_UNICODE_COLLATION_PROTOCOL          UNICODE_COLLATION_INTERFACE;
00044 
00045 ///
00046 /// Protocol data structures and defines
00047 ///
00048 #define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16) (0xfeff)
00049 
00050 //
00051 // Protocol member functions
00052 //
00053 /**
00054   Performs a case-insensitive comparison of two Null-terminated strings.
00055 
00056   @param  This A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
00057   @param  Str1 A pointer to a Null-terminated string.
00058   @param  Str2 A pointer to a Null-terminated string.
00059 
00060   @retval 0   Str1 is equivalent to Str2.
00061   @retval >0  Str1 is lexically greater than Str2.
00062   @retval <0  Str1 is lexically less than Str2.
00063 
00064 **/
00065 typedef
00066 INTN
00067 (EFIAPI *EFI_UNICODE_COLLATION_STRICOLL)(
00068   IN EFI_UNICODE_COLLATION_PROTOCOL         *This,
00069   IN CHAR16                                 *Str1,
00070   IN CHAR16                                 *Str2
00071   );
00072 
00073 /**
00074   Performs a case-insensitive comparison of a Null-terminated
00075   pattern string and a Null-terminated string.
00076 
00077   @param  This    A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
00078   @param  String  A pointer to a Null-terminated string.
00079   @param  Pattern A pointer to a Null-terminated pattern string.
00080 
00081   @retval TRUE    Pattern was found in String.
00082   @retval FALSE   Pattern was not found in String.
00083 
00084 **/
00085 typedef
00086 BOOLEAN
00087 (EFIAPI *EFI_UNICODE_COLLATION_METAIMATCH)(
00088   IN EFI_UNICODE_COLLATION_PROTOCOL         *This,
00089   IN CHAR16                                 *String,
00090   IN CHAR16                                 *Pattern
00091   );
00092 
00093 /**
00094   Converts all the characters in a Null-terminated string to
00095   lower case characters.
00096 
00097   @param  This   A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
00098   @param  String A pointer to a Null-terminated string.
00099 
00100 **/
00101 typedef
00102 VOID
00103 (EFIAPI *EFI_UNICODE_COLLATION_STRLWR)(
00104   IN EFI_UNICODE_COLLATION_PROTOCOL         *This,
00105   IN OUT CHAR16                             *Str
00106   );
00107 
00108 /**
00109   Converts all the characters in a Null-terminated string to upper
00110   case characters.
00111 
00112   @param  This   A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
00113   @param  String A pointer to a Null-terminated string.
00114 
00115 **/
00116 typedef
00117 VOID
00118 (EFIAPI *EFI_UNICODE_COLLATION_STRUPR)(
00119   IN EFI_UNICODE_COLLATION_PROTOCOL         *This,
00120   IN OUT CHAR16                             *Str
00121   );
00122 
00123 /**
00124   Converts an 8.3 FAT file name in an OEM character set to a Null-terminated
00125   string.
00126 
00127   @param  This    A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
00128   @param  FatSize The size of the string Fat in bytes.
00129   @param  Fat     A pointer to a Null-terminated string that contains an 8.3 file
00130                   name using an 8-bit OEM character set.
00131   @param  String  A pointer to a Null-terminated string. The string must
00132                   be allocated in advance to hold FatSize characters.
00133 
00134 **/
00135 typedef
00136 VOID
00137 (EFIAPI *EFI_UNICODE_COLLATION_FATTOSTR)(
00138   IN EFI_UNICODE_COLLATION_PROTOCOL         *This,
00139   IN UINTN                                  FatSize,
00140   IN CHAR8                                  *Fat,
00141   OUT CHAR16                                *String
00142   );
00143 
00144 /**
00145   Converts a Null-terminated string to legal characters in a FAT
00146   filename using an OEM character set.
00147 
00148   @param  This    A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.
00149   @param  String  A pointer to a Null-terminated string.
00150   @param  FatSize The size of the string Fat in bytes.
00151   @param  Fat     A pointer to a string that contains the converted version of
00152                   String using legal FAT characters from an OEM character set.
00153 
00154   @retval TRUE    One or more conversions failed and were substituted with '_'
00155   @retval FALSE   None of the conversions failed.
00156 
00157 **/
00158 typedef
00159 BOOLEAN
00160 (EFIAPI *EFI_UNICODE_COLLATION_STRTOFAT)(
00161   IN EFI_UNICODE_COLLATION_PROTOCOL         *This,
00162   IN CHAR16                                 *String,
00163   IN UINTN                                  FatSize,
00164   OUT CHAR8                                 *Fat
00165   );
00166 
00167 ///
00168 /// The EFI_UNICODE_COLLATION_PROTOCOL is used to perform case-insensitive
00169 /// comparisons of strings.
00170 ///
00171 struct _EFI_UNICODE_COLLATION_PROTOCOL {
00172   EFI_UNICODE_COLLATION_STRICOLL    StriColl;
00173   EFI_UNICODE_COLLATION_METAIMATCH  MetaiMatch;
00174   EFI_UNICODE_COLLATION_STRLWR      StrLwr;
00175   EFI_UNICODE_COLLATION_STRUPR      StrUpr;
00176 
00177   //
00178   // for supporting fat volumes
00179   //
00180   EFI_UNICODE_COLLATION_FATTOSTR    FatToStr;
00181   EFI_UNICODE_COLLATION_STRTOFAT    StrToFat;
00182 
00183   ///
00184   /// A Null-terminated ASCII string array that contains one or more language codes.
00185   /// When this field is used for UnicodeCollation2, it is specified in RFC 4646 format.
00186   /// When it is used for UnicodeCollation, it is specified in ISO 639-2 format.
00187   ///
00188   CHAR8                             *SupportedLanguages;
00189 };
00190 
00191 extern EFI_GUID gEfiUnicodeCollationProtocolGuid;
00192 extern EFI_GUID gEfiUnicodeCollation2ProtocolGuid;
00193 
00194 #endif