aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-11-28 15:43:59 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-12-04 18:39:49 +0100
commitf0e342c9272df3adaca5fb835ed9897e39b776d1 (patch)
treef7b4dd241222238e720880c7c576bae1c275708b
parentb840fd68c0527c4f8ebe315c712afb5df6c38f27 (diff)
Port more strings constants to latin1
Task-number: PYSIDE-2537 Change-Id: I5e8f4b46c69a39f1a85a0186c2e50b2169aa9cc9 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
-rw-r--r--sources/shiboken6/ApiExtractor/dotview.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/typedatabase.cpp4
-rw-r--r--sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp8
-rw-r--r--sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp8
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp2
-rw-r--r--sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp6
7 files changed, 18 insertions, 18 deletions
diff --git a/sources/shiboken6/ApiExtractor/dotview.cpp b/sources/shiboken6/ApiExtractor/dotview.cpp
index da94f5e7f..0bd192257 100644
--- a/sources/shiboken6/ApiExtractor/dotview.cpp
+++ b/sources/shiboken6/ApiExtractor/dotview.cpp
@@ -13,7 +13,7 @@ using namespace Qt::StringLiterals;
bool showDotGraph(const QString &name, const QString &graph)
{
- const QString imageType = u"jpg"_s;
+ constexpr auto imageType = "jpg"_L1;
// Write out the graph to a temporary file
QTemporaryFile dotFile(QDir::tempPath() + u'/' + name + u"_XXXXXX.dot"_s);
@@ -43,9 +43,9 @@ bool showDotGraph(const QString &name, const QString &graph)
// Launch image. Should use QDesktopServices::openUrl(),
// but we don't link against QtGui
#ifdef Q_OS_UNIX
- const QString imageViewer = u"gwenview"_s;
+ constexpr auto imageViewer = "gwenview"_L1;
#else
- const QString imageViewer = u"mspaint"_s;
+ constexpr auto imageViewer = "mspaint"_L1;
#endif
if (!QProcess::startDetached(imageViewer, {imageFile})) {
qWarning("Failed to launch viewer: %s", qPrintable(imageViewer));
diff --git a/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp b/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp
index d40cb4d0e..9cf2e0cc7 100644
--- a/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp
@@ -47,7 +47,7 @@ R"(<typesystem package="Foo">
// cannot handle Qt resources.
QTemporaryDir tempDir(QDir::tempPath() + u"/shiboken_testmodifydocXXXXXX"_s);
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
- const QString docFileName = u"a.xml"_s;
+ constexpr auto docFileName = "a.xml"_L1;
QVERIFY(QFile::copy(u":/"_s + docFileName, tempDir.filePath(docFileName)));
QtDocParser docParser;
diff --git a/sources/shiboken6/ApiExtractor/typedatabase.cpp b/sources/shiboken6/ApiExtractor/typedatabase.cpp
index 708a7e55c..ba4883785 100644
--- a/sources/shiboken6/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken6/ApiExtractor/typedatabase.cpp
@@ -1632,13 +1632,13 @@ void TypeDatabasePrivate::addBuiltInPrimitiveTypes()
Q_ASSERT(pyUnicodeEntry && pyUnicodeEntry->isCustom());
auto pyUnicodeCustomEntry = std::static_pointer_cast<CustomTypeEntry>(pyUnicodeEntry);
- const QString stdString = u"std::string"_s;
+ constexpr auto stdString = "std::string"_L1;
if (!m_entries.contains(stdString)) {
addBuiltInCppStringPrimitiveType(stdString, u"std::string_view"_s,
root, rootPackage,
pyUnicodeCustomEntry);
}
- const QString stdWString = u"std::wstring"_s;
+ constexpr auto stdWString = "std::wstring"_L1;
if (!m_entries.contains(stdWString)) {
addBuiltInCppStringPrimitiveType(stdWString, u"std::wstring_view"_s,
root, rootPackage,
diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
index a9c1f2305..ccc6ec702 100644
--- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
@@ -411,7 +411,7 @@ void QtDocGenerator::writePropertyToc(TextStream &s,
if (doc.properties.isEmpty())
return;
- const QString title = u"Properties"_s;
+ constexpr auto title = "Properties"_L1;
s << title << '\n'
<< Pad('^', title.size()) << '\n';
@@ -454,7 +454,7 @@ void QtDocGenerator::writeProperties(TextStream &s,
void QtDocGenerator::writeEnums(TextStream &s, const AbstractMetaClassCPtr &cppClass) const
{
- static const QString section_title = u".. attribute:: "_s;
+ constexpr auto section_title = ".. attribute:: "_L1;
for (const AbstractMetaEnum &en : cppClass->enums()) {
s << section_title << cppClass->fullName() << '.' << en.name() << "\n\n";
@@ -468,7 +468,7 @@ void QtDocGenerator::writeEnums(TextStream &s, const AbstractMetaClassCPtr &cppC
void QtDocGenerator::writeFields(TextStream &s, const AbstractMetaClassCPtr &cppClass) const
{
- static const QString section_title = u".. attribute:: "_s;
+ constexpr auto section_title = ".. attribute:: "_L1;
for (const AbstractMetaField &field : cppClass->fields()) {
s << section_title << cppClass->fullName() << "." << field.name() << "\n\n";
@@ -479,7 +479,7 @@ void QtDocGenerator::writeFields(TextStream &s, const AbstractMetaClassCPtr &cpp
void QtDocGenerator::writeConstructors(TextStream &s, const AbstractMetaClassCPtr &cppClass,
const AbstractMetaFunctionCList &constructors) const
{
- static const QString sectionTitle = u".. class:: "_s;
+ constexpr auto sectionTitle = ".. class:: "_L1;
bool first = true;
QHash<QString, AbstractMetaArgument> arg_map;
diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp
index daf6d6356..226453ab2 100644
--- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp
+++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp
@@ -441,13 +441,13 @@ QString QtXmlToSphinx::popOutputBuffer()
return result;
}
-static const QString autoTranslatedPlaceholder = u"AUTO_GENERATED\n"_s;
-static const QString autoTranslatedNote =
-uR"(.. warning::
+constexpr auto autoTranslatedPlaceholder = "AUTO_GENERATED\n"_L1;
+constexpr auto autoTranslatedNote =
+R"(.. warning::
This section contains snippets that were automatically
translated from C++ to Python and may contain errors.
-)"_s;
+)"_L1;
void QtXmlToSphinx::setAutoTranslatedNote(QString *str) const
{
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 18632a13b..f2d9f0c9c 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -1397,7 +1397,7 @@ void ShibokenGenerator::writeCodeSnips(TextStream &s,
static void replacePyArg0(TypeSystem::Language language, QString *code)
{
- static const QString pyArg0 = u"%PYARG_0"_s;
+ static constexpr auto pyArg0 = "%PYARG_0"_L1;
if (!code->contains(pyArg0))
return;
diff --git a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp
index c877c3ba3..45cecd1a1 100644
--- a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp
+++ b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp
@@ -464,7 +464,7 @@ void QtXmlToSphinxTest::testTableFormattingIoDevice()
void QtXmlToSphinxTest::testSnippetExtraction_data()
{
QTest::addColumn<QByteArray>("file");
- QTest::addColumn<QString>("id");
+ QTest::addColumn<QLatin1StringView>("id");
QTest::addColumn<QString>("expected");
const char *fileCpp = R"(bla
@@ -476,7 +476,7 @@ snip2_line2
// ![snip2] // ![snip3]
)";
- const QString id = u"snip2"_s;
+ constexpr auto id = "snip2"_L1;
const QString expected = uR"(snip2_line1
snip2_line2
)"_s;
@@ -497,7 +497,7 @@ snip2_line2
void QtXmlToSphinxTest::testSnippetExtraction()
{
QFETCH(QByteArray, file);
- QFETCH(QString, id);
+ QFETCH(QLatin1StringView, id);
QFETCH(QString, expected);
QBuffer buffer(&file);