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