]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/HiiString.h
MdePkg: 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
2f88bd3a 64 );\r
d1f95000 65\r
66/**\r
4ca9b6c4
LG
67 This function retrieves the string specified by StringId which is associated\r
68 with the specified PackageList in the language Language and copies it into\r
69 the buffer specified by String.\r
70\r
71 @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
72 @param Language Points to the language for the retrieved string.\r
73 @param PackageList The package list in the HII database to search for\r
74 the specified string.\r
75 @param StringId The string's id, which is unique within\r
76 PackageList.\r
77 @param String Points to the new null-terminated string.\r
78 @param StringSize On entry, points to the size of the buffer pointed\r
79 to by String, in bytes. On return, points to the\r
80 length of the string, in bytes.\r
81 @param StringFontInfo If not NULL, points to the string's font\r
82 information. It's caller's responsibility to free\r
83 this buffer.\r
84\r
85 @retval EFI_SUCCESS The string was returned successfully.\r
86 @retval EFI_NOT_FOUND The string specified by StringId is not available.\r
4ca9b6c4 87 The specified PackageList is not in the database.\r
9095d37b 88 @retval EFI_INVALID_LANGUAGE The string specified by StringId is available but\r
5795218e 89 not in the specified language.\r
4ca9b6c4
LG
90 @retval EFI_BUFFER_TOO_SMALL The buffer specified by StringSize is too small to\r
91 hold the string.\r
5795218e
ED
92 @retval EFI_INVALID_PARAMETER The Language or StringSize was NULL.\r
93 @retval EFI_INVALID_PARAMETER The value referenced by StringSize was not zero and\r
94 String was NULL.\r
95 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the\r
96 request.\r
d1f95000 97\r
d1f95000 98**/\r
99typedef\r
100EFI_STATUS\r
8b13229b 101(EFIAPI *EFI_HII_GET_STRING)(\r
d1f95000 102 IN CONST EFI_HII_STRING_PROTOCOL *This,\r
103 IN CONST CHAR8 *Language,\r
7d582d6b 104 IN EFI_HII_HANDLE PackageList,\r
105 IN EFI_STRING_ID StringId,\r
d1f95000 106 OUT EFI_STRING String,\r
7d582d6b 107 IN OUT UINTN *StringSize,\r
108 OUT EFI_FONT_INFO **StringFontInfo OPTIONAL\r
2f88bd3a 109 );\r
d1f95000 110\r
111/**\r
4ca9b6c4
LG
112 This function updates the string specified by StringId in the specified PackageList to the text\r
113 specified by String and, optionally, the font information specified by StringFontInfo.\r
114\r
115 @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
116 @param PackageList The package list containing the strings.\r
117 @param StringId The string's id, which is unique within\r
118 PackageList.\r
119 @param Language Points to the language for the updated string.\r
120 @param String Points to the new null-terminated string.\r
121 @param StringFontInfo Points to the string's font information or NULL if\r
122 the string font information is not changed.\r
123\r
124 @retval EFI_SUCCESS The string was updated successfully.\r
125 @retval EFI_NOT_FOUND The string specified by StringId is not in the\r
126 database.\r
127 @retval EFI_INVALID_PARAMETER The String or Language was NULL.\r
128 @retval EFI_INVALID_PARAMETER The specified StringFontInfo does not exist in\r
129 current database.\r
130 @retval EFI_OUT_OF_RESOURCES The system is out of resources to accomplish the\r
131 task.\r
d1f95000 132\r
133**/\r
134typedef\r
135EFI_STATUS\r
8b13229b 136(EFIAPI *EFI_HII_SET_STRING)(\r
d1f95000 137 IN CONST EFI_HII_STRING_PROTOCOL *This,\r
7d582d6b 138 IN EFI_HII_HANDLE PackageList,\r
139 IN EFI_STRING_ID StringId,\r
d1f95000 140 IN CONST CHAR8 *Language,\r
7d582d6b 141 IN EFI_STRING String,\r
d1f95000 142 IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL\r
2f88bd3a 143 );\r
d1f95000 144\r
145/**\r
d1f95000 146 This function returns the list of supported languages.\r
147\r
4ca9b6c4
LG
148 @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
149 @param PackageList The package list to examine.\r
4f077902
SZ
150 @param Languages Points to the buffer to hold the returned\r
151 null-terminated ASCII string.\r
4ca9b6c4 152 @param LanguagesSize On entry, points to the size of the buffer pointed\r
4f077902 153 to by Languages, in bytes. On return, points to\r
4ca9b6c4
LG
154 the length of Languages, in bytes.\r
155\r
156 @retval EFI_SUCCESS The languages were returned successfully.\r
5795218e
ED
157 @retval EFI_INVALID_PARAMETER The LanguagesSize was NULL.\r
158 @retval EFI_INVALID_PARAMETER The value referenced by LanguagesSize is not zero\r
159 and Languages is NULL.\r
4ca9b6c4
LG
160 @retval EFI_BUFFER_TOO_SMALL The LanguagesSize is too small to hold the list of\r
161 supported languages. LanguageSize is updated to\r
162 contain the required size.\r
163 @retval EFI_NOT_FOUND Could not find string package in specified\r
164 packagelist.\r
d1f95000 165\r
166**/\r
167typedef\r
168EFI_STATUS\r
8b13229b 169(EFIAPI *EFI_HII_GET_LANGUAGES)(\r
7d582d6b 170 IN CONST EFI_HII_STRING_PROTOCOL *This,\r
171 IN EFI_HII_HANDLE PackageList,\r
d1f95000 172 IN OUT CHAR8 *Languages,\r
7d582d6b 173 IN OUT UINTN *LanguagesSize\r
2f88bd3a 174 );\r
d1f95000 175\r
176/**\r
4ca9b6c4
LG
177 Each string package has associated with it a single primary language and zero\r
178 or more secondary languages. This routine returns the secondary languages\r
179 associated with a package list.\r
180\r
181 @param This A pointer to the EFI_HII_STRING_PROTOCOL instance.\r
182 @param PackageList The package list to examine.\r
4f077902
SZ
183 @param PrimaryLanguage Points to the null-terminated ASCII string that specifies\r
184 the primary language. Languages are specified in the\r
185 format specified in Appendix M of the UEFI 2.0 specification.\r
186 @param SecondaryLanguages Points to the buffer to hold the returned null-terminated\r
187 ASCII string that describes the list of\r
4ca9b6c4 188 secondary languages for the specified\r
4f077902
SZ
189 PrimaryLanguage. If there are no secondary\r
190 languages, the function returns successfully, but\r
4ca9b6c4
LG
191 this is set to NULL.\r
192 @param SecondaryLanguagesSize On entry, points to the size of the buffer pointed\r
4f077902 193 to by SecondaryLanguages, in bytes. On return,\r
4ca9b6c4
LG
194 points to the length of SecondaryLanguages in bytes.\r
195\r
196 @retval EFI_SUCCESS Secondary languages were correctly returned.\r
5795218e
ED
197 @retval EFI_INVALID_PARAMETER PrimaryLanguage or SecondaryLanguagesSize was NULL.\r
198 @retval EFI_INVALID_PARAMETER The value referenced by SecondaryLanguagesSize is not\r
199 zero and SecondaryLanguages is NULL.\r
4ca9b6c4
LG
200 @retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondaryLanguagesSize is\r
201 too small to hold the returned information.\r
4f077902 202 SecondaryLanguageSize is updated to hold the size of\r
4ca9b6c4 203 the buffer required.\r
4f077902 204 @retval EFI_INVALID_LANGUAGE The language specified by PrimaryLanguage is not\r
4ca9b6c4 205 present in the specified package list.\r
5795218e 206 @retval EFI_NOT_FOUND The specified PackageList is not in the Database.\r
d1f95000 207\r
208**/\r
209typedef\r
210EFI_STATUS\r
8b13229b 211(EFIAPI *EFI_HII_GET_2ND_LANGUAGES)(\r
7d582d6b 212 IN CONST EFI_HII_STRING_PROTOCOL *This,\r
213 IN EFI_HII_HANDLE PackageList,\r
4f077902
SZ
214 IN CONST CHAR8 *PrimaryLanguage,\r
215 IN OUT CHAR8 *SecondaryLanguages,\r
216 IN OUT UINTN *SecondaryLanguagesSize\r
2f88bd3a 217 );\r
d1f95000 218\r
44717a39 219///\r
220/// Services to manipulate the string.\r
221///\r
d1f95000 222struct _EFI_HII_STRING_PROTOCOL {\r
2f88bd3a
MK
223 EFI_HII_NEW_STRING NewString;\r
224 EFI_HII_GET_STRING GetString;\r
225 EFI_HII_SET_STRING SetString;\r
226 EFI_HII_GET_LANGUAGES GetLanguages;\r
227 EFI_HII_GET_2ND_LANGUAGES GetSecondaryLanguages;\r
d1f95000 228};\r
229\r
2f88bd3a 230extern EFI_GUID gEfiHiiStringProtocolGuid;\r
d1f95000 231\r
232#endif\r