MCPcopy Create free account
hub / github.com/apache/trafficserver / classify

Method classify

plugins/cachekey/pattern.cc:490–504  ·  view source on GitHub ↗

* @brief Classifies a subject string by matching against the vector of named multi-patterns * in the order they were added and returns the first 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. * @return true if something matched, false otherwise. */

Source from the content-addressed store, hash-verified

488 * @return true if something matched, false otherwise.
489 */
490bool
491Classifier::classify(const String &subject, String &name) const
492{
493 bool matched = false;
494 for (auto p : _list) {
495 if (p->empty()) {
496 continue;
497 } else if (p->match(subject)) {
498 name = p->name();
499 matched = true;
500 break;
501 }
502 }
503 return matched;
504}
505
506/**
507 * @brief Adds a multi-pattern to the classifier.

Callers 1

classifyUserAgentFunction · 0.45

Calls 3

emptyMethod · 0.45
matchMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected