aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/codesniphelpers.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-04-22 08:52:16 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-04-25 12:13:40 +0200
commit42666b5bab09a80a65ae8f61961985f4923b7d65 (patch)
treef11276bd86f78455a3d8063f6111dbc0ca249098 /sources/shiboken6/ApiExtractor/codesniphelpers.cpp
parent20544c012c81dc05044291cacaeb4d71ced509c7 (diff)
Migrate from QLatin1Char to UTF-16 char literals
Preparing for the deprecation of QLatin1Char in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: I8bc92aa9f4e6dbfcb12d2025c5a1e760ab4f0d7f Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/codesniphelpers.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/codesniphelpers.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/sources/shiboken6/ApiExtractor/codesniphelpers.cpp b/sources/shiboken6/ApiExtractor/codesniphelpers.cpp
index f9bae0a65..4002729fc 100644
--- a/sources/shiboken6/ApiExtractor/codesniphelpers.cpp
+++ b/sources/shiboken6/ApiExtractor/codesniphelpers.cpp
@@ -51,9 +51,9 @@ QString CodeSnipHelpers::dedent(const QString &code)
if (code.isEmpty())
return code;
// Right trim if indent=0, or trim if single line
- if (!code.at(0).isSpace() || !code.contains(QLatin1Char('\n')))
+ if (!code.at(0).isSpace() || !code.contains(u'\n'))
return code.trimmed();
- const auto lines = QStringView{code}.split(QLatin1Char('\n'));
+ const auto lines = QStringView{code}.split(u'\n');
int spacesToRemove = std::numeric_limits<int>::max();
for (const auto &line : lines) {
if (!isEmpty(line)) {
@@ -68,35 +68,35 @@ QString CodeSnipHelpers::dedent(const QString &code)
for (const auto &line : lines) {
if (!isEmpty(line) && spacesToRemove < line.size())
result += line.mid(spacesToRemove).toString();
- result += QLatin1Char('\n');
+ result += u'\n';
}
return result;
}
QString CodeSnipHelpers::fixSpaces(QString code)
{
- code.remove(QLatin1Char('\r'));
+ code.remove(u'\r');
// Check for XML <tag>\n<space>bla...
if (code.startsWith(QLatin1String("\n ")))
code.remove(0, 1);
while (!code.isEmpty() && code.back().isSpace())
code.chop(1);
code = dedent(code);
- if (!code.isEmpty() && !code.endsWith(QLatin1Char('\n')))
- code.append(QLatin1Char('\n'));
+ if (!code.isEmpty() && !code.endsWith(u'\n'))
+ code.append(u'\n');
return code;
}
// Prepend a line to the code, observing indentation
void CodeSnipHelpers::prependCode(QString *code, QString firstLine)
{
- while (!code->isEmpty() && code->front() == QLatin1Char('\n'))
+ while (!code->isEmpty() && code->front() == u'\n')
code->remove(0, 1);
if (!code->isEmpty() && code->front().isSpace()) {
const int indent = firstNonBlank(*code);
- firstLine.prepend(QString(indent, QLatin1Char(' ')));
+ firstLine.prepend(QString(indent, u' '));
}
- if (!firstLine.endsWith(QLatin1Char('\n')))
- firstLine += QLatin1Char('\n');
+ if (!firstLine.endsWith(u'\n'))
+ firstLine += u'\n';
code->prepend(firstLine);
}