* 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. */
| 94 | * @param str Another line from the item. |
| 95 | */ |
| 96 | void 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 | } |
no test coverage detected