Codechange: Use EncodedString for error messages. (#13569)

This commit is contained in:
Peter Nelson
2025-02-16 10:04:32 +00:00
committed by GitHub
parent 43c7865ca2
commit 2d7d085e8e
55 changed files with 426 additions and 390 deletions

View File

@@ -138,6 +138,18 @@ std::string GetString(StringID string, Args &&... args)
EncodedString GetEncodedString(StringID str);
EncodedString GetEncodedStringWithArgs(StringID str, std::span<const StringParameter> params);
/**
* Encode a string with no parameters into an encoded string, if the string id is valid.
* @note the return encoded string will be empty if the string id is not valid.
* @param str String to encode.
* @returns an EncodedString.
*/
static inline EncodedString GetEncodedStringIfValid(StringID str)
{
if (str == INVALID_STRING_ID) return {};
return GetEncodedString(str);
}
/**
* Get an encoded string with parameters.
* @param string String ID to encode.