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