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

Function isPrefixStringCharLiteral

lib/utils.h:133–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133inline static bool isPrefixStringCharLiteral(const std::string &str, char q, const std::string& p)
134{
135 // str must be at least the prefix plus the start and end quote
136 if (str.length() < p.length() + 2)
137 return false;
138
139 // check for end quote
140 if (!endsWith(str, q))
141 return false;
142
143 // check for start quote
144 if (str[p.size()] != q)
145 return false;
146
147 // check for prefix
148 if (str.compare(0, p.size(), p) != 0)
149 return false;
150
151 return true;
152}
153
154inline static bool isStringCharLiteral(const std::string &str, char q)
155{

Callers 7

isUtf8Function · 0.85
isUtf16Function · 0.85
isUtf32Function · 0.85
isCCharFunction · 0.85
isCMultiCharFunction · 0.85
update_property_infoMethod · 0.85
isStringCharLiteralFunction · 0.85

Calls 3

endsWithFunction · 0.70
sizeMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected