| 2433 | } |
| 2434 | |
| 2435 | bool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const |
| 2436 | { |
| 2437 | if (Filters.empty()) |
| 2438 | return true; |
| 2439 | |
| 2440 | if (text == NULL) |
| 2441 | text = ""; |
| 2442 | |
| 2443 | for (int i = 0; i != Filters.Size; i++) |
| 2444 | { |
| 2445 | const ImGuiTextRange& f = Filters[i]; |
| 2446 | if (f.empty()) |
| 2447 | continue; |
| 2448 | if (f.b[0] == '-') |
| 2449 | { |
| 2450 | // Subtract |
| 2451 | if (ImStristr(text, text_end, f.b + 1, f.e) != NULL) |
| 2452 | return false; |
| 2453 | } |
| 2454 | else |
| 2455 | { |
| 2456 | // Grep |
| 2457 | if (ImStristr(text, text_end, f.b, f.e) != NULL) |
| 2458 | return true; |
| 2459 | } |
| 2460 | } |
| 2461 | |
| 2462 | // Implicit * grep |
| 2463 | if (CountGrep == 0) |
| 2464 | return true; |
| 2465 | |
| 2466 | return false; |
| 2467 | } |
| 2468 | |
| 2469 | //----------------------------------------------------------------------------- |
| 2470 | // [SECTION] ImGuiTextBuffer, ImGuiTextIndex |