aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor
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
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')
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetaargument.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp22
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetaenum.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetafunction.cpp12
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetatype.cpp24
-rw-r--r--sources/shiboken6/ApiExtractor/apiextractor.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp26
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/codesniphelpers.cpp20
-rw-r--r--sources/shiboken6/ApiExtractor/docparser.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/doxygenparser.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/include.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/messages.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.cpp22
-rw-r--r--sources/shiboken6/ApiExtractor/parser/codemodel.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/parser/typeinfo.cpp23
-rw-r--r--sources/shiboken6/ApiExtractor/propertyspec.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/qtdocparser.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/reporthandler.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/textstream.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/typedatabase.cpp26
-rw-r--r--sources/shiboken6/ApiExtractor/typeparser.cpp34
-rw-r--r--sources/shiboken6/ApiExtractor/typesystem.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser.cpp37
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp2
28 files changed, 163 insertions, 167 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp b/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp
index 81c6a2273..366ef8bc0 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetaargument.cpp
@@ -168,7 +168,7 @@ bool AbstractMetaArgument::hasModifiedDefaultValueExpression() const
QString AbstractMetaArgumentData::toString() const
{
- QString result = m_type.name() + QLatin1Char(' ') + m_name;
+ QString result = m_type.name() + u' ' + m_name;
if (!m_expression.isEmpty())
result += QLatin1String(" = ") + m_expression;
return result;
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
index da0c46e28..15b71d0bc 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
@@ -63,7 +63,7 @@ static inline QString colonColon() { return QStringLiteral("::"); }
static QString stripTemplateArgs(const QString &name)
{
- int pos = name.indexOf(QLatin1Char('<'));
+ int pos = name.indexOf(u'<');
return pos < 0 ? name : name.left(pos);
}
@@ -150,7 +150,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
QString signature = modification.signature();
QString name = signature.trimmed();
- name.truncate(name.indexOf(QLatin1Char('(')));
+ name.truncate(name.indexOf(u'('));
AbstractMetaClass *clazz = AbstractMetaClass::findClass(m_metaClasses, centry);
if (!clazz)
@@ -1262,7 +1262,7 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
Q_ASSERT(operatorRegExp.isValid());
QString castTo = metaFunction->name().remove(operatorRegExp).trimmed();
- if (castTo.endsWith(QLatin1Char('&')))
+ if (castTo.endsWith(u'&'))
castTo.chop(1);
if (castTo.startsWith(QLatin1String("const ")))
castTo.remove(0, 6);
@@ -1478,7 +1478,7 @@ bool AbstractMetaBuilderPrivate::setupInheritance(AbstractMetaClass *metaClass)
QStringList baseClasses = metaClass->baseClassNames();
// we only support our own containers and ONLY if there is only one baseclass
- if (baseClasses.size() == 1 && baseClasses.constFirst().contains(QLatin1Char('<'))) {
+ if (baseClasses.size() == 1 && baseClasses.constFirst().contains(u'<')) {
TypeInfo info;
ComplexTypeEntry* baseContainerType;
AbstractMetaClass* templ = findTemplateClass(baseClasses.constFirst(), metaClass, &info, &baseContainerType);
@@ -1732,13 +1732,13 @@ static QString functionSignature(const FunctionModelItem &functionItem)
const ArgumentList &arguments = functionItem->arguments();
for (const ArgumentModelItem &arg : arguments)
args << arg->type().toString();
- return functionItem->name() + QLatin1Char('(') + args.join(QLatin1Char(',')) + QLatin1Char(')');
+ return functionItem->name() + u'(' + args.join(u',') + u')';
}
static inline QString qualifiedFunctionSignatureWithType(const FunctionModelItem &functionItem,
const QString &className = QString())
{
- QString result = functionItem->type().toString() + QLatin1Char(' ');
+ QString result = functionItem->type().toString() + u' ';
if (!className.isEmpty())
result += className + colonColon();
result += functionSignature(functionItem);
@@ -2765,7 +2765,7 @@ QString AbstractMetaBuilderPrivate::fixDefaultValue(QString expr, const Abstract
if (type.isFlags() || type.isEnum()) {
expr = fixEnumDefault(type, expr);
- } else if (type.isContainer() && expr.contains(QLatin1Char('<'))) {
+ } else if (type.isContainer() && expr.contains(u'<')) {
// Expand a container of a nested class, fex
// "QList<FormatRange>()" -> "QList<QTextLayout::FormatRange>()"
if (type.instantiations().size() != 1)
@@ -2906,7 +2906,7 @@ AbstractMetaClassCList
const QStringList &baseClassNames = metaClass->baseClassNames();
for (const QString& parent : baseClassNames) {
AbstractMetaClass *cls = nullptr;
- if (parent.contains(QLatin1Char('<')))
+ if (parent.contains(u'<'))
cls = findTemplateClass(parent, metaClass);
else
cls = AbstractMetaClass::findClass(m_metaClasses, parent);
@@ -3276,7 +3276,7 @@ static void writeRejectLogFile(const QString &name,
for (int reason = 0; reason < AbstractMetaBuilder::NoReason; ++reason) {
- s << QString(72, QLatin1Char('*')) << Qt::endl;
+ s << QByteArray(72, '*') << '\n';
switch (reason) {
case AbstractMetaBuilder::NotInTypeSystem:
s << "Not in type system";
@@ -3318,7 +3318,7 @@ static void writeRejectLogFile(const QString &name,
s << " - " << it.key() << Qt::endl;
}
- s << QString(72, QLatin1Char('*')) << Qt::endl << Qt::endl;
+ s << QByteArray(72, '*') << "\n\n";
}
}
@@ -3480,7 +3480,7 @@ void AbstractMetaBuilder::setSkipDeprecated(bool value)
static inline bool isFileSystemSlash(QChar c)
{
- return c == QLatin1Char('/') || c == QLatin1Char('\\');
+ return c == u'/' || c == u'\\';
}
static bool matchHeader(const QString &headerPath, const QString &fileName)
diff --git a/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp b/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp
index 336cd4f2a..4e030c392 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetaenum.cpp
@@ -208,7 +208,7 @@ QString AbstractMetaEnum::package() const
QString AbstractMetaEnum::fullName() const
{
- return package() + QLatin1Char('.') + qualifier() + QLatin1Char('.') + name();
+ return package() + u'.' + qualifier() + u'.' + name();
}
EnumKind AbstractMetaEnum::enumKind() const
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
index dfb7b6459..26d91f935 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
@@ -483,7 +483,7 @@ QString AbstractMetaFunctionPrivate::signature() const
if (m_cachedSignature.isEmpty()) {
m_cachedSignature = m_originalName;
- m_cachedSignature += QLatin1Char('(');
+ m_cachedSignature += u'(';
for (qsizetype i = 0; i < m_arguments.size(); ++i) {
const AbstractMetaArgument &a = m_arguments.at(i);
@@ -492,10 +492,10 @@ QString AbstractMetaFunctionPrivate::signature() const
m_cachedSignature += QLatin1String(", ");
m_cachedSignature += t.cppSignature();
// We need to have the argument names in the qdoc files
- m_cachedSignature += QLatin1Char(' ');
+ m_cachedSignature += u' ';
m_cachedSignature += a.name();
}
- m_cachedSignature += QLatin1Char(')');
+ m_cachedSignature += u')';
if (m_constant)
m_cachedSignature += QLatin1String(" const");
@@ -895,16 +895,16 @@ QString AbstractMetaFunction::pyiTypeReplaced(int argumentIndex) const
QString AbstractMetaFunctionPrivate::formatMinimalSignature(const AbstractMetaFunction *q,
bool comment) const
{
- QString result = m_originalName + QLatin1Char('(');
+ QString result = m_originalName + u'(';
for (qsizetype i = 0; i < m_arguments.size(); ++i) {
if (i > 0)
- result += QLatin1Char(',');
+ result += u',';
result += comment
? m_arguments.at(i).modifiedType().minimalSignature()
: m_arguments.at(i).type().minimalSignature();
}
- result += QLatin1Char(')');
+ result += u')';
if (m_constant)
result += QLatin1String("const");
result = TypeDatabase::normalizedSignature(result);
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
index 9ef92ed11..92fcc230a 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
@@ -380,7 +380,7 @@ void AbstractMetaClass::addPropertySpec(const QPropertySpec &spec)
void AbstractMetaClassPrivate::addFunction(const AbstractMetaFunctionCPtr &function)
{
- Q_ASSERT(!function->signature().startsWith(QLatin1Char('(')));
+ Q_ASSERT(!function->signature().startsWith(u'('));
if (!function->isDestructor())
m_functions << function;
@@ -1292,7 +1292,7 @@ void AbstractMetaClass::getFunctionsFromInvisibleNamespacesToBeGenerated(Abstrac
QString AbstractMetaClass::fullName() const
{
- return package() + QLatin1Char('.') + d->m_typeEntry->targetLangName();
+ return package() + u'.' + d->m_typeEntry->targetLangName();
}
static void addExtraIncludeForType(AbstractMetaClass *metaClass, const AbstractMetaType &type)
diff --git a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
index f2b512bf0..3d1f5d210 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
@@ -555,10 +555,10 @@ bool AbstractMetaType::hasTemplateChildren() const
static inline QString formatArraySize(int e)
{
QString result;
- result += QLatin1Char('[');
+ result += u'[';
if (e >= 0)
result += QString::number(e);
- result += QLatin1Char(']');
+ result += u']';
return result;
}
@@ -572,7 +572,7 @@ QString AbstractMetaTypeData::formatSignature(bool minimal) const
if (m_pattern == AbstractMetaType::ArrayPattern) {
// Build nested array dimensions a[2][3] in correct order
result += m_arrayElementType->minimalSignature();
- const int arrayPos = result.indexOf(QLatin1Char('['));
+ const int arrayPos = result.indexOf(u'[');
if (arrayPos != -1)
result.insert(arrayPos, formatArraySize(m_arrayElementCount));
else
@@ -581,26 +581,26 @@ QString AbstractMetaTypeData::formatSignature(bool minimal) const
result += m_typeEntry->qualifiedCppName();
}
if (!m_instantiations.isEmpty()) {
- result += QLatin1Char('<');
+ result += u'<';
if (minimal)
- result += QLatin1Char(' ');
+ result += u' ';
for (int i = 0, size = m_instantiations.size(); i < size; ++i) {
if (i > 0)
- result += QLatin1Char(',');
+ result += u',';
result += m_instantiations.at(i).minimalSignature();
}
result += QLatin1String(" >");
}
if (!minimal && (!m_indirections.isEmpty() || m_referenceType != NoReference))
- result += QLatin1Char(' ');
+ result += u' ';
for (Indirection i : m_indirections)
result += TypeInfo::indirectionKeyword(i);
switch (m_referenceType) {
case NoReference:
break;
case LValueReference:
- result += QLatin1Char('&');
+ result += u'&';
break;
case RValueReference:
result += QLatin1String("&&");
@@ -637,12 +637,12 @@ QString AbstractMetaTypeData::formatPythonSignature() const
if (!m_typeEntry->isPrimitive() && !m_typeEntry->isSmartPointer()) {
const QString package = m_typeEntry->targetLangPackage();
if (!package.isEmpty())
- result += package + QLatin1Char('.');
+ result += package + u'.';
}
if (m_pattern == AbstractMetaType::ArrayPattern) {
// Build nested array dimensions a[2][3] in correct order
result += m_arrayElementType->formatPythonSignature();
- const int arrayPos = result.indexOf(QLatin1Char('['));
+ const int arrayPos = result.indexOf(u'[');
if (arrayPos != -1)
result.insert(arrayPos, formatArraySize(m_arrayElementCount));
else
@@ -651,13 +651,13 @@ QString AbstractMetaTypeData::formatPythonSignature() const
result += m_typeEntry->targetLangName();
}
if (!m_instantiations.isEmpty()) {
- result += QLatin1Char('[');
+ result += u'[';
for (int i = 0, size = m_instantiations.size(); i < size; ++i) {
if (i > 0)
result += QLatin1String(", ");
result += m_instantiations.at(i).formatPythonSignature();
}
- result += QLatin1Char(']');
+ result += u']';
}
if (m_typeEntry->isPrimitive())
for (Indirection i : m_indirections)
diff --git a/sources/shiboken6/ApiExtractor/apiextractor.cpp b/sources/shiboken6/ApiExtractor/apiextractor.cpp
index 212e35722..1b8af285f 100644
--- a/sources/shiboken6/ApiExtractor/apiextractor.cpp
+++ b/sources/shiboken6/ApiExtractor/apiextractor.cpp
@@ -241,7 +241,7 @@ bool ApiExtractorPrivate::runHelper(ApiExtractorFlags flags)
return false;
}
- const QString pattern = QDir::tempPath() + QLatin1Char('/')
+ const QString pattern = QDir::tempPath() + u'/'
+ m_cppFileNames.constFirst().baseName()
+ QStringLiteral("_XXXXXX.hpp");
QTemporaryFile ppFile(pattern);
@@ -397,7 +397,7 @@ QString ApiExtractorPrivate::getSimplifiedContainerTypeName(const AbstractMetaTy
typeName.chop(2);
break;
}
- while (typeName.endsWith(QLatin1Char('*')) || typeName.endsWith(QLatin1Char(' ')))
+ while (typeName.endsWith(u'*') || typeName.endsWith(u' '))
typeName.chop(1);
return typeName;
}
@@ -670,9 +670,9 @@ ApiExtractorPrivate::collectContainerTypesFromConverterMacros(InstantiationColle
int start = 0;
QString errorMessage;
while ((start = code.indexOf(convMacro, start)) != -1) {
- int end = code.indexOf(QLatin1Char(']'), start);
+ int end = code.indexOf(u']', start);
start += offset;
- if (code.at(start) != QLatin1Char('%')) {
+ if (code.at(start) != u'%') {
QString typeString = code.mid(start, end - start);
auto type = AbstractMetaType::fromString(typeString, &errorMessage);
if (type.has_value()) {
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
index b29fee34d..ac5843cac 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
@@ -70,8 +70,8 @@ static QString fixTypeName(QString t)
{
// Fix "Foo &" -> "Foo&", similarly "Bar **" -> "Bar**"
int pos = t.size() - 1;
- for (; pos >= 0 && (t.at(pos) == QLatin1Char('&') || t.at(pos) == QLatin1Char('*')); --pos) {}
- if (pos > 0 && t.at(pos) == QLatin1Char(' '))
+ for (; pos >= 0 && (t.at(pos) == u'&' || t.at(pos) == u'*'); --pos) {}
+ if (pos > 0 && t.at(pos) == u' ')
t.remove(pos, 1);
return t;
}
@@ -81,13 +81,13 @@ static QString fixTypeName(QString t)
// the class name "Foo<T1,T2>" is the scope for nested items.
static bool insertTemplateParameterIntoClassName(const QString &parmName, QString *name)
{
- if (Q_UNLIKELY(!name->endsWith(QLatin1Char('>'))))
+ if (Q_UNLIKELY(!name->endsWith(u'>')))
return false;
- const bool needsComma = name->at(name->size() - 2) != QLatin1Char('<');
+ const bool needsComma = name->at(name->size() - 2) != u'<';
const int insertionPos = name->size() - 1;
name->insert(insertionPos, parmName);
if (needsComma)
- name->insert(insertionPos, QLatin1Char(','));
+ name->insert(insertionPos, u',');
return true;
}
@@ -290,7 +290,7 @@ static QString msgCannotDetermineException(const std::string_view &snippetV)
snippet += QStringLiteral("...");
return QLatin1String("Cannot determine exception specification: \"")
- + snippet + QLatin1Char('"');
+ + snippet + u'"';
}
// Return whether noexcept(<value>) throws. noexcept() takes a constexpr value.
@@ -399,7 +399,7 @@ FunctionModelItem BuilderPrivate::createMemberFunction(const CXCursor &cursor,
m_currentFunctionType == CodeModel::Signal || m_currentFunctionType == CodeModel::Slot
? m_currentFunctionType // by annotation
: functionTypeFromCursor(cursor);
- isTemplateCode |= m_currentClass->name().endsWith(QLatin1Char('>'));
+ isTemplateCode |= m_currentClass->name().endsWith(u'>');
auto result = createFunction(cursor, functionType, isTemplateCode);
result->setAccessPolicy(accessPolicy(clang_getCXXAccessSpecifier(cursor)));
result->setConstant(clang_CXXMethod_isConst(cursor) != 0);
@@ -453,9 +453,9 @@ void BuilderPrivate::addField(const CXCursor &cursor)
static QStringList qualifiedName(const QString &t)
{
QStringList result;
- int end = t.indexOf(QLatin1Char('<'));
+ int end = t.indexOf(u'<');
if (end == -1)
- end = t.indexOf(QLatin1Char('('));
+ end = t.indexOf(u'(');
if (end == -1)
end = t.size();
int lastPos = 0;
@@ -602,7 +602,7 @@ TypeInfo BuilderPrivate::createTypeInfoUncached(const CXType &type,
// Obtain template instantiations if the name has '<' (thus excluding
// typedefs like "std::string".
- if (typeName.contains(QLatin1Char('<')))
+ if (typeName.contains(u'<'))
addTemplateInstantiations(nestedType, &typeName, &typeInfo);
typeInfo.setQualifiedName(qualifiedName(typeName));
@@ -890,9 +890,9 @@ FileModelItem Builder::dom() const
static QString msgOutOfOrder(const CXCursor &cursor, const char *expectedScope)
{
- return getCursorKindName(cursor.kind) + QLatin1Char(' ')
+ return getCursorKindName(cursor.kind) + u' '
+ getCursorSpelling(cursor) + QLatin1String(" encountered outside ")
- + QLatin1String(expectedScope) + QLatin1Char('.');
+ + QLatin1String(expectedScope) + u'.';
}
static CodeModel::ClassType codeModelClassTypeFromCursor(CXCursorKind kind)
@@ -1080,7 +1080,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
const NamespaceModelItem parentNamespaceItem = qSharedPointerDynamicCast<_NamespaceModelItem>(d->m_scopeStack.back());
if (parentNamespaceItem.isNull()) {
const QString message = msgOutOfOrder(cursor, "namespace")
- + QLatin1String(" (current scope: ") + d->m_scopeStack.back()->name() + QLatin1Char(')');
+ + QLatin1String(" (current scope: ") + d->m_scopeStack.back()->name() + u')';
const Diagnostic d(message, cursor, CXDiagnostic_Error);
qWarning() << d;
appendDiagnostic(d);
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
index c7d471547..973bdfa2b 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangutils.cpp
@@ -195,7 +195,7 @@ QPair<int, int> parseTemplateArgumentList(const QString &l,
const TemplateArgumentHandler &handler,
int from)
{
- const int ltPos = l.indexOf(QLatin1Char('<'), from);
+ const int ltPos = l.indexOf(u'<', from);
if (ltPos == - 1)
return qMakePair(-1, -1);
int startPos = ltPos + 1;
@@ -211,7 +211,7 @@ QPair<int, int> parseTemplateArgumentList(const QString &l,
if (--level == 0)
return qMakePair(ltPos, p);
// Skip over next ',': "a<b<c,d>,e>"
- for (; p < end && (l.at(p).isSpace() || l.at(p) == QLatin1Char(',')); ++p) {}
+ for (; p < end && (l.at(p).isSpace() || l.at(p) == u','); ++p) {}
}
startPos = p;
break;
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);
}
diff --git a/sources/shiboken6/ApiExtractor/docparser.cpp b/sources/shiboken6/ApiExtractor/docparser.cpp
index debb521e3..f543e2eda 100644
--- a/sources/shiboken6/ApiExtractor/docparser.cpp
+++ b/sources/shiboken6/ApiExtractor/docparser.cpp
@@ -143,7 +143,7 @@ R"(<xsl:template match="/">
for (const DocModification &mod : mods) {
if (isXpathDocModification(mod)) {
QString xpath = mod.xpath();
- xpath.replace(QLatin1Char('"'), QLatin1String("&quot;"));
+ xpath.replace(u'"', QLatin1String("&quot;"));
xsl += QLatin1String("<xsl:template match=\"")
+ xpath + QLatin1String("\">")
+ mod.code() + QLatin1String("</xsl:template>\n");
@@ -157,7 +157,7 @@ R"(<xsl:template match="/">
qPrintable(msgXpathDocModificationError(mods, errorMessage)));
if (result == xml) {
const QString message = QLatin1String("Query did not result in any modifications to \"")
- + xml + QLatin1Char('"');
+ + xml + u'"';
qCWarning(lcShibokenDoc, "%s",
qPrintable(msgXpathDocModificationError(mods, message)));
}
diff --git a/sources/shiboken6/ApiExtractor/doxygenparser.cpp b/sources/shiboken6/ApiExtractor/doxygenparser.cpp
index 0a1703d31..8a1787f5a 100644
--- a/sources/shiboken6/ApiExtractor/doxygenparser.cpp
+++ b/sources/shiboken6/ApiExtractor/doxygenparser.cpp
@@ -78,7 +78,7 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
QString doxyFilePath;
for (const char *prefix : prefixes) {
- doxyFilePath = documentationDataDirectory() + QLatin1Char('/')
+ doxyFilePath = documentationDataDirectory() + u'/'
+ QLatin1String(prefix) + doxyFileSuffix;
if (QFile::exists(doxyFilePath))
break;
@@ -165,7 +165,7 @@ void DoxygenParser::fillDocumentation(AbstractMetaClass* metaClass)
if (!isProperty) {
funcQuery += QLatin1String("/../") + tag.second;
} else {
- funcQuery = QLatin1Char('(') + funcQuery;
+ funcQuery = u'(' + funcQuery;
funcQuery += u"/../"_qs + tag.second + u")[1]"_qs;
}
diff --git a/sources/shiboken6/ApiExtractor/include.cpp b/sources/shiboken6/ApiExtractor/include.cpp
index 6273d0e58..c902d601c 100644
--- a/sources/shiboken6/ApiExtractor/include.cpp
+++ b/sources/shiboken6/ApiExtractor/include.cpp
@@ -37,10 +37,10 @@
QString Include::toString() const
{
if (m_type == IncludePath)
- return QLatin1String("#include <") + m_name + QLatin1Char('>');
+ return QLatin1String("#include <") + m_name + u'>';
if (m_type == LocalPath)
- return QLatin1String("#include \"") + m_name + QLatin1Char('"');
- return QLatin1String("import ") + m_name + QLatin1Char(';');
+ return QLatin1String("#include \"") + m_name + u'"';
+ return QLatin1String("import ") + m_name + u';';
}
size_t qHash(const Include& inc)
diff --git a/sources/shiboken6/ApiExtractor/messages.cpp b/sources/shiboken6/ApiExtractor/messages.cpp
index 5e1145ab4..fb992a230 100644
--- a/sources/shiboken6/ApiExtractor/messages.cpp
+++ b/sources/shiboken6/ApiExtractor/messages.cpp
@@ -500,7 +500,7 @@ QString msgNamespaceToBeExtendedNotFound(const QString &namespaceName, const QSt
{
return QLatin1String("The namespace '") + namespaceName
+ QLatin1String("' to be extended cannot be found in package ")
- + packageName + QLatin1Char('.');
+ + packageName + u'.';
}
QString msgPropertyTypeParsingFailed(const QString &name, const QString &typeName,
@@ -716,14 +716,14 @@ QString msgLeftOverArguments(const QVariantMap &remainingArgs)
if (!value.isEmpty())
str << ' ' << value;
}
- str << "\nCommand line: " << QCoreApplication::arguments().join(QLatin1Char(' '));
+ str << "\nCommand line: " << QCoreApplication::arguments().join(u' ');
return message;
}
QString msgInvalidVersion(const QString &package, const QString &version)
{
return QLatin1String("Invalid version \"") + version
- + QLatin1String("\" specified for package ") + package + QLatin1Char('.');
+ + QLatin1String("\" specified for package ") + package + u'.';
}
QString msgCyclicDependency(const QString &funcName, const QString &graphName,
@@ -771,7 +771,7 @@ QString msgEnclosingClassNotFound(const TypeEntry *t)
QString msgUnknownOperator(const AbstractMetaFunction* func)
{
QString result = QLatin1String("Unknown operator: \"") + func->originalName()
- + QLatin1Char('"');
+ + u'"';
if (const AbstractMetaClass *c = func->implementingClass())
result += QLatin1String(" in class: ") + c->name();
return result;
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp
index d09a3d327..ad1dac6cd 100644
--- a/sources/shiboken6/ApiExtractor/modifications.cpp
+++ b/sources/shiboken6/ApiExtractor/modifications.cpp
@@ -55,8 +55,8 @@ QString TemplateInstance::expandCode() const
while (!code.isEmpty() && code.at(code.size() - 1).isSpace())
code.chop(1);
QString result = QLatin1String("// TEMPLATE - ") + m_name + QLatin1String(" - START");
- if (!code.startsWith(QLatin1Char('\n')))
- result += QLatin1Char('\n');
+ if (!code.startsWith(u'\n'))
+ result += u'\n';
result += code;
result += QLatin1String("\n// TEMPLATE - ") + m_name + QLatin1String(" - END\n");
return result;
@@ -92,7 +92,7 @@ void CodeSnipAbstract::purgeEmptyFragments()
QRegularExpression CodeSnipAbstract::placeHolderRegex(int index)
{
- return QRegularExpression(QLatin1Char('%') + QString::number(index) + QStringLiteral("\\b"));
+ return QRegularExpression(u'%' + QString::number(index) + QStringLiteral("\\b"));
}
void purgeEmptyCodeSnips(QList<CodeSnip> *list)
@@ -300,7 +300,7 @@ Arguments splitParameters(QStringView paramString, QString *errorMessage)
for (const auto &t : tokens) {
Argument argument;
// Check defaultValue, "int @b@=5"
- const int equalPos = t.lastIndexOf(QLatin1Char('='));
+ const int equalPos = t.lastIndexOf(u'=');
if (equalPos != -1) {
const int defaultValuePos = equalPos + 1;
argument.defaultValue =
@@ -308,14 +308,14 @@ Arguments splitParameters(QStringView paramString, QString *errorMessage)
}
QString typeString = (equalPos != -1 ? t.left(equalPos) : t).trimmed().toString();
// Check @name@
- const int atPos = typeString.indexOf(QLatin1Char('@'));
+ const int atPos = typeString.indexOf(u'@');
if (atPos != -1) {
const int namePos = atPos + 1;
- const int nameEndPos = typeString.indexOf(QLatin1Char('@'), namePos);
+ const int nameEndPos = typeString.indexOf(u'@', namePos);
if (nameEndPos == -1) {
if (errorMessage != nullptr) {
*errorMessage = QLatin1String("Mismatched @ in \"")
- + paramString.toString() + QLatin1Char('"');
+ + paramString.toString() + u'"';
}
return {};
}
@@ -358,14 +358,14 @@ AddedFunction::AddedFunctionPtr
// Skip past "operator()(...)"
const int parenSearchStartPos = signature.startsWith(callOperator())
? callOperator().size() : 0;
- const int openParenPos = signature.indexOf(QLatin1Char('('), parenSearchStartPos);
+ const int openParenPos = signature.indexOf(u'(', parenSearchStartPos);
if (openParenPos < 0) {
return AddedFunctionPtr(new AddedFunction(signature.toString(),
arguments, returnType));
}
const QString name = signature.left(openParenPos).trimmed().toString();
- const int closingParenPos = signature.lastIndexOf(QLatin1Char(')'));
+ const int closingParenPos = signature.lastIndexOf(u')');
if (closingParenPos < 0) {
*errorMessage = QLatin1String("Missing closing parenthesis");
return {};
@@ -457,7 +457,7 @@ QDebug operator<<(QDebug d, const CodeSnip &s)
if (f.instance().isNull()) {
d << '"';
const QString &code = f.code();
- const auto lines = QStringView{code}.split(QLatin1Char('\n'));
+ const auto lines = QStringView{code}.split(u'\n');
for (int i = 0, size = lines.size(); i < size; ++i) {
if (i)
d << "\\n";
@@ -854,7 +854,7 @@ bool FunctionModification::matches(const QString &functionSignature) const
bool FunctionModification::setSignature(const QString &s, QString *errorMessage)
{
- if (s.startsWith(QLatin1Char('^'))) {
+ if (s.startsWith(u'^')) {
d->m_signaturePattern.setPattern(s);
if (!d->m_signaturePattern.isValid()) {
if (errorMessage) {
diff --git a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
index c275db2b6..b3128afd9 100644
--- a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
@@ -586,7 +586,7 @@ void _ScopeModelItem::purgeClassDeclarations()
// For an empty class, check if there is a matching template
// definition, and remove it if this is the case.
if (!klass->isTemplate() && klass->isEmpty()) {
- const QString definitionPrefix = klass->name() + QLatin1Char('<');
+ const QString definitionPrefix = klass->name() + u'<';
const bool definitionFound =
std::any_of(m_classes.cbegin(), m_classes.cend(),
[definitionPrefix] (const ClassModelItem &c) {
@@ -663,7 +663,7 @@ public:
const QString &itemName = item->name();
if (!itemName.startsWith(m_name))
return false;
- return itemName.size() == m_name.size() || itemName.at(m_name.size()) == QLatin1Char('<');
+ return itemName.size() == m_name.size() || itemName.at(m_name.size()) == u'<';
}
private:
@@ -674,7 +674,7 @@ private:
ClassModelItem _ScopeModelItem::findClass(const QString &name) const
{
// A fully qualified template is matched by name only
- const ClassList::const_iterator it = name.contains(QLatin1Char('<'))
+ const ClassList::const_iterator it = name.contains(u'<')
? std::find_if(m_classes.begin(), m_classes.end(), ModelItemNamePredicate<_ClassModelItem>(name))
: std::find_if(m_classes.begin(), m_classes.end(), ClassNamePredicate(name));
return it != m_classes.end() ? *it : ClassModelItem();
diff --git a/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp b/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp
index a6db82b35..2ca48ec30 100644
--- a/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp
+++ b/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp
@@ -399,15 +399,15 @@ QString TypeInfo::toString() const
tmp += d->m_qualifiedName.join(QLatin1String("::"));
if (const int instantiationCount = d->m_instantiations.size()) {
- tmp += QLatin1Char('<');
+ tmp += u'<';
for (int i = 0; i < instantiationCount; ++i) {
if (i)
tmp += QLatin1String(", ");
tmp += d->m_instantiations.at(i).toString();
}
- if (tmp.endsWith(QLatin1Char('>')))
- tmp += QLatin1Char(' ');
- tmp += QLatin1Char('>');
+ if (tmp.endsWith(u'>'))
+ tmp += u' ';
+ tmp += u'>';
}
for (Indirection i : d->m_indirections)
@@ -417,7 +417,7 @@ QString TypeInfo::toString() const
case NoReference:
break;
case LValueReference:
- tmp += QLatin1Char('&');
+ tmp += u'&';
break;
case RValueReference:
tmp += QLatin1String("&&");
@@ -432,14 +432,11 @@ QString TypeInfo::toString() const
tmp += d->m_arguments.at(i).toString();
}
- tmp += QLatin1Char(')');
+ tmp += u')';
}
- for (const QString &elt : d->m_arrayElements) {
- tmp += QLatin1Char('[');
- tmp += elt;
- tmp += QLatin1Char(']');
- }
+ for (const QString &elt : d->m_arrayElements)
+ tmp += u'[' + elt + u']';
return tmp;
}
@@ -508,10 +505,8 @@ void TypeInfo::stripQualifiers(QString *s)
{
stripLeadingConst(s);
stripLeadingVolatile(s);
- while (s->endsWith(QLatin1Char('&')) || s->endsWith(QLatin1Char('*'))
- || s->endsWith(QLatin1Char(' '))) {
+ while (s->endsWith(u'&') || s->endsWith(u'*') || s->endsWith(u' '))
s->chop(1);
- }
}
// Helper functionality to simplify a raw standard type as returned by
diff --git a/sources/shiboken6/ApiExtractor/propertyspec.cpp b/sources/shiboken6/ApiExtractor/propertyspec.cpp
index f66eeeaf6..cd0118e13 100644
--- a/sources/shiboken6/ApiExtractor/propertyspec.cpp
+++ b/sources/shiboken6/ApiExtractor/propertyspec.cpp
@@ -200,7 +200,7 @@ TypeSystemProperty QPropertySpec::typeSystemPropertyFromQ_Property(const QString
// Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged)
const QString declaration = declarationIn.simplified();
- auto propertyTokens = declaration.split(QLatin1Char(' '), Qt::SkipEmptyParts);
+ auto propertyTokens = declaration.split(u' ', Qt::SkipEmptyParts);
// To properly parse complicated type declarations like
// "Q_PROPERTY(const QList<QString > *objectName READ objectName ..."
@@ -243,7 +243,7 @@ TypeSystemProperty QPropertySpec::typeSystemPropertyFromQ_Property(const QString
result.type = propertyTokens.constFirst();
for (int pos = 1; pos < namePos; ++pos)
- result.type += QLatin1Char(' ') + propertyTokens.at(pos);
+ result.type += u' ' + propertyTokens.at(pos);
// Fix errors like "Q_PROPERTY(QXYSeries *series .." to be of type "QXYSeries*"
while (!result.name.isEmpty() && !result.name.at(0).isLetter()) {
diff --git a/sources/shiboken6/ApiExtractor/qtdocparser.cpp b/sources/shiboken6/ApiExtractor/qtdocparser.cpp
index bd4e96e6f..c2ae5fb0b 100644
--- a/sources/shiboken6/ApiExtractor/qtdocparser.cpp
+++ b/sources/shiboken6/ApiExtractor/qtdocparser.cpp
@@ -78,8 +78,8 @@ static void formatFunctionUnqualifiedArgTypeQuery(QTextStream &str,
// to "Qt::Alignment" as seen by qdoc.
const auto *flagsEntry = static_cast<const FlagsTypeEntry *>(metaType.typeEntry());
QString name = flagsEntry->qualifiedCppName();
- if (name.endsWith(QLatin1Char('>')) && name.startsWith(QLatin1String("QFlags<"))) {
- const int lastColon = name.lastIndexOf(QLatin1Char(':'));
+ if (name.endsWith(u'>') && name.startsWith(QLatin1String("QFlags<"))) {
+ const int lastColon = name.lastIndexOf(u':');
if (lastColon != -1) {
name.replace(lastColon + 1, name.size() - lastColon - 1, metaType.name());
name.remove(0, 7);
@@ -250,7 +250,7 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass)
context = context->enclosingClass();
}
- QString sourceFileRoot = documentationDataDirectory() + QLatin1Char('/')
+ QString sourceFileRoot = documentationDataDirectory() + u'/'
+ metaClass->qualifiedCppName().toLower();
sourceFileRoot.replace(QLatin1String("::"), QLatin1String("-"));
@@ -349,10 +349,10 @@ Documentation QtDocParser::retrieveModuleDocumentation(const QString& name)
// TODO: This method of acquiring the module name supposes that the target language uses
// dots as module separators in package names. Improve this.
QString moduleName = name;
- moduleName.remove(0, name.lastIndexOf(QLatin1Char('.')) + 1);
+ moduleName.remove(0, name.lastIndexOf(u'.') + 1);
if (moduleName == u"QtQuickControls2")
moduleName.chop(1);
- const QString prefix = documentationDataDirectory() + QLatin1Char('/')
+ const QString prefix = documentationDataDirectory() + u'/'
+ moduleName.toLower();
const QString sourceFile = prefix + u"-index.webxml"_qs;
diff --git a/sources/shiboken6/ApiExtractor/reporthandler.cpp b/sources/shiboken6/ApiExtractor/reporthandler.cpp
index f0c5bf31e..4b9d8187b 100644
--- a/sources/shiboken6/ApiExtractor/reporthandler.cpp
+++ b/sources/shiboken6/ApiExtractor/reporthandler.cpp
@@ -142,12 +142,12 @@ void ReportHandler::messageOutput(QtMsgType type, const QMessageLogContext &cont
}
QString message = m_prefix;
if (!message.isEmpty())
- message.append(QLatin1Char(' '));
+ message.append(u' ');
const int prefixLength = message.size();
message.append(text);
// Replace file location tab by space
if (fileLocationPos >= 0)
- message[prefixLength + fileLocationPos + 1] = QLatin1Char(' ');
+ message[prefixLength + fileLocationPos + 1] = u' ';
fprintf(stderr, "%s\n", qPrintable(qFormatLogMessage(type, context, message)));
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp b/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
index bd0835426..070a21f12 100644
--- a/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
@@ -65,9 +65,9 @@ void TestCodeInjections::testReadFile()
char *argv[] = {nullptr};
QCoreApplication app(argc, argv);
- QString attribute = QLatin1String("file='") + filePath + QLatin1Char('\'');
+ QString attribute = QLatin1String("file='") + filePath + u'\'';
if (!snippet.isEmpty())
- attribute += QLatin1String(" snippet='") + snippet + QLatin1Char('\'');
+ attribute += QLatin1String(" snippet='") + snippet + u'\'';
QString xmlCode = QLatin1String("\
<typesystem package=\"Foo\">\n\
diff --git a/sources/shiboken6/ApiExtractor/textstream.cpp b/sources/shiboken6/ApiExtractor/textstream.cpp
index 2b8e9f29b..fb9d78876 100644
--- a/sources/shiboken6/ApiExtractor/textstream.cpp
+++ b/sources/shiboken6/ApiExtractor/textstream.cpp
@@ -250,7 +250,7 @@ void disableIndent(TextStream &s)
void ensureEndl(TextStream &s)
{
- if (s.lastChar() != QLatin1Char('\n'))
+ if (s.lastChar() != u'\n')
s << '\n';
}
diff --git a/sources/shiboken6/ApiExtractor/typedatabase.cpp b/sources/shiboken6/ApiExtractor/typedatabase.cpp
index 724435cbd..434b8ba02 100644
--- a/sources/shiboken6/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken6/ApiExtractor/typedatabase.cpp
@@ -56,8 +56,8 @@ using TypeDatabaseParserContextPtr = QSharedPointer<TypeDatabaseParserContext>;
static QString wildcardToRegExp(QString w)
{
- w.replace(QLatin1Char('?'), QLatin1Char('.'));
- w.replace(QLatin1Char('*'), QStringLiteral(".*"));
+ w.replace(u'?', u'.');
+ w.replace(u'*', QStringLiteral(".*"));
return w;
}
@@ -213,7 +213,7 @@ static const IntTypeNormalizationEntries &intTypeNormalizationEntries()
firstTime = false;
for (auto t : {"char", "short", "int", "long"}) {
const QString intType = QLatin1String(t);
- if (!TypeDatabase::instance()->findType(QLatin1Char('u') + intType)) {
+ if (!TypeDatabase::instance()->findType(u'u' + intType)) {
IntTypeNormalizationEntry entry;
entry.replacement = QStringLiteral("unsigned ") + intType;
entry.regex.setPattern(QStringLiteral("\\bu") + intType + QStringLiteral("\\b"));
@@ -375,7 +375,7 @@ ContainerTypeEntry* TypeDatabase::findContainerType(const QString &name) const
{
QString template_name = name;
- int pos = name.indexOf(QLatin1Char('<'));
+ int pos = name.indexOf(u'<');
if (pos > 0)
template_name = name.left(pos);
@@ -599,7 +599,7 @@ TypeEntry *TypeDatabasePrivate::resolveTypeDefEntry(TypedefEntry *typedefEntry,
QString *errorMessage)
{
QString sourceName = typedefEntry->sourceType();
- const int lessThanPos = sourceName.indexOf(QLatin1Char('<'));
+ const int lessThanPos = sourceName.indexOf(u'<');
if (lessThanPos != -1)
sourceName.truncate(lessThanPos);
ComplexTypeEntry *source = nullptr;
@@ -619,7 +619,7 @@ TypeEntry *TypeDatabasePrivate::resolveTypeDefEntry(TypedefEntry *typedefEntry,
if (!source) {
if (errorMessage)
*errorMessage = QLatin1String("Unable to resolve typedef \"")
- + typedefEntry->sourceType() + QLatin1Char('"');
+ + typedefEntry->sourceType() + u'"';
return nullptr;
}
@@ -779,21 +779,21 @@ void TypeDatabase::setSuppressWarnings(bool on)
bool TypeDatabase::addSuppressedWarning(const QString &warning, QString *errorMessage)
{
QString pattern;
- if (warning.startsWith(QLatin1Char('^')) && warning.endsWith(QLatin1Char('$'))) {
+ if (warning.startsWith(u'^') && warning.endsWith(u'$')) {
pattern = warning;
} else {
// Legacy syntax: Use wildcards '*' (unless escaped by '\')
QList<int> asteriskPositions;
const int warningSize = warning.size();
for (int i = 0; i < warningSize; ++i) {
- if (warning.at(i) == QLatin1Char('\\'))
+ if (warning.at(i) == u'\\')
++i;
- else if (warning.at(i) == QLatin1Char('*'))
+ else if (warning.at(i) == u'*')
asteriskPositions.append(i);
}
asteriskPositions.append(warningSize);
- pattern.append(QLatin1Char('^'));
+ pattern.append(u'^');
int lastPos = 0;
for (int a = 0, aSize = asteriskPositions.size(); a < aSize; ++a) {
if (a)
@@ -803,7 +803,7 @@ bool TypeDatabase::addSuppressedWarning(const QString &warning, QString *errorMe
pattern.append(QRegularExpression::escape(warning.mid(lastPos, nextPos - lastPos)));
lastPos = nextPos + 1;
}
- pattern.append(QLatin1Char('$'));
+ pattern.append(u'$');
}
QRegularExpression expression(pattern);
@@ -842,12 +842,12 @@ QString TypeDatabasePrivate::modifiedTypesystemFilepath(const QString& tsFile,
if (tsFi.isFile()) // Make path absolute
return tsFi.absoluteFilePath();
if (!currentPath.isEmpty()) {
- const QFileInfo fi(currentPath + QLatin1Char('/') + tsFile);
+ const QFileInfo fi(currentPath + u'/' + tsFile);
if (fi.isFile())
return fi.absoluteFilePath();
}
for (const QString &path : m_typesystemPaths) {
- const QFileInfo fi(path + QLatin1Char('/') + tsFile);
+ const QFileInfo fi(path + u'/' + tsFile);
if (fi.isFile())
return fi.absoluteFilePath();
}
diff --git a/sources/shiboken6/ApiExtractor/typeparser.cpp b/sources/shiboken6/ApiExtractor/typeparser.cpp
index fba3a8801..1b2e770c8 100644
--- a/sources/shiboken6/ApiExtractor/typeparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typeparser.cpp
@@ -82,7 +82,7 @@ Scanner::Token Scanner::nextToken(QString *errorMessage)
Token tok = NoToken;
// remove whitespace
- while (m_pos < m_length && m_chars[m_pos] == QLatin1Char(' '))
+ while (m_pos < m_length && m_chars[m_pos] == u' ')
++m_pos;
m_tokenStart = m_pos;
@@ -108,7 +108,7 @@ Scanner::Token Scanner::nextToken(QString *errorMessage)
++m_pos;
break;
default:
- if (c.isLetterOrNumber() || c == QLatin1Char('_')) {
+ if (c.isLetterOrNumber() || c == u'_') {
tok = Identifier;
} else {
QString message;
@@ -131,7 +131,7 @@ Scanner::Token Scanner::nextToken(QString *errorMessage)
}
if (tok == Identifier) {
- if (c.isLetterOrNumber() || c == QLatin1Char('_'))
+ if (c.isLetterOrNumber() || c == u'_')
++m_pos;
else
break;
@@ -141,23 +141,23 @@ Scanner::Token Scanner::nextToken(QString *errorMessage)
if (tok == Identifier) {
switch (m_pos - m_tokenStart) {
case 5:
- if (m_chars[m_tokenStart] == QLatin1Char('c')
- && m_chars[m_tokenStart + 1] == QLatin1Char('o')
- && m_chars[m_tokenStart + 2] == QLatin1Char('n')
- && m_chars[m_tokenStart + 3] == QLatin1Char('s')
- && m_chars[m_tokenStart + 4] == QLatin1Char('t')) {
+ if (m_chars[m_tokenStart] == u'c'
+ && m_chars[m_tokenStart + 1] == u'o'
+ && m_chars[m_tokenStart + 2] == u'n'
+ && m_chars[m_tokenStart + 3] == u's'
+ && m_chars[m_tokenStart + 4] == u't') {
tok = ConstToken;
}
break;
case 8:
- if (m_chars[m_tokenStart] == QLatin1Char('v')
- && m_chars[m_tokenStart + 1] == QLatin1Char('o')
- && m_chars[m_tokenStart + 2] == QLatin1Char('l')
- && m_chars[m_tokenStart + 3] == QLatin1Char('a')
- && m_chars[m_tokenStart + 4] == QLatin1Char('t')
- && m_chars[m_tokenStart + 5] == QLatin1Char('i')
- && m_chars[m_tokenStart + 6] == QLatin1Char('l')
- && m_chars[m_tokenStart + 7] == QLatin1Char('e')) {
+ if (m_chars[m_tokenStart] == u'v'
+ && m_chars[m_tokenStart + 1] == u'o'
+ && m_chars[m_tokenStart + 2] == u'l'
+ && m_chars[m_tokenStart + 3] == u'a'
+ && m_chars[m_tokenStart + 4] == u't'
+ && m_chars[m_tokenStart + 5] == u'i'
+ && m_chars[m_tokenStart + 6] == u'l'
+ && m_chars[m_tokenStart + 7] == u'e') {
tok = VolatileToken;
}
break;
@@ -285,7 +285,7 @@ TypeInfo TypeParser::parse(const QString &str, QString *errorMessage)
colon_prefix = false;
} else {
QStringList qualifiedName = stack.top().qualifiedName();
- qualifiedName.last().append(QLatin1Char(' ') + scanner.identifier());
+ qualifiedName.last().append(u' ' + scanner.identifier());
stack.top().setQualifiedName(qualifiedName);
}
break;
diff --git a/sources/shiboken6/ApiExtractor/typesystem.cpp b/sources/shiboken6/ApiExtractor/typesystem.cpp
index a1b9483ae..9e2888ef2 100644
--- a/sources/shiboken6/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystem.cpp
@@ -474,7 +474,7 @@ QString TypeEntry::buildTargetLangName() const
for (auto p = parent(); p && p->type() != TypeEntry::TypeSystemType; p = p->parent()) {
if (NamespaceTypeEntry::isVisibleScope(p)) {
if (!result.isEmpty())
- result.prepend(QLatin1Char('.'));
+ result.prepend(u'.');
QString n = p->m_d->m_entryName;
n.replace(QLatin1String("::"), QLatin1String(".")); // Primitive types may have "std::"
result.prepend(n);
@@ -558,7 +558,7 @@ QString TypeEntry::targetLangEntryName() const
{
if (m_d->m_cachedTargetLangEntryName.isEmpty()) {
m_d->m_cachedTargetLangEntryName = targetLangName();
- const int lastDot = m_d->m_cachedTargetLangEntryName.lastIndexOf(QLatin1Char('.'));
+ const int lastDot = m_d->m_cachedTargetLangEntryName.lastIndexOf(u'.');
if (lastDot != -1)
m_d->m_cachedTargetLangEntryName.remove(0, lastDot + 1);
}
@@ -577,7 +577,7 @@ void TypeEntry::setTargetLangPackage(const QString &p)
QString TypeEntry::qualifiedTargetLangName() const
{
- return targetLangPackage() + QLatin1Char('.') + targetLangName();
+ return targetLangPackage() + u'.' + targetLangName();
}
bool TypeEntry::isValue() const
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
index 25c9f243c..d714b7b33 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
@@ -143,12 +143,12 @@ static bool setRejectionRegularExpression(const QString &patternIn,
QString *errorMessage)
{
QString pattern;
- if (patternIn.startsWith(QLatin1Char('^')) && patternIn.endsWith(QLatin1Char('$')))
+ if (patternIn.startsWith(u'^') && patternIn.endsWith(u'$'))
pattern = patternIn;
else if (patternIn == QLatin1String("*"))
pattern = QStringLiteral("^.*$");
else
- pattern = QLatin1Char('^') + QRegularExpression::escape(patternIn) + QLatin1Char('$');
+ pattern = u'^' + QRegularExpression::escape(patternIn) + u'$';
re->setPattern(pattern);
if (!re->isValid()) {
*errorMessage = msgInvalidRegularExpression(patternIn, re->errorString());
@@ -172,7 +172,7 @@ std::optional<QString>
bool useLine = false;
bool foundLabel = false;
QString result;
- const auto lines = QStringView{code}.split(QLatin1Char('\n'));
+ const auto lines = QStringView{code}.split(u'\n');
for (const auto &line : lines) {
if (snippetRe.match(line).hasMatch()) {
foundLabel = true;
@@ -180,7 +180,7 @@ std::optional<QString>
if (!useLine)
break; // End of snippet reached
} else if (useLine)
- result += line.toString() + QLatin1Char('\n');
+ result += line.toString() + u'\n';
}
if (!foundLabel)
return {};
@@ -561,7 +561,7 @@ private:
QString TypeSystemEntityResolver::readFile(const QString &entityName, QString *errorMessage) const
{
QString fileName = entityName;
- if (!fileName.contains(QLatin1Char('.')))
+ if (!fileName.contains(u'.'))
fileName += QLatin1String(".xml");
QString path = TypeDatabase::instance()->modifiedTypesystemFilepath(fileName, m_currentPath);
if (!QFileInfo::exists(path)) // PySide6-specific hack
@@ -1108,7 +1108,7 @@ bool TypeSystemParser::importFileElement(const QXmlStreamAttributes &atts)
break;
}
if (from && to)
- characters(line + QLatin1Char('\n'));
+ characters(line + u'\n');
if (!from && line.contains(quoteFrom)) {
from = true;
foundFromOk = true;
@@ -1125,7 +1125,7 @@ bool TypeSystemParser::importFileElement(const QXmlStreamAttributes &atts)
if (!foundFromOk)
m_error = fromError;
if (!foundFromOk && !foundToOk)
- m_error = fromError + QLatin1Char(' ') + toError;
+ m_error = fromError + u' ' + toError;
return false;
}
@@ -1169,7 +1169,7 @@ static bool shouldDropTypeEntry(const TypeDatabase *db,
if (db->shouldDropTypeEntry(name)) // Unqualified
return true;
}
- name.prepend(QLatin1Char('.'));
+ name.prepend(u'.');
name.prepend(entry->name());
}
}
@@ -1179,7 +1179,7 @@ static bool shouldDropTypeEntry(const TypeDatabase *db,
// Returns empty string if there's no error.
static QString checkSignatureError(const QString& signature, const QString& tag)
{
- QString funcName = signature.left(signature.indexOf(QLatin1Char('('))).trimmed();
+ QString funcName = signature.left(signature.indexOf(u'(')).trimmed();
static const QRegularExpression whiteSpace(QStringLiteral("\\s"));
Q_ASSERT(whiteSpace.isValid());
if (!funcName.startsWith(QLatin1String("operator ")) && funcName.contains(whiteSpace)) {
@@ -1273,7 +1273,7 @@ FlagsTypeEntry *
{
if (!checkRootElement())
return nullptr;
- auto ftype = new FlagsTypeEntry(QLatin1String("QFlags<") + enumEntry->name() + QLatin1Char('>'),
+ auto ftype = new FlagsTypeEntry(QLatin1String("QFlags<") + enumEntry->name() + u'>',
since,
currentParentTypeEntry()->typeSystemTypeEntry());
ftype->setOriginator(enumEntry);
@@ -1290,15 +1290,16 @@ FlagsTypeEntry *
return nullptr;
QStringList lst = flagName.split(colonColon());
- const QString targetLangFlagName = QStringList(lst.mid(0, lst.size() - 1)).join(QLatin1Char('.'));
+ const QString name = lst.takeLast();
+ const QString targetLangFlagName = lst.join(u'.');
const QString &targetLangQualifier = enumEntry->targetLangQualifier();
if (targetLangFlagName != targetLangQualifier) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("enum %1 and flags %2 (%3) differ in qualifiers")
- .arg(targetLangQualifier, lst.constFirst(), targetLangFlagName);
+ .arg(targetLangQualifier, lst.value(0), targetLangFlagName);
}
- ftype->setFlagsName(lst.constLast());
+ ftype->setFlagsName(name);
enumEntry->setFlags(ftype);
m_context->db->addFlagsType(ftype);
@@ -1514,7 +1515,7 @@ EnumTypeEntry *
// put in the flags parallel...
if (!flagNames.isEmpty()) {
- const QStringList &flagNameList = flagNames.split(QLatin1Char(','));
+ const QStringList &flagNameList = flagNames.split(u',');
for (const QString &flagName : flagNameList)
parseFlagsEntry(reader, entry, flagName.trimmed(), since, attributes);
}
@@ -1818,7 +1819,7 @@ bool TypeSystemParser::parseRenameFunction(const ConditionalStreamReader &,
return false;
}
- *name = signature.left(signature.indexOf(QLatin1Char('('))).trimmed();
+ *name = signature.left(signature.indexOf(u'(')).trimmed();
QString errorString = checkSignatureError(signature, QLatin1String("function"));
if (!errorString.isEmpty()) {
@@ -2438,7 +2439,7 @@ bool TypeSystemParser::parseAddFunction(const ConditionalStreamReader &,
// Create signature for matching modifications
signature = TypeDatabase::normalizedSignature(originalSignature);
- if (!signature.contains(QLatin1Char('(')))
+ if (!signature.contains(u'('))
signature += QLatin1String("()");
m_currentSignature = signature;
@@ -2754,7 +2755,7 @@ bool TypeSystemParser::readFileSnippet(QXmlStreamAttributes *attributes, CodeSni
QString source = fileName;
if (!snippetLabel.isEmpty())
- source += QLatin1String(" (") + snippetLabel + QLatin1Char(')');
+ source += QLatin1String(" (") + snippetLabel + u')';
QString content;
QTextStream str(&content);
str << "// ========================================================================\n"
@@ -3020,7 +3021,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack
}
}
// Allow for primitive and/or std:: types only, else require proper nesting.
- if (element != StackElement::PrimitiveTypeEntry && name.contains(QLatin1Char(':'))
+ if (element != StackElement::PrimitiveTypeEntry && name.contains(u':')
&& !name.contains(QLatin1String("std::"))) {
m_error = msgIncorrectlyNestedName(name);
return false;
diff --git a/sources/shiboken6/ApiExtractor/xmlutils.cpp b/sources/shiboken6/ApiExtractor/xmlutils.cpp
index 6edca2fa5..2cd2e3b81 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils.cpp
+++ b/sources/shiboken6/ApiExtractor/xmlutils.cpp
@@ -37,8 +37,8 @@ XQuery::~XQuery() = default;
QString XQuery::evaluate(QString xPathExpression, QString *errorMessage)
{
// XQuery can't have invalid XML characters
- xPathExpression.replace(QLatin1Char('&'), QLatin1String("&amp;"));
- xPathExpression.replace(QLatin1Char('<'), QLatin1String("&lt;"));
+ xPathExpression.replace(u'&', QLatin1String("&amp;"));
+ xPathExpression.replace(u'<', QLatin1String("&lt;"));
return doEvaluate(xPathExpression, errorMessage);
}
diff --git a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
index e1e185130..92a897cac 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
+++ b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
@@ -145,7 +145,7 @@ QString LibXmlXQuery::doEvaluate(const QString &xPathExpression, QString *errorM
XmlPathObjectUniquePtr xPathObject(xmlXPathEvalExpression(xPathExpressionX, m_xpathContext.get()));
if (!xPathObject) {
*errorMessage = QLatin1String("xmlXPathEvalExpression() failed for \"") + xPathExpression
- + QLatin1Char('"');
+ + u'"';
return QString();
}
QString result;