summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.h
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2019-03-06 14:22:06 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-03-08 17:07:21 +0000
commite89fbd8c3aa50a24e5fc02ab710ccca67fce98e2 (patch)
treea7be2f7405d55c6c0823b9b52faadce65db4d814 /src/corelib/tools/qstring.h
parent01a54342521de9994ef54f4a01916b8782c685f6 (diff)
Add QStringView::toWCharArray() to match QString
QCollator needs it to add support for QStringView. In any case, it extends the mirror of QString's API. Naturally, we can reimplement QString's version using it. Change-Id: I5a23a3f2a98c7d59597b5e935542a93764b5e350 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r--src/corelib/tools/qstring.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 23972d196c..e9a205dfdf 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1021,12 +1021,7 @@ QT_WARNING_DISABLE_INTEL(111) // "statement is unreachable"
inline int QString::toWCharArray(wchar_t *array) const
{
- if (sizeof(wchar_t) == sizeof(QChar)) {
- memcpy(array, d->data(), sizeof(QChar) * size());
- return size();
- } else {
- return toUcs4_helper(d->data(), size(), reinterpret_cast<uint *>(array));
- }
+ return QStringView(*this).toWCharArray(array);
}
QT_WARNING_POP