Codechange: Use std::array as simple string parameter container.
ArrayStringParameters contains extra state that is used when formatting strings which isn't needed when creating parameter lists. MakeParameters() now returns a std::array which contains only the parameter data. This simpler container is more widely available than before.
This commit is contained in:
committed by
Peter Nelson
parent
fb70a7fe7e
commit
be00fd4447
@@ -59,6 +59,7 @@ inline StringID MakeStringID(StringTab tab, StringIndexInTab index)
|
||||
return (tab << TAB_SIZE_BITS) + index.base();
|
||||
}
|
||||
|
||||
std::string GetStringWithArgs(StringID string, std::span<StringParameter> args);
|
||||
std::string GetString(StringID string);
|
||||
const char *GetStringPtr(StringID string);
|
||||
void AppendStringInPlace(std::string &result, StringID string);
|
||||
@@ -109,6 +110,18 @@ void InitializeLanguagePacks();
|
||||
const char *GetCurrentLanguageIsoCode();
|
||||
std::string_view GetListSeparator();
|
||||
|
||||
/**
|
||||
* Helper to create the StringParameters with its own buffer with the given
|
||||
* parameter values.
|
||||
* @param args The parameters to set for the to be created StringParameters.
|
||||
* @return The constructed StringParameters.
|
||||
*/
|
||||
template <typename... Args>
|
||||
auto MakeParameters(Args &&... args)
|
||||
{
|
||||
return std::array<StringParameter, sizeof...(args)>({std::forward<StringParameter>(args)...});
|
||||
}
|
||||
|
||||
/**
|
||||
* A searcher for missing glyphs.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user