20static const char32_t STATE_WHITESPACE =
' ';
21static const char32_t STATE_WORD =
'w';
22static const char32_t STATE_QUOTE1 =
'\'';
23static const char32_t STATE_QUOTE2 =
'"';
35 char32_t state = STATE_WHITESPACE;
38 auto add_word = [
this, &word]() {
39 if (!word.empty()) this->
word_index.emplace_back(std::move(word),
false);
47 state = STATE_WHITESPACE;
51 if (state == STATE_WHITESPACE) {
57 if (c == STATE_QUOTE1 || c == STATE_QUOTE2) {
62 }
else if (state == STATE_WORD) {
96void StringFilter::AddLine(std::string_view str)
96void StringFilter::AddLine(std::string_view str) {
…}
void PutUtf8(char32_t c)
Append UTF.8 char.
Compose data into a growing std::string.
Constant span of UTF-8 encoded data.
Functions related to the gfx engine.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
bool StrNaturalContainsIgnoreCase(std::string_view str, std::string_view value)
Checks if a string is contained in another string with a locale-aware comparison that is case insensi...
bool StrNaturalContains(std::string_view str, std::string_view value)
Checks if a string is contained in another string with a locale-aware comparison that is case sensiti...
bool StrContainsIgnoreCase(std::string_view str, std::string_view value)
Checks if a string is contained in another string, while ignoring the case of the characters.
Compose strings from textual and binary data.
Functions related to low-level strings.
bool IsWhitespace(char32_t c)
Check whether UNICODE character is whitespace or not, i.e.
Searching and filtering using a stringterm.
Functions related to OTTD's strings.
State of a single filter word.
uint word_matches
Summary of filter state: Number of words matched.
void SetFilterTerm(std::string_view str)
Set the term to filter on.
std::vector< WordState > word_index
Word index and filter state.
bool locale_aware
Match words using the current locale.
void ResetState()
Reset the matching state to process a new item.
const bool * case_sensitive
Match case-sensitively (usually a static variable).
Handling of UTF-8 encoded data.