MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isValidGlobPattern

Function isValidGlobPattern

lib/utils.cpp:40–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40bool 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
60bool matchglob(const std::string& pattern, const std::string& name, bool caseInsensitive)
61{

Callers 2

addSuppressionMethod · 0.85
isValidGlobPatternMethod · 0.85

Calls

no outgoing calls

Tested by 1

isValidGlobPatternMethod · 0.68