MCPcopy Create free account
hub / github.com/KDE/kdevelop / findCommaOrEnd

Function findCommaOrEnd

kdevplatform/language/duchain/stringhelpers.cpp:340–369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338} // unnamed namespace
339
340int findCommaOrEnd(QStringView str, int pos, QChar validEnd)
341{
342 const auto size = str.size();
343 Q_ASSERT(pos >= 0 && pos <= size);
344
345 for (; pos < size; ++pos) {
346 switch (str[pos].unicode()) {
347 // Take into account brackets of all types, not just the validEnd type, to skip ',' within them.
348 case '<':
349 if (!isOperator(str, pos)) {
350 pos = findClosingAngleBracket(str, pos);
351 }
352 break;
353 case '(':
354 case '[':
355 case '{':
356 pos = findClosingNonAngleBracket(str, pos);
357 break;
358 case ',':
359 return pos;
360 default:
361 if (str[pos] == validEnd && !(str[pos] == QLatin1Char('>') && isOperatorOrArrowOperator(str, pos))) {
362 return pos;
363 }
364 pos = trySkipStringOrCharLiteralOrComment(str, pos);
365 }
366 }
367
368 return size;
369}
370
371// NOTE: keep in sync with QString overload below
372QByteArray formatComment(const QByteArray& comment)

Callers 1

nextMethod · 0.85

Calls 6

isOperatorFunction · 0.85
findClosingAngleBracketFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected