| 70 | } |
| 71 | |
| 72 | QStringView joinTokens(const QVarLengthArray<QStringView>& tokens) |
| 73 | { |
| 74 | Q_ASSERT(!tokens.isEmpty()); |
| 75 | |
| 76 | // All tokens are views into the same underlying string, so the span |
| 77 | // from the first token to the end of the last token can be recovered |
| 78 | // with pointer arithmetic. This preserves any whitespace between them. |
| 79 | const QStringView& first = tokens.front(); |
| 80 | const QStringView& last = tokens.back(); |
| 81 | |
| 82 | return QStringView(first.data(), (last.data() + last.size()) - first.data()); |
| 83 | } |
| 84 | |
| 85 | } // namespace |
| 86 |
no test coverage detected