MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AddLine

Method AddLine

src/stringfilter.cpp:96–114  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

94 * @param str Another line from the item.
95 */
96void StringFilter::AddLine(std::string_view str)
97{
98 bool match_case = this->case_sensitive != nullptr && *this->case_sensitive;
99 for (WordState &ws : this->word_index) {
100 if (!ws.match) {
101 if (this->locale_aware) {
102 if (match_case ? StrNaturalContains(str, ws.word) : StrNaturalContainsIgnoreCase(str, ws.word)) {
103 ws.match = true;
104 this->word_matches++;
105 }
106 } else {
107 if (match_case ? str.find(ws.word) != str.npos : StrContainsIgnoreCase(str, ws.word)) {
108 ws.match = true;
109 this->word_matches++;
110 }
111 }
112 }
113 }
114}

Callers 13

UpdateFilterStateMethod · 0.45
SignNameFilterMethod · 0.45
BuildDisplayListMethod · 0.45
TagNameFilterMethod · 0.45
BuildSortTownListMethod · 0.45
ClassTagNameFilterFunction · 0.45
TypeTagNameFilterFunction · 0.45
FilterByTextMethod · 0.45
BadgeTextFilterMethod · 0.45
OnInvalidateDataMethod · 0.45
TagNameFilterMethod · 0.45

Calls 4

StrNaturalContainsFunction · 0.85
StrContainsIgnoreCaseFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected