| 470 | } |
| 471 | |
| 472 | bool matches(const Config & config, const char * path) const |
| 473 | { |
| 474 | switch (m_type) |
| 475 | { |
| 476 | case FILE_RULE_DEFAULT: |
| 477 | return true; |
| 478 | case FILE_RULE_PARSE_FILEPATH: |
| 479 | { |
| 480 | const int rightMostColorSpaceIndex = ParseColorSpaceFromString(config, path); |
| 481 | if (rightMostColorSpaceIndex >= 0) |
| 482 | { |
| 483 | m_colorSpace = config.getColorSpaceNameByIndex(SEARCH_REFERENCE_SPACE_ALL, |
| 484 | COLORSPACE_ALL, |
| 485 | rightMostColorSpaceIndex); |
| 486 | return true; |
| 487 | } |
| 488 | return false; |
| 489 | } |
| 490 | case FILE_RULE_REGEX: |
| 491 | { |
| 492 | const std::regex reg(m_regex.c_str()); |
| 493 | return regex_match(path, reg); |
| 494 | } |
| 495 | case FILE_RULE_GLOB: |
| 496 | { |
| 497 | const std::string exp = BuildRegularExpression(m_pattern.c_str(), |
| 498 | m_extension.c_str()); |
| 499 | const std::regex reg(exp.c_str()); |
| 500 | return regex_match(path, reg); |
| 501 | } |
| 502 | } |
| 503 | return false; |
| 504 | } |
| 505 | |
| 506 | void validate(const Config & cfg) const |
| 507 | { |
no test coverage detected