summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qchar.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-04-24 10:55:01 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-04-26 09:13:07 +0000
commit9763b324fd4c17e39854ffadf69d7ea415e397f8 (patch)
treeb91ff88cbafcf647ebb008fa7b141f33b56e9fd5 /src/corelib/tools/qchar.cpp
parent309b4b877f88e8cc490c9d609e70c58e919b084f (diff)
Port internal qt_starts/ends_with to QStringView
... and add a version taking a QChar needle. Back the implementation with a template function. Mark the slightly surprising behavior that null.startsWith(empty) == false but null.startsWith(null) == true even though empty == null, for review come Qt 6. Saves 0.5KiB in text size on optimized GCC 7.0 Linux AMD64 builds. Change-Id: I2576472d22ccf22ec89911eaed25188f9f7b654f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qchar.cpp')
-rw-r--r--src/corelib/tools/qchar.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index 085adb1859..5c887f47cd 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1550,6 +1550,11 @@ static inline ushort foldCase(ushort ch) Q_DECL_NOTHROW
return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);
}
+static inline QChar foldCase(QChar ch) Q_DECL_NOTHROW
+{
+ return QChar(foldCase(ch.unicode()));
+}
+
/*!
\fn QChar QChar::toCaseFolded() const