| 38 | } |
| 39 | |
| 40 | bool isValidGlobPattern(const std::string& pattern) |
| 41 | { |
| 42 | int consecutiveAsterisks = 0; |
| 43 | for (auto i = pattern.cbegin(); i != pattern.cend(); ++i) { |
| 44 | if (*i == '*') { |
| 45 | ++consecutiveAsterisks; |
| 46 | if (consecutiveAsterisks > 2) { |
| 47 | return false; |
| 48 | } |
| 49 | } else if (*i == '?') { |
| 50 | if (consecutiveAsterisks > 0) { |
| 51 | return false; |
| 52 | } |
| 53 | } else { |
| 54 | consecutiveAsterisks = 0; |
| 55 | } |
| 56 | } |
| 57 | return true; |
| 58 | } |
| 59 | |
| 60 | bool matchglob(const std::string& pattern, const std::string& name, bool caseInsensitive) |
| 61 | { |
no outgoing calls