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

Function splitPath

kdevplatform/util/path.cpp:361–376  ·  view source on GitHub ↗

Optimized QString::split code for the specific Path use-case

Source from the content-addressed store, hash-verified

359
360// Optimized QString::split code for the specific Path use-case
361static QVarLengthArray<QString, 16> splitPath(const QString& source)
362{
363 QVarLengthArray<QString, 16> list;
364 int start = 0;
365 int end = 0;
366 while ((end = source.indexOf(QLatin1Char('/'), start)) != -1) {
367 if (start != end) {
368 list.append(source.mid(start, end - start));
369 }
370 start = end + 1;
371 }
372 if (start != source.size()) {
373 list.append(source.mid(start, -1));
374 }
375 return list;
376}
377
378void Path::addPath(const QString& path)
379{

Callers 1

addPathMethod · 0.85

Calls 4

midMethod · 0.80
indexOfMethod · 0.45
appendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected