summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/tools.pri
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-22 15:51:14 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-03-24 18:34:35 +0000
commit00a8be85d168530e71511f6eb265d00fdd747cd3 (patch)
treef31569b8fb0e149a9a54f8e5e71ce0761d33f9cb /src/corelib/tools/tools.pri
parent83038a7acfc2c1ef82cb9400805410c518245afb (diff)
Long live QStringView!
QStringView is a simple container for (const QChar*, int) and (const char16_t*, size_t). It acts as a replacement interface type for const QString and const QStringRef, and enables passing all kinds of string-like types to functions otherwise expecting const QString& - without the need to convert to QString first. The use of this new class is guarded by a macro that enables three levels of QStringView support: 1. offer QStringView, overload some functions taking QString with QStringView 2. like 1, but remove all overloads of functions taking QStringRef, leaving only the function taking QStringView. Do this only where QStringRef overloads tradionally existed. 3. like 2, but replace functions taking QString, too. This is done in order to measure the impact of QStringView on code size and execution speed, and to help guide the decision of which level to choose for Qt 6. This first patch adds QStringView with most of its planned constructors, but not much more than iterators and isNull()/isEmpty(). Further patches will add support for QStringView to QStringBuilder, add QStringView overloads of functions taking QString, and add the complete API of const QString to QStringView. [ChangeLog][QtCore][QStringView] New class, superseding const QString and QStringRef as function parameters, accepting a wide variety of UTF-16 string data sources, e.g. u"string", std::u16string{,_view}, and, on Windows, L"string", std::wstring{,_view} without converting to QString first. Change-Id: Iac273e46b2c61ec2c31b3dacebb29500599d6898 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/tools/tools.pri')
-rw-r--r--src/corelib/tools/tools.pri2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index bb6c135a1a..8dd3550617 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -62,6 +62,7 @@ HEADERS += \
tools/qstringiterator_p.h \
tools/qstringlist.h \
tools/qstringmatcher.h \
+ tools/qstringview.h \
tools/qtextboundaryfinder.h \
tools/qtimeline.h \
tools/qtools_p.h \
@@ -106,6 +107,7 @@ SOURCES += \
tools/qstring.cpp \
tools/qstringbuilder.cpp \
tools/qstringlist.cpp \
+ tools/qstringview.cpp \
tools/qtextboundaryfinder.cpp \
tools/qtimeline.cpp \
tools/qunicodetools.cpp \