| 19 | |
| 20 | |
| 21 | Matcher::Matcher(const char* pattern) { |
| 22 | if (pattern[0] == '*') { |
| 23 | _type = MATCH_ENDS_WITH; |
| 24 | _pattern = strdup(pattern + 1); |
| 25 | } else { |
| 26 | _type = MATCH_EQUALS; |
| 27 | _pattern = strdup(pattern); |
| 28 | } |
| 29 | |
| 30 | _len = strlen(_pattern); |
| 31 | if (_len > 0 && _pattern[_len - 1] == '*') { |
| 32 | _type = _type == MATCH_EQUALS ? MATCH_STARTS_WITH : MATCH_CONTAINS; |
| 33 | _pattern[--_len] = 0; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | Matcher::~Matcher() { |
| 38 | free(_pattern); |
nothing calls this directly
no outgoing calls
no test coverage detected