Codechange: String parameter encoding for regular strings.
This allows a string and its parameters to be encoded and stored as just one string, instead of juggling with capturing and restoring string parameters. The advantage of EncodedStrings over raw strings is they use current language and parameter values at the point of decoding.
This commit is contained in:
committed by
Peter Nelson
parent
4010313180
commit
1f21e9dc74
@@ -135,6 +135,22 @@ std::string GetString(StringID string, Args &&... args)
|
||||
return GetStringWithArgs(string, params);
|
||||
}
|
||||
|
||||
EncodedString GetEncodedString(StringID str);
|
||||
EncodedString GetEncodedStringWithArgs(StringID str, std::span<const StringParameter> params);
|
||||
|
||||
/**
|
||||
* Get an encoded string with parameters.
|
||||
* @param string String ID to encode.
|
||||
* @param args The parameters to set.
|
||||
* @return The encoded string.
|
||||
*/
|
||||
template <typename... Args>
|
||||
EncodedString GetEncodedString(StringID string, const Args&... args)
|
||||
{
|
||||
auto params = MakeParameters(std::forward<const Args&>(args)...);
|
||||
return GetEncodedStringWithArgs(string, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* A searcher for missing glyphs.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user