int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const { QVarLengthArray<wchar_t> array1, array2; stringToWCharArray(array1, QString(s1, len1)); stringToWCharArray(array2, QString(s2, len2)); return std::wcscoll(array1.constData(), array2.constData()); }
int QCollator::compare(const QString &s1, const QString &s2) const { QVarLengthArray<wchar_t> array1, array2; stringToWCharArray(array1, s1); stringToWCharArray(array2, s2); return std::wcscoll(array1.constData(), array2.constData()); }
QCollatorSortKey QCollator::sortKey(const QString &string) const { QVarLengthArray<wchar_t> original; stringToWCharArray(original, string); QVector<wchar_t> result(string.size()); size_t size = std::wcsxfrm(result.data(), original.constData(), string.size()); if (size > uint(result.size())) { result.resize(size+1); size = std::wcsxfrm(result.data(), original.constData(), string.size()); } result.resize(size+1); result[size] = 0; return QCollatorSortKey(new QCollatorSortKeyPrivate(result)); }