* @brief Matches a subject string by matching against the vector of named multi-patterns * in the order they were added and returns the first non-matching multi-pattern name. * @param subject string subject being classified. * @param name reference to a string where the name of the class that matched first will be stored. * @param pattern last checked pattern from the multi-pattern that did no
| 545 | * @return true if all multi-patterns matched, false otherwise. |
| 546 | */ |
| 547 | bool |
| 548 | Classifier::matchAll(const String &subject, String &name, String &pattern) const |
| 549 | { |
| 550 | bool matched = true; |
| 551 | for (auto p : _list) { |
| 552 | if (p->empty()) { |
| 553 | continue; |
| 554 | } else if (!p->match(subject, pattern)) { |
| 555 | name = p->name(); |
| 556 | matched = false; |
| 557 | break; |
| 558 | } |
| 559 | } |
| 560 | return matched; |
| 561 | } |
| 562 | |
| 563 | /** |
| 564 | * @brief Adds a multi-pattern to the classifier. |
no test coverage detected