Path: blob/main/sys/contrib/edk2/Include/Protocol/HiiString.h
96339 views
/** @file1The file provides services to manipulate string data.23Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>4SPDX-License-Identifier: BSD-2-Clause-Patent56@par Revision Reference:7This Protocol was introduced in UEFI Specification 2.1.89**/1011#ifndef __HII_STRING_H__12#define __HII_STRING_H__1314#include <Protocol/HiiFont.h>1516#define EFI_HII_STRING_PROTOCOL_GUID \17{ 0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } }1819typedef struct _EFI_HII_STRING_PROTOCOL EFI_HII_STRING_PROTOCOL;2021/**22This function adds the string String to the group of strings owned by PackageList, with the23specified font information StringFontInfo, and returns a new string id.24The new string identifier is guaranteed to be unique within the package list.25That new string identifier is reserved for all languages in the package list.2627@param This A pointer to the EFI_HII_STRING_PROTOCOL instance.28@param PackageList The handle of the package list where this string will29be added.30@param StringId On return, contains the new strings id, which is31unique within PackageList.32@param Language Points to the language for the new string.33@param LanguageName Points to the printable language name to associate34with the passed in Language field.If LanguageName35is not NULL and the string package header's36LanguageName associated with a given Language is37not zero, the LanguageName being passed in will38be ignored.39@param String Points to the new null-terminated string.40@param StringFontInfo Points to the new string's font information or41NULL if the string should have the default system42font, size and style.4344@retval EFI_SUCCESS The new string was added successfully.45@retval EFI_NOT_FOUND The specified PackageList could not be found in46database.47@retval EFI_OUT_OF_RESOURCES Could not add the string due to lack of resources.48@retval EFI_INVALID_PARAMETER String is NULL, or StringId is NULL, or Language is NULL.49@retval EFI_INVALID_PARAMETER The specified StringFontInfo does not exist in50current database.5152**/53typedef54EFI_STATUS55(EFIAPI *EFI_HII_NEW_STRING)(56IN CONST EFI_HII_STRING_PROTOCOL *This,57IN EFI_HII_HANDLE PackageList,58OUT EFI_STRING_ID *StringId,59IN CONST CHAR8 *Language,60IN CONST CHAR16 *LanguageName OPTIONAL,61IN CONST EFI_STRING String,62IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL63);6465/**66This function retrieves the string specified by StringId which is associated67with the specified PackageList in the language Language and copies it into68the buffer specified by String.6970@param This A pointer to the EFI_HII_STRING_PROTOCOL instance.71@param Language Points to the language for the retrieved string.72@param PackageList The package list in the HII database to search for73the specified string.74@param StringId The string's id, which is unique within75PackageList.76@param String Points to the new null-terminated string.77@param StringSize On entry, points to the size of the buffer pointed78to by String, in bytes. On return, points to the79length of the string, in bytes.80@param StringFontInfo If not NULL, points to the string's font81information. It's caller's responsibility to free82this buffer.8384@retval EFI_SUCCESS The string was returned successfully.85@retval EFI_NOT_FOUND The string specified by StringId is not available.86The specified PackageList is not in the database.87@retval EFI_INVALID_LANGUAGE The string specified by StringId is available but88not in the specified language.89@retval EFI_BUFFER_TOO_SMALL The buffer specified by StringSize is too small to90hold the string.91@retval EFI_INVALID_PARAMETER The Language or StringSize was NULL.92@retval EFI_INVALID_PARAMETER The value referenced by StringSize was not zero and93String was NULL.94@retval EFI_OUT_OF_RESOURCES There were insufficient resources to complete the95request.9697**/98typedef99EFI_STATUS100(EFIAPI *EFI_HII_GET_STRING)(101IN CONST EFI_HII_STRING_PROTOCOL *This,102IN CONST CHAR8 *Language,103IN EFI_HII_HANDLE PackageList,104IN EFI_STRING_ID StringId,105OUT EFI_STRING String,106IN OUT UINTN *StringSize,107OUT EFI_FONT_INFO **StringFontInfo OPTIONAL108);109110/**111This function updates the string specified by StringId in the specified PackageList to the text112specified by String and, optionally, the font information specified by StringFontInfo.113114@param This A pointer to the EFI_HII_STRING_PROTOCOL instance.115@param PackageList The package list containing the strings.116@param StringId The string's id, which is unique within117PackageList.118@param Language Points to the language for the updated string.119@param String Points to the new null-terminated string.120@param StringFontInfo Points to the string's font information or NULL if121the string font information is not changed.122123@retval EFI_SUCCESS The string was updated successfully.124@retval EFI_NOT_FOUND The string specified by StringId is not in the125database.126@retval EFI_INVALID_PARAMETER The String or Language was NULL.127@retval EFI_INVALID_PARAMETER The specified StringFontInfo does not exist in128current database.129@retval EFI_OUT_OF_RESOURCES The system is out of resources to accomplish the130task.131132**/133typedef134EFI_STATUS135(EFIAPI *EFI_HII_SET_STRING)(136IN CONST EFI_HII_STRING_PROTOCOL *This,137IN EFI_HII_HANDLE PackageList,138IN EFI_STRING_ID StringId,139IN CONST CHAR8 *Language,140IN EFI_STRING String,141IN CONST EFI_FONT_INFO *StringFontInfo OPTIONAL142);143144/**145This function returns the list of supported languages.146147@param This A pointer to the EFI_HII_STRING_PROTOCOL instance.148@param PackageList The package list to examine.149@param Languages Points to the buffer to hold the returned150null-terminated ASCII string.151@param LanguagesSize On entry, points to the size of the buffer pointed152to by Languages, in bytes. On return, points to153the length of Languages, in bytes.154155@retval EFI_SUCCESS The languages were returned successfully.156@retval EFI_INVALID_PARAMETER The LanguagesSize was NULL.157@retval EFI_INVALID_PARAMETER The value referenced by LanguagesSize is not zero158and Languages is NULL.159@retval EFI_BUFFER_TOO_SMALL The LanguagesSize is too small to hold the list of160supported languages. LanguageSize is updated to161contain the required size.162@retval EFI_NOT_FOUND Could not find string package in specified163packagelist.164165**/166typedef167EFI_STATUS168(EFIAPI *EFI_HII_GET_LANGUAGES)(169IN CONST EFI_HII_STRING_PROTOCOL *This,170IN EFI_HII_HANDLE PackageList,171IN OUT CHAR8 *Languages,172IN OUT UINTN *LanguagesSize173);174175/**176Each string package has associated with it a single primary language and zero177or more secondary languages. This routine returns the secondary languages178associated with a package list.179180@param This A pointer to the EFI_HII_STRING_PROTOCOL instance.181@param PackageList The package list to examine.182@param PrimaryLanguage Points to the null-terminated ASCII string that specifies183the primary language. Languages are specified in the184format specified in Appendix M of the UEFI 2.0 specification.185@param SecondaryLanguages Points to the buffer to hold the returned null-terminated186ASCII string that describes the list of187secondary languages for the specified188PrimaryLanguage. If there are no secondary189languages, the function returns successfully, but190this is set to NULL.191@param SecondaryLanguagesSize On entry, points to the size of the buffer pointed192to by SecondaryLanguages, in bytes. On return,193points to the length of SecondaryLanguages in bytes.194195@retval EFI_SUCCESS Secondary languages were correctly returned.196@retval EFI_INVALID_PARAMETER PrimaryLanguage or SecondaryLanguagesSize was NULL.197@retval EFI_INVALID_PARAMETER The value referenced by SecondaryLanguagesSize is not198zero and SecondaryLanguages is NULL.199@retval EFI_BUFFER_TOO_SMALL The buffer specified by SecondaryLanguagesSize is200too small to hold the returned information.201SecondaryLanguageSize is updated to hold the size of202the buffer required.203@retval EFI_INVALID_LANGUAGE The language specified by PrimaryLanguage is not204present in the specified package list.205@retval EFI_NOT_FOUND The specified PackageList is not in the Database.206207**/208typedef209EFI_STATUS210(EFIAPI *EFI_HII_GET_2ND_LANGUAGES)(211IN CONST EFI_HII_STRING_PROTOCOL *This,212IN EFI_HII_HANDLE PackageList,213IN CONST CHAR8 *PrimaryLanguage,214IN OUT CHAR8 *SecondaryLanguages,215IN OUT UINTN *SecondaryLanguagesSize216);217218///219/// Services to manipulate the string.220///221struct _EFI_HII_STRING_PROTOCOL {222EFI_HII_NEW_STRING NewString;223EFI_HII_GET_STRING GetString;224EFI_HII_SET_STRING SetString;225EFI_HII_GET_LANGUAGES GetLanguages;226EFI_HII_GET_2ND_LANGUAGES GetSecondaryLanguages;227};228229extern EFI_GUID gEfiHiiStringProtocolGuid;230231#endif232233234