From c58ca4256d881ffed865602fd3da8efb6ebc9d5f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 26 Jul 2019 22:43:05 +0300 Subject: Deprecate QStringViewLiteral As a macro, we can't directly deprecate it, but need to make it call something deprecated. That is a new ctor with a new enum type added. The type might be useful for other such ventures, so put it into qglobal.h Remove the QT_NO_UNICODE_LITERAL protection, as it's always false these days, and QT_UNICODE_LITERAL is unconditionally #defined a 20 lines above. [ChangeLog][QtCore][QStringView] Deprecated the (undocumented) QStringViewLiteral macro. Just use u"" or QStringView(u"") instead. Change-Id: I9141320225037e1bc6b7f920bf01a9d0144fdac2 Reviewed-by: Volker Hilsheimer --- tests/auto/corelib/text/qlatin1string/tst_qlatin1string.cpp | 8 ++++---- tests/auto/corelib/text/qstringview/tst_qstringview.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/auto/corelib/text') diff --git a/tests/auto/corelib/text/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/text/qlatin1string/tst_qlatin1string.cpp index cf46159251..0427c81b85 100644 --- a/tests/auto/corelib/text/qlatin1string/tst_qlatin1string.cpp +++ b/tests/auto/corelib/text/qlatin1string/tst_qlatin1string.cpp @@ -70,7 +70,7 @@ void tst_QLatin1String::arg() const do { \ auto p = QLatin1String(pattern); \ QCOMPARE(p.arg(QLatin1String(arg1)), expected); \ - QCOMPARE(p.arg(QStringViewLiteral(arg1)), expected); \ + QCOMPARE(p.arg(u"" arg1), expected); \ QCOMPARE(p.arg(QStringLiteral(arg1)), expected); \ QCOMPARE(p.arg(QString(QLatin1String(arg1))), expected); \ } while (false) \ @@ -79,9 +79,9 @@ void tst_QLatin1String::arg() const do { \ auto p = QLatin1String(pattern); \ QCOMPARE(p.arg(QLatin1String(arg1), QLatin1String(arg2)), expected); \ - QCOMPARE(p.arg(QStringViewLiteral(arg1), QLatin1String(arg2)), expected); \ - QCOMPARE(p.arg(QLatin1String(arg1), QStringViewLiteral(arg2)), expected); \ - QCOMPARE(p.arg(QStringViewLiteral(arg1), QStringViewLiteral(arg2)), expected); \ + QCOMPARE(p.arg(u"" arg1, QLatin1String(arg2)), expected); \ + QCOMPARE(p.arg(QLatin1String(arg1), u"" arg2), expected); \ + QCOMPARE(p.arg(u"" arg1, u"" arg2), expected); \ } while (false) \ /*end*/ diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp index 5d95f43d6a..47ce9a6f63 100644 --- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp +++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp @@ -431,20 +431,20 @@ void tst_QStringView::arg() const { #define CHECK1(pattern, arg1, expected) \ do { \ - auto p = QStringViewLiteral(pattern); \ + auto p = QStringView(u"" pattern); \ QCOMPARE(p.arg(QLatin1String(arg1)), expected); \ - QCOMPARE(p.arg(QStringViewLiteral(arg1)), expected); \ + QCOMPARE(p.arg(u"" arg1), expected); \ QCOMPARE(p.arg(QStringLiteral(arg1)), expected); \ QCOMPARE(p.arg(QString(QLatin1String(arg1))), expected); \ } while (false) \ /*end*/ #define CHECK2(pattern, arg1, arg2, expected) \ do { \ - auto p = QStringViewLiteral(pattern); \ + auto p = QStringView(u"" pattern); \ QCOMPARE(p.arg(QLatin1String(arg1), QLatin1String(arg2)), expected); \ - QCOMPARE(p.arg(QStringViewLiteral(arg1), QLatin1String(arg2)), expected); \ - QCOMPARE(p.arg(QLatin1String(arg1), QStringViewLiteral(arg2)), expected); \ - QCOMPARE(p.arg(QStringViewLiteral(arg1), QStringViewLiteral(arg2)), expected); \ + QCOMPARE(p.arg(u"" arg1, QLatin1String(arg2)), expected); \ + QCOMPARE(p.arg(QLatin1String(arg1), u"" arg2), expected); \ + QCOMPARE(p.arg(u"" arg1, u"" arg2), expected); \ } while (false) \ /*end*/ -- cgit v1.2.3