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

Function isRelativePattern

lib/pathmatch.h:140–155  ·  view source on GitHub ↗

* @brief Check if a pattern is a relative path name. * * @param pattern Pattern to check. * @return true if the pattern has the form of a relative path name pattern. */

Source from the content-addressed store, hash-verified

138 * @return true if the pattern has the form of a relative path name pattern.
139 */
140 static bool isRelativePattern(const std::string &pattern)
141 {
142 if (pattern.empty() || pattern[0] != '.')
143 return false;
144
145 if (pattern.size() < 2 || pattern[1] == '/' || pattern[1] == '\\')
146 return true;
147
148 if (pattern[1] != '.')
149 return false;
150
151 if (pattern.size() < 3 || pattern[2] == '/' || pattern[2] == '\\')
152 return true;
153
154 return false;
155 }
156
157 /**
158 * @brief Join a pattern with a base path.

Callers 3

joinRelativePatternFunction · 0.85
fromPatternMethod · 0.85
matchMethod · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected