| 2556 | } |
| 2557 | |
| 2558 | bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const |
| 2559 | { |
| 2560 | if (Filters.empty()) |
| 2561 | return true; |
| 2562 | |
| 2563 | if (text == NULL) |
| 2564 | text = ""; |
| 2565 | |
| 2566 | for (const ImGuiTextRange& f : Filters) |
| 2567 | { |
| 2568 | if (f.empty()) |
| 2569 | continue; |
| 2570 | if (f.b[0] == '-') |
| 2571 | { |
| 2572 | // Subtract |
| 2573 | if (ImStristr(text, text_end, f.b + 1, f.e) != NULL) |
| 2574 | return false; |
| 2575 | } |
| 2576 | else |
| 2577 | { |
| 2578 | // Grep |
| 2579 | if (ImStristr(text, text_end, f.b, f.e) != NULL) |
| 2580 | return true; |
| 2581 | } |
| 2582 | } |
| 2583 | |
| 2584 | // Implicit * grep |
| 2585 | if (CountGrep == 0) |
| 2586 | return true; |
| 2587 | |
| 2588 | return false; |
| 2589 | } |
| 2590 | |
| 2591 | //----------------------------------------------------------------------------- |
| 2592 | // [SECTION] ImGuiTextBuffer, ImGuiTextIndex |