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