File indexing completed on 2025-12-13 09:22:35
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsPlugins/Root/TGeoPrimitivesHelper.hpp"
0010
0011 #include <algorithm>
0012
0013 bool ActsPlugins::TGeoPrimitivesHelper::match(const char* first,
0014 const char* second) {
0015
0016 if (*first == '\0' && *second == '\0') {
0017 return true;
0018 }
0019
0020
0021
0022
0023 if (*first == '*' && *(first + 1) != '\0' && *second == '\0') {
0024 return false;
0025 }
0026
0027
0028
0029 if (*first == '?' || *first == *second) {
0030 return match(first + 1, second + 1);
0031 }
0032
0033
0034
0035
0036 if (*first == '*') {
0037 return match(first + 1, second) || match(first, second + 1);
0038 }
0039 return false;
0040 }
0041
0042 bool ActsPlugins::TGeoPrimitivesHelper::match(
0043 const std::vector<std::string>& first, const char* second) {
0044 return std::ranges::any_of(
0045 first, [&](const std::string& f) { return match(f.c_str(), second); });
0046 }