]>
Commit | Line | Data |
---|---|---|
d1f95000 | 1 | /** @file\r |
2 | The file provides services to manipulate string data.\r | |
9095d37b LG |
3 | \r |
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials are licensed and made available under\r | |
6 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
af2dc6a7 | 7 | The full text of the license may be found at\r |
9095d37b LG |
8 | http://opensource.org/licenses/bsd-license.php.\r |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
d1f95000 | 12 | \r |
497a5fb1 SZ |
13 | @par Revision Reference:\r |
14 | This Protocol was introduced in UEFI Specification 2.1.\r | |
15 | \r | |
d1f95000 | 16 | **/\r |
17 | \r | |
18 | #ifndef __HII_STRING_H__\r | |
19 | #define __HII_STRING_H__\r | |
20 | \r | |
7d582d6b | 21 | #include <Protocol/HiiFont.h>\r |
22 | \r | |
1e966f63 | 23 | #define EFI_HII_STRING_PROTOCOL_GUID \\r |
24 | { 0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } }\r | |
d1f95000 | 25 | \r |
26 | typedef struct _EFI_HII_STRING_PROTOCOL EFI_HII_STRING_PROTOCOL;\r | |
27 | \r | |
d1f95000 | 28 | /**\r |
4ca9b6c4 | 29 | This function adds the string String to the group of strings owned by PackageList, with the\r |
af2dc6a7 | 30 | specified font information StringFontInfo, and returns a new string id.\r |
9095d37b LG |
31 | The new string identifier is guaranteed to be unique within the package list.\r |
32 | That new string identifier is reserved for all languages in the package list.\r | |
4ca9b6c4 LG |
33 | \r |
34 | @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r | |
af2dc6a7 | 35 | @param PackageList The handle of the package list where this string will\r |
4ca9b6c4 LG |
36 | be added.\r |
37 | @param StringId On return, contains the new strings id, which is\r | |
38 | unique within PackageList.\r | |
39 | @param Language Points to the language for the new string.\r | |
40 | @param LanguageName Points to the printable language name to associate\r | |
41 | with the passed in Language field.If LanguageName\r | |
42 | is not NULL and the string package header's\r | |
43 | LanguageName associated with a given Language is\r | |
af2dc6a7 | 44 | not zero, the LanguageName being passed in will\r |
4ca9b6c4 LG |
45 | be ignored.\r |
46 | @param String Points to the new null-terminated string.\r | |
47 | @param StringFontInfo Points to the new string's font information or\r | |
48 | NULL if the string should have the default system\r | |
49 | font, size and style.\r | |
50 | \r | |
51 | @retval EFI_SUCCESS The new string was added successfully.\r | |
52 | @retval EFI_NOT_FOUND The specified PackageList could not be found in\r | |
53 | database.\r | |
54 | @retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.\r | |
af2dc6a7 | 55 | @retval EFI_INVALID_PARAMETER String is NULL, or StringId is NULL, or Language is NULL.\r |
4ca9b6c4 LG |
56 | @retval EFI_INVALID_PARAMETER The specified StringFontInfo does not exist in\r |
57 | current database.\r | |
d1f95000 | 58 | \r |
59 | **/\r | |
60 | typedef\r | |
61 | EFI_STATUS\r | |
8b13229b | 62 | (EFIAPI *EFI_HII_NEW_STRING)(\r |
d1f95000 | 63 | IN CONST EFI_HII_STRING_PROTOCOL *This,\r |
7d582d6b | 64 | IN EFI_HII_HANDLE PackageList,\r |
65 | OUT EFI_STRING_ID *StringId,\r | |
d1f95000 | 66 | IN CONST CHAR8 *Language,\r |
9095d37b | 67 | IN CONST CHAR16 *LanguageName, OPTIONAL\r |
d1f95000 | 68 | IN CONST EFI_STRING String,\r |
7d582d6b | 69 | IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL\r |
d1f95000 | 70 | );\r |
71 | \r | |
72 | \r | |
73 | /**\r | |
4ca9b6c4 LG |
74 | This function retrieves the string specified by StringId which is associated\r |
75 | with the specified PackageList in the language Language and copies it into\r | |
76 | the buffer specified by String.\r | |
77 | \r | |
78 | @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r | |
79 | @param Language Points to the language for the retrieved string.\r | |
80 | @param PackageList The package list in the HII database to search for\r | |
81 | the specified string.\r | |
82 | @param StringId The string's id, which is unique within\r | |
83 | PackageList.\r | |
84 | @param String Points to the new null-terminated string.\r | |
85 | @param StringSize On entry, points to the size of the buffer pointed\r | |
86 | to by String, in bytes. On return, points to the\r | |
87 | length of the string, in bytes.\r | |
88 | @param StringFontInfo If not NULL, points to the string's font\r | |
89 | information. It's caller's responsibility to free\r | |
90 | this buffer.\r | |
91 | \r | |
92 | @retval EFI_SUCCESS The string was returned successfully.\r | |
93 | @retval EFI_NOT_FOUND The string specified by StringId is not available.\r | |
4ca9b6c4 | 94 | The specified PackageList is not in the database.\r |
9095d37b | 95 | @retval EFI_INVALID_LANGUAGE The string specified by StringId is available but\r |
5795218e | 96 | not in the specified language.\r |
4ca9b6c4 LG |
97 | @retval EFI_BUFFER_TOO_SMALL The buffer specified by StringSize is too small to\r |
98 | hold the string.\r | |
5795218e ED |
99 | @retval EFI_INVALID_PARAMETER The Language or StringSize was NULL.\r |
100 | @retval EFI_INVALID_PARAMETER The value referenced by StringSize was not zero and\r | |
101 | String was NULL.\r | |
102 | @retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the\r | |
103 | request.\r | |
d1f95000 | 104 | \r |
d1f95000 | 105 | **/\r |
106 | typedef\r | |
107 | EFI_STATUS\r | |
8b13229b | 108 | (EFIAPI *EFI_HII_GET_STRING)(\r |
d1f95000 | 109 | IN CONST EFI_HII_STRING_PROTOCOL *This,\r |
110 | IN CONST CHAR8 *Language,\r | |
7d582d6b | 111 | IN EFI_HII_HANDLE PackageList,\r |
112 | IN EFI_STRING_ID StringId,\r | |
d1f95000 | 113 | OUT EFI_STRING String,\r |
7d582d6b | 114 | IN OUT UINTN *StringSize,\r |
115 | OUT EFI_FONT_INFO **StringFontInfo OPTIONAL\r | |
d1f95000 | 116 | );\r |
117 | \r | |
118 | /**\r | |
4ca9b6c4 LG |
119 | This function updates the string specified by StringId in the specified PackageList to the text\r |
120 | specified by String and, optionally, the font information specified by StringFontInfo.\r | |
121 | \r | |
122 | @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r | |
123 | @param PackageList The package list containing the strings.\r | |
124 | @param StringId The string's id, which is unique within\r | |
125 | PackageList.\r | |
126 | @param Language Points to the language for the updated string.\r | |
127 | @param String Points to the new null-terminated string.\r | |
128 | @param StringFontInfo Points to the string's font information or NULL if\r | |
129 | the string font information is not changed.\r | |
130 | \r | |
131 | @retval EFI_SUCCESS The string was updated successfully.\r | |
132 | @retval EFI_NOT_FOUND The string specified by StringId is not in the\r | |
133 | database.\r | |
134 | @retval EFI_INVALID_PARAMETER The String or Language was NULL.\r | |
135 | @retval EFI_INVALID_PARAMETER The specified StringFontInfo does not exist in\r | |
136 | current database.\r | |
137 | @retval EFI_OUT_OF_RESOURCES The system is out of resources to accomplish the\r | |
138 | task.\r | |
d1f95000 | 139 | \r |
140 | **/\r | |
141 | typedef\r | |
142 | EFI_STATUS\r | |
8b13229b | 143 | (EFIAPI *EFI_HII_SET_STRING)(\r |
d1f95000 | 144 | IN CONST EFI_HII_STRING_PROTOCOL *This,\r |
7d582d6b | 145 | IN EFI_HII_HANDLE PackageList,\r |
146 | IN EFI_STRING_ID StringId,\r | |
d1f95000 | 147 | IN CONST CHAR8 *Language,\r |
7d582d6b | 148 | IN EFI_STRING String,\r |
d1f95000 | 149 | IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL\r |
150 | );\r | |
151 | \r | |
152 | \r | |
153 | /**\r | |
d1f95000 | 154 | This function returns the list of supported languages.\r |
155 | \r | |
4ca9b6c4 LG |
156 | @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r |
157 | @param PackageList The package list to examine.\r | |
4f077902 SZ |
158 | @param Languages Points to the buffer to hold the returned\r |
159 | null-terminated ASCII string.\r | |
4ca9b6c4 | 160 | @param LanguagesSize On entry, points to the size of the buffer pointed\r |
4f077902 | 161 | to by Languages, in bytes. On return, points to\r |
4ca9b6c4 LG |
162 | the length of Languages, in bytes.\r |
163 | \r | |
164 | @retval EFI_SUCCESS The languages were returned successfully.\r | |
5795218e ED |
165 | @retval EFI_INVALID_PARAMETER The LanguagesSize was NULL.\r |
166 | @retval EFI_INVALID_PARAMETER The value referenced by LanguagesSize is not zero\r | |
167 | and Languages is NULL.\r | |
4ca9b6c4 LG |
168 | @retval EFI_BUFFER_TOO_SMALL The LanguagesSize is too small to hold the list of\r |
169 | supported languages. LanguageSize is updated to\r | |
170 | contain the required size.\r | |
171 | @retval EFI_NOT_FOUND Could not find string package in specified\r | |
172 | packagelist.\r | |
d1f95000 | 173 | \r |
174 | **/\r | |
175 | typedef\r | |
176 | EFI_STATUS\r | |
8b13229b | 177 | (EFIAPI *EFI_HII_GET_LANGUAGES)(\r |
7d582d6b | 178 | IN CONST EFI_HII_STRING_PROTOCOL *This,\r |
179 | IN EFI_HII_HANDLE PackageList,\r | |
d1f95000 | 180 | IN OUT CHAR8 *Languages,\r |
7d582d6b | 181 | IN OUT UINTN *LanguagesSize\r |
d1f95000 | 182 | );\r |
183 | \r | |
184 | \r | |
185 | /**\r | |
4ca9b6c4 LG |
186 | Each string package has associated with it a single primary language and zero\r |
187 | or more secondary languages. This routine returns the secondary languages\r | |
188 | associated with a package list.\r | |
189 | \r | |
190 | @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r | |
191 | @param PackageList The package list to examine.\r | |
4f077902 SZ |
192 | @param PrimaryLanguage Points to the null-terminated ASCII string that specifies\r |
193 | the primary language. Languages are specified in the\r | |
194 | format specified in Appendix M of the UEFI 2.0 specification.\r | |
195 | @param SecondaryLanguages Points to the buffer to hold the returned null-terminated\r | |
196 | ASCII string that describes the list of\r | |
4ca9b6c4 | 197 | secondary languages for the specified\r |
4f077902 SZ |
198 | PrimaryLanguage. If there are no secondary\r |
199 | languages, the function returns successfully, but\r | |
4ca9b6c4 LG |
200 | this is set to NULL.\r |
201 | @param SecondaryLanguagesSize On entry, points to the size of the buffer pointed\r | |
4f077902 | 202 | to by SecondaryLanguages, in bytes. On return,\r |
4ca9b6c4 LG |
203 | points to the length of SecondaryLanguages in bytes.\r |
204 | \r | |
205 | @retval EFI_SUCCESS Secondary languages were correctly returned.\r | |
5795218e ED |
206 | @retval EFI_INVALID_PARAMETER PrimaryLanguage or SecondaryLanguagesSize was NULL.\r |
207 | @retval EFI_INVALID_PARAMETER The value referenced by SecondaryLanguagesSize is not\r | |
208 | zero and SecondaryLanguages is NULL.\r | |
4ca9b6c4 LG |
209 | @retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondaryLanguagesSize is\r |
210 | too small to hold the returned information.\r | |
4f077902 | 211 | SecondaryLanguageSize is updated to hold the size of\r |
4ca9b6c4 | 212 | the buffer required.\r |
4f077902 | 213 | @retval EFI_INVALID_LANGUAGE The language specified by PrimaryLanguage is not\r |
4ca9b6c4 | 214 | present in the specified package list.\r |
5795218e | 215 | @retval EFI_NOT_FOUND The specified PackageList is not in the Database.\r |
d1f95000 | 216 | \r |
217 | **/\r | |
218 | typedef\r | |
219 | EFI_STATUS\r | |
8b13229b | 220 | (EFIAPI *EFI_HII_GET_2ND_LANGUAGES)(\r |
7d582d6b | 221 | IN CONST EFI_HII_STRING_PROTOCOL *This,\r |
222 | IN EFI_HII_HANDLE PackageList,\r | |
4f077902 SZ |
223 | IN CONST CHAR8 *PrimaryLanguage,\r |
224 | IN OUT CHAR8 *SecondaryLanguages,\r | |
225 | IN OUT UINTN *SecondaryLanguagesSize\r | |
d1f95000 | 226 | );\r |
227 | \r | |
228 | \r | |
44717a39 | 229 | ///\r |
230 | /// Services to manipulate the string.\r | |
231 | ///\r | |
d1f95000 | 232 | struct _EFI_HII_STRING_PROTOCOL {\r |
233 | EFI_HII_NEW_STRING NewString;\r | |
234 | EFI_HII_GET_STRING GetString;\r | |
235 | EFI_HII_SET_STRING SetString;\r | |
236 | EFI_HII_GET_LANGUAGES GetLanguages;\r | |
237 | EFI_HII_GET_2ND_LANGUAGES GetSecondaryLanguages;\r | |
238 | };\r | |
239 | \r | |
240 | \r | |
241 | extern EFI_GUID gEfiHiiStringProtocolGuid;\r | |
242 | \r | |
243 | #endif\r | |
244 | \r |