Optimized QString::split code for the specific Path use-case
| 359 | |
| 360 | // Optimized QString::split code for the specific Path use-case |
| 361 | static 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 | |
| 378 | void Path::addPath(const QString& path) |
| 379 | { |