1
0
Fork 0

Codechange: Always pass raw strings to TextFilter's AddLine(). (#13666)

Remove StringID overload, so callers have to preformat the string.
pull/13667/head
Peter Nelson 2025-02-27 19:21:43 +00:00 committed by GitHub
parent b376e2655a
commit 8813a798e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 32 deletions

View File

@ -234,9 +234,8 @@ bool SettingEntry::UpdateFilterState(SettingFilter &filter, bool force_visible)
/* Process the search text filter for this item. */
filter.string.ResetState();
SetDParam(0, STR_EMPTY);
filter.string.AddLine(sd->GetTitle());
filter.string.AddLine(sd->GetHelp());
filter.string.AddLine(GetString(sd->GetTitle(), STR_EMPTY));
filter.string.AddLine(GetString(sd->GetHelp()));
visible = filter.string.GetState();
}
@ -530,7 +529,7 @@ bool SettingsPage::UpdateFilterState(SettingFilter &filter, bool force_visible)
{
if (!force_visible && !filter.string.IsEmpty()) {
filter.string.ResetState();
filter.string.AddLine(this->title);
filter.string.AddLine(GetString(this->title));
force_visible = filter.string.GetState();
}

View File

@ -123,29 +123,3 @@ void StringFilter::AddLine(const char *str)
}
}
}
/**
* Pass another text line from the current item to the filter.
*
* You can call this multiple times for a single item, if the filter shall apply to multiple things.
* Before processing the next item you have to call ResetState().
*
* @param str Another line from the item.
*/
void StringFilter::AddLine(const std::string &str)
{
AddLine(str.c_str());
}
/**
* Pass another text line from the current item to the filter.
*
* You can call this multiple times for a single item, if the filter shall apply to multiple things.
* Before processing the next item you have to call ResetState().
*
* @param str Another line from the item.
*/
void StringFilter::AddLine(StringID str)
{
AddLine(GetString(str));
}

View File

@ -58,8 +58,7 @@ public:
void ResetState();
void AddLine(const char *str);
void AddLine(const std::string &str);
void AddLine(StringID str);
void AddLine(const std::string &str) { this->AddLine(str.c_str()); }
/**
* Get the matching state of the current item.