aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp18
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h2
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp9
-rw-r--r--sources/shiboken2/generator/main.cpp7
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp59
-rw-r--r--sources/shiboken2/generator/shiboken2/overloaddata.cpp8
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp18
7 files changed, 59 insertions, 62 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 32036749d..38000785f 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -1044,7 +1044,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(EnumModelItem enumIte
TypeEntry* typeEntry = 0;
if (enumItem->accessPolicy() == CodeModel::Private) {
QStringList names = enumItem->qualifiedName();
- QString enumName = names.last();
+ QString enumName = names.constLast();
QString nspace;
if (names.size() > 1)
nspace = QStringList(names.mid(0, names.size() - 1)).join(colonColon());
@@ -1802,10 +1802,10 @@ 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.first().contains(QLatin1Char('<'))) {
+ if (baseClasses.size() == 1 && baseClasses.constFirst().contains(QLatin1Char('<'))) {
TypeParser::Info info;
ComplexTypeEntry* baseContainerType;
- AbstractMetaClass* templ = findTemplateClass(baseClasses.first(), metaClass, &info, &baseContainerType);
+ AbstractMetaClass* templ = findTemplateClass(baseClasses.constFirst(), metaClass, &info, &baseContainerType);
if (templ) {
setupInheritance(templ);
inheritTemplate(metaClass, templ, info);
@@ -1827,7 +1827,7 @@ bool AbstractMetaBuilderPrivate::setupInheritance(AbstractMetaClass *metaClass)
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("template baseclass '%1' of '%2' is not known")
- .arg(baseClasses.first(), metaClass->name());
+ .arg(baseClasses.constFirst(), metaClass->name());
return false;
}
@@ -1998,7 +1998,7 @@ AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFu
if (metaFunction->name() == metaClass->name()) {
metaFunction->setFunctionType(AbstractMetaFunction::ConstructorFunction);
if (fargs.size() == 1) {
- const TypeEntry *te = fargs.first()->type()->typeEntry();
+ const TypeEntry *te = fargs.constFirst()->type()->typeEntry();
if (te->isCustom())
metaFunction->setExplicit(true);
if (te->name() == metaFunction->name())
@@ -2258,7 +2258,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
if (arguments.size() == 1) {
ArgumentModelItem arg = arguments.at(0);
TypeInfo type = arg->type();
- if (type.qualifiedName().first() == QLatin1String("void") && type.indirections() == 0)
+ if (type.qualifiedName().constFirst() == QLatin1String("void") && type.indirections() == 0)
arguments.pop_front();
}
@@ -2322,9 +2322,9 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
} else {
FunctionModificationList mods = TypeDatabase::instance()->functionModifications(metaFunction->minimalSignature());
if (!mods.isEmpty()) {
- QVector<ArgumentModification> argMods = mods.first().argument_mods;
+ QVector<ArgumentModification> argMods = mods.constFirst().argument_mods;
if (!argMods.isEmpty())
- replacedExpression = argMods.first().replacedDefaultExpression;
+ replacedExpression = argMods.constFirst().replacedDefaultExpression;
}
}
@@ -2373,7 +2373,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
// Determine class special functions
if (m_currentClass && metaFunction->arguments().size() == 1) {
- const AbstractMetaType *argType = metaFunction->arguments().first()->type();
+ const AbstractMetaType *argType = metaFunction->arguments().constFirst()->type();
if (argType->typeEntry() == m_currentClass->typeEntry() && argType->indirections() == 0) {
if (metaFunction->name() == QLatin1String("operator=")) {
switch (argType->referenceType()) {
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
index 71b69473e..9e15541f6 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
@@ -56,7 +56,7 @@ public:
void pushScope(ScopeModelItem item) { m_scopes << item; }
- ScopeModelItem currentScope() const { return m_scopes.last(); }
+ ScopeModelItem currentScope() const { return m_scopes.constLast(); }
AbstractMetaClass *argumentToClass(ArgumentModelItem);
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 8564da3c4..4a8d3063d 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -615,11 +615,10 @@ void Handler::addFlags(const QString &name, QString flagName,
if (QStringList(lst.mid(0, lst.size() - 1)).join(colonColon()) != m_currentEnum->targetLangQualifier()) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("enum %1 and flags %2 differ in qualifiers")
- // avoid constFirst to stay Qt 5.5 compatible
- .arg(m_currentEnum->targetLangQualifier(), lst.first());
+ .arg(m_currentEnum->targetLangQualifier(), lst.constFirst());
}
- ftype->setFlagsName(lst.last());
+ ftype->setFlagsName(lst.constLast());
m_currentEnum->setFlags(ftype);
m_database->addFlagsType(ftype);
@@ -933,7 +932,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
else
m_currentEnum =
new EnumTypeEntry(QStringList(names.mid(0, names.size() - 1)).join(colonColon()),
- names.last(), since);
+ names.constLast(), since);
m_currentEnum->setAnonymous(!attributes[QLatin1String("identified-by-value")].isEmpty());
element->entry = m_currentEnum;
m_currentEnum->setCodeGeneration(m_generate);
@@ -1978,7 +1977,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
}
if (topElement.type == StackElement::ModifyFunction || topElement.type == StackElement::AddFunction) {
- FunctionModification mod = m_contextStack.top()->functionMods.last();
+ FunctionModification mod = m_contextStack.top()->functionMods.constLast();
if (snip.language == TypeSystem::ShellDeclaration) {
m_error = QLatin1String("no function implementation in shell declaration in which to inject code");
return false;
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index b22919981..774775fb0 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -218,7 +218,7 @@ static QMap<QString, QString> getInitializedArguments()
{
QMap<QString, QString> args;
QStringList arguments = QCoreApplication::arguments();
- QString appName = arguments.first();
+ QString appName = arguments.constFirst();
arguments.removeFirst();
QString projectFileName;
@@ -502,9 +502,8 @@ int main(int argc, char *argv[])
QStringList parts = fullVersion.split(QLatin1Char(','));
QString package;
QString version;
- // avoid constFirst to stay Qt 5.5 compatible
- package = parts.count() == 1 ? QLatin1String("*") : parts.first();
- version = parts.last();
+ package = parts.count() == 1 ? QLatin1String("*") : parts.constFirst();
+ version = parts.constLast();
if (!extractor.setApiVersion(package, version)) {
errorPrint(msgInvalidVersion(package, version));
return EXIT_FAILURE;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 11e5625b8..392f5b66d 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -393,7 +393,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
if (overloads.isEmpty())
continue;
- const AbstractMetaFunction* rfunc = overloads.first();
+ const AbstractMetaFunction* rfunc = overloads.constFirst();
if (m_sequenceProtocol.contains(rfunc->name()) || m_mappingProtocol.contains(rfunc->name()))
continue;
@@ -429,7 +429,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
AbstractMetaType *pointerToInnerType =
buildAbstractMetaTypeFromString(pointerToInnerTypeName);
- AbstractMetaFunction *mutableRfunc = overloads.first();
+ AbstractMetaFunction *mutableRfunc = overloads.constFirst();
mutableRfunc->replaceType(pointerToInnerType);
} else if (smartPointerTypeEntry->refCountMethodName().isEmpty()
|| smartPointerTypeEntry->refCountMethodName() != rfunc->name()) {
@@ -611,7 +611,7 @@ void CppGenerator::writeConstructorNative(QTextStream& s, const AbstractMetaFunc
s << " : ";
writeFunctionCall(s, func);
s << " {" << endl;
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, func->injectedCodeSnips(), TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode, func, lastArg);
s << INDENT << "// ... middle" << endl;
writeCodeSnips(s, func->injectedCodeSnips(), TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode, func, lastArg);
@@ -733,7 +733,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
//Write declaration/native injected code
if (func->hasInjectedCode()) {
CodeSnipList snips = func->injectedCodeSnips();
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionDeclaration, TypeSystem::NativeCode, func, lastArg);
s << endl;
}
@@ -756,7 +756,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
CodeSnipList snips;
if (func->hasInjectedCode()) {
snips = func->injectedCodeSnips();
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::ShellCode, func, lastArg);
s << endl;
}
@@ -856,7 +856,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
if (injectedCodeUsesPySelf(func))
s << INDENT << "PyObject* pySelf = BindingManager::instance().retrieveWrapper(this);" << endl;
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode, func, lastArg);
s << endl;
}
@@ -956,7 +956,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
if (func->hasInjectedCode()) {
s << endl;
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode, func, lastArg);
}
@@ -1257,7 +1257,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
// Constructor that does implicit conversion.
if (!conv->typeReplaced(1).isEmpty())
continue;
- const AbstractMetaType* sourceType = conv->arguments().first()->type();
+ const AbstractMetaType* sourceType = conv->arguments().constFirst()->type();
typeCheck = cpythonCheckFunction(sourceType);
bool isUserPrimitiveWithoutTargetLangName = isUserPrimitive(sourceType)
&& sourceType->typeEntry()->targetLangApiName() == sourceType->typeEntry()->name();
@@ -1301,7 +1301,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
}
const AbstractMetaType* sourceType = conv->isConversionOperator()
? buildAbstractMetaTypeFromAbstractMetaClass(conv->ownerClass())
- : conv->arguments().first()->type();
+ : conv->arguments().constFirst()->type();
writePythonToCppConversionFunctions(s, sourceType, targetType, typeCheck, toCppConv, toCppPreConv);
}
@@ -1417,7 +1417,7 @@ void CppGenerator::writeConverterRegister(QTextStream &s, const AbstractMetaClas
// Constructor that does implicit conversion.
if (!conv->typeReplaced(1).isEmpty())
continue;
- sourceType = conv->arguments().first()->type();
+ sourceType = conv->arguments().constFirst()->type();
}
QString toCpp = pythonToCppFunctionName(sourceType, targetType);
QString isConv = convertibleToCppFunctionName(sourceType, targetType);
@@ -1626,7 +1626,7 @@ void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFun
// (first "1") and the flag indicating that the Python wrapper holds an C++ wrapper
// is marked as true (the second "1"). Otherwise the default values apply:
// Python owns it and C++ wrapper is false.
- if (shouldGenerateCppWrapper(overloads.first()->ownerClass()))
+ if (shouldGenerateCppWrapper(overloads.constFirst()->ownerClass()))
s << INDENT << "Shiboken::Object::setHasCppWrapper(sbkSelf, true);" << endl;
// Need to check if a wrapper for same pointer is already registered
// Caused by bug PYSIDE-217, where deleted objects' wrappers are not released
@@ -2514,7 +2514,7 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
if (func->isConstructor() && func->arguments().count() == 1) {
const AbstractMetaClass* ownerClass = func->ownerClass();
const ComplexTypeEntry* baseContainerType = ownerClass->typeEntry()->baseContainerType();
- if (baseContainerType && baseContainerType == func->arguments().first()->type()->typeEntry() && isCopyable(ownerClass)) {
+ if (baseContainerType && baseContainerType == func->arguments().constFirst()->type()->typeEntry() && isCopyable(ownerClass)) {
tck << '!' << cpythonCheckFunction(ownerClass->typeEntry()) << pyArgName << ')' << endl;
Indentation indent(INDENT);
tck << INDENT << "&& ";
@@ -2529,17 +2529,17 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
if (od->nextOverloadData().isEmpty()
|| od->nextArgumentHasDefaultValue()
|| od->nextOverloadData().size() != 1
- || od->overloads().size() != od->nextOverloadData().first()->overloads().size()) {
+ || od->overloads().size() != od->nextOverloadData().constFirst()->overloads().size()) {
overloadData = od;
od = 0;
} else {
- od = od->nextOverloadData().first();
+ od = od->nextOverloadData().constFirst();
}
}
if (usePyArgs && signatureFound) {
AbstractMetaArgumentList args = refFunc->arguments();
- int lastArgIsVarargs = (int) (args.size() > 1 && args.last()->type()->isVarargs());
+ int lastArgIsVarargs = (int) (args.size() > 1 && args.constLast()->type()->isVarargs());
int numArgs = args.size() - OverloadData::numberOfRemovedArguments(refFunc) - lastArgIsVarargs;
typeChecks.prepend(QString::fromLatin1("numArgs %1 %2").arg(lastArgIsVarargs ? QLatin1String(">=") : QLatin1String("==")).arg(numArgs));
} else if (sequenceArgCount > 1) {
@@ -2583,7 +2583,7 @@ void CppGenerator::writeFunctionCalls(QTextStream &s, const OverloadData &overlo
{
Indentation indent(INDENT);
if (overloads.count() == 1) {
- writeSingleFunctionCall(s, overloadData, overloads.first(), context);
+ writeSingleFunctionCall(s, overloadData, overloads.constFirst(), context);
} else {
for (int i = 0; i < overloads.count(); i++) {
const AbstractMetaFunction* func = overloads.at(i);
@@ -2894,7 +2894,7 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s, const Abs
QString code;
QTextStream c(&code);
c << INDENT << QString::fromLatin1("%1& cppOutRef = *((%1*)cppOut);").arg(cppTypeName) << endl;
- code.append(toCppConversions.first()->conversion());
+ code.append(toCppConversions.constFirst()->conversion());
for (int i = 0; i < containerType->instantiations().count(); ++i) {
const AbstractMetaType* type = containerType->instantiations().at(i);
QString typeName = getFullTypeName(type);
@@ -2980,7 +2980,7 @@ void CppGenerator::writeNamedArgumentResolution(QTextStream& s, const AbstractMe
}
}
s << INDENT << '}' << endl;
- if (arg != args.last())
+ if (arg != args.constLast())
s << INDENT;
}
}
@@ -3068,7 +3068,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
removedArgs++;
}
} else if (maxArgs != 0 && !func->arguments().isEmpty()) {
- lastArg = func->arguments().last();
+ lastArg = func->arguments().constLast();
}
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::TargetLangCode, func, lastArg);
@@ -3143,7 +3143,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
firstArg.remove(1, 1); // remove the de-reference operator
QString secondArg = QLatin1String(CPP_ARG0);
- if (!func->isUnaryOperator() && shouldDereferenceArgumentPointer(func->arguments().first())) {
+ if (!func->isUnaryOperator() && shouldDereferenceArgumentPointer(func->arguments().constFirst())) {
secondArg.prepend(QLatin1String("(*"));
secondArg.append(QLatin1Char(')'));
}
@@ -3384,7 +3384,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
} else if (!refcount_mods.isEmpty()) {
for (const ArgumentModification &arg_mod : qAsConst(refcount_mods)) {
- ReferenceCount refCount = arg_mod.referenceCounts.first();
+ ReferenceCount refCount = arg_mod.referenceCounts.constFirst();
if (refCount.action != ReferenceCount::Set
&& refCount.action != ReferenceCount::Remove
&& refCount.action != ReferenceCount::Add) {
@@ -3410,7 +3410,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
s << INDENT << "Shiboken::Object::removeReference(";
s << "reinterpret_cast<SbkObject*>(" PYTHON_SELF_VAR "), \"";
- QString varName = arg_mod.referenceCounts.first().varName;
+ QString varName = arg_mod.referenceCounts.constFirst().varName;
if (varName.isEmpty())
varName = func->minimalSignature() + QString().number(arg_mod.index);
@@ -3723,8 +3723,7 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
tp_dealloc = QLatin1String("&SbkDeallocQAppWrapper");
else
tp_dealloc = QLatin1String("&SbkDeallocWrapper");
- // avoid constFirst to stay Qt 5.5 compatible
- tp_init = (onlyPrivCtor || ctors.isEmpty()) ? QLatin1String("0") : cpythonFunctionName(ctors.first());
+ tp_init = (onlyPrivCtor || ctors.isEmpty()) ? QLatin1String("0") : cpythonFunctionName(ctors.constFirst());
}
QString tp_getattro(QLatin1Char('0'));
@@ -3885,7 +3884,7 @@ void CppGenerator::writeMappingMethods(QTextStream &s,
writeCppSelfDefinition(s, func, context);
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode, func, lastArg);
s << '}' << endl << endl;
}
@@ -3912,7 +3911,7 @@ void CppGenerator::writeSequenceMethods(QTextStream &s,
writeCppSelfDefinition(s, func, context);
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().last();
+ const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips,TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode, func, lastArg);
s << '}' << endl << endl;
}
@@ -4304,7 +4303,7 @@ void CppGenerator::writeRichCompareFunction(QTextStream &s, GeneratorContext &co
// If the function is user added, use the inject code
if (func->isUserAdded()) {
CodeSnipList snips = func->injectedCodeSnips();
- writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode, func, func->arguments().last());
+ writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode, func, func->arguments().constLast());
} else {
QString expression = QString::fromLatin1("%1%2 %3 (%4" CPP_ARG0 ")")
.arg(func->isPointerOperator() ? QLatin1String("&") : QString(),
@@ -4385,7 +4384,7 @@ void CppGenerator::writeMethodDefinitionEntry(QTextStream& s, const AbstractMeta
void CppGenerator::writeMethodDefinition(QTextStream& s, const AbstractMetaFunctionList overloads)
{
Q_ASSERT(!overloads.isEmpty());
- const AbstractMetaFunction* func = overloads.first();
+ const AbstractMetaFunction* func = overloads.constFirst();
if (m_tpFuncs.contains(func->name()))
return;
@@ -4969,7 +4968,7 @@ void CppGenerator::writeInitQtMetaTypeFunctionBody(QTextStream &s, GeneratorCont
const AbstractMetaClass* enclosingClass = metaClass->enclosingClass();
while (enclosingClass) {
if (enclosingClass->typeEntry()->generateCode())
- nameVariants << (enclosingClass->name() + QLatin1String("::") + nameVariants.last());
+ nameVariants << (enclosingClass->name() + QLatin1String("::") + nameVariants.constLast());
enclosingClass = enclosingClass->enclosingClass();
}
@@ -5770,7 +5769,7 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, GeneratorContext &
s << INDENT << metaClass->qualifiedCppName() << "::iterator _item = " CPP_SELF_VAR "->begin();" << endl;
s << INDENT << "for (Py_ssize_t pos = 0; pos < _i; pos++) _item++;" << endl;
- const AbstractMetaType* itemType = metaClass->templateBaseClassInstantiations().first();
+ const AbstractMetaType* itemType = metaClass->templateBaseClassInstantiations().constFirst();
s << INDENT << "return ";
writeToPythonConversion(s, itemType, metaClass, QLatin1String("*_item"));
diff --git a/sources/shiboken2/generator/shiboken2/overloaddata.cpp b/sources/shiboken2/generator/shiboken2/overloaddata.cpp
index 8fd16f83c..2b75b85be 100644
--- a/sources/shiboken2/generator/shiboken2/overloaddata.cpp
+++ b/sources/shiboken2/generator/shiboken2/overloaddata.cpp
@@ -142,7 +142,7 @@ static QString getImplicitConversionTypeName(const AbstractMetaType* containerTy
else if (function->isConversionOperator())
impConv = function->ownerClass()->typeEntry()->name();
else
- impConv = getTypeName(function->arguments().first()->type());
+ impConv = getTypeName(function->arguments().constFirst()->type());
QStringList types;
const AbstractMetaTypeList &instantiations = containerType->instantiations();
@@ -305,7 +305,7 @@ void OverloadData::sortNextOverloads()
if (function->isConversionOperator())
convertibleType = function->ownerClass()->typeEntry()->name();
else
- convertibleType = getTypeName(function->arguments().first()->type());
+ convertibleType = getTypeName(function->arguments().constFirst()->type());
if (convertibleType == QLatin1String("int") || convertibleType == QLatin1String("unsigned int"))
classesWithIntegerImplicitConversion << targetTypeEntryName;
@@ -589,7 +589,7 @@ bool OverloadData::hasVarargs() const
{
for (const AbstractMetaFunction *func : m_overloads) {
AbstractMetaArgumentList args = func->arguments();
- if (args.size() > 1 && args.last()->type()->isVarargs())
+ if (args.size() > 1 && args.constLast()->type()->isVarargs())
return true;
}
return false;
@@ -652,7 +652,7 @@ bool OverloadData::hasStaticAndInstanceFunctions() const
const AbstractMetaFunction* OverloadData::referenceFunction() const
{
- return m_overloads.first();
+ return m_overloads.constFirst();
}
const AbstractMetaArgument* OverloadData::argument(const AbstractMetaFunction* func) const
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 5a6d5fc17..82f21f6d0 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -495,7 +495,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction*
if (prefix.isEmpty() && match.hasMatch()) {
QString flagName = match.captured(1);
QStringList enumItems = match.captured(2).split(QLatin1Char('|'));
- QString scope = searchForEnumScope(func->implementingClass(), enumItems.first());
+ QString scope = searchForEnumScope(func->implementingClass(), enumItems.constFirst());
if (!scope.isEmpty())
scope.append(QLatin1String("::"));
@@ -1019,7 +1019,7 @@ bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaCla
AbstractMetaFunctionList ctors = metaClass->queryFunctions(AbstractMetaClass::Constructors);
if (ctors.count() != 1)
return false;
- return ctors.first()->functionType() == AbstractMetaFunction::CopyConstructorFunction;
+ return ctors.constFirst()->functionType() == AbstractMetaFunction::CopyConstructorFunction;
}
bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const TypeEntry* type) const
@@ -1123,7 +1123,7 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType
|| type == ContainerTypeEntry::StackContainer
|| type == ContainerTypeEntry::SetContainer
|| type == ContainerTypeEntry::QueueContainer) {
- const AbstractMetaType* type = metaType->instantiations().first();
+ const AbstractMetaType* type = metaType->instantiations().constFirst();
if (isPointerToWrapperType(type)) {
typeCheck += QString::fromLatin1("checkSequenceTypes(%1, ").arg(cpythonTypeNameExt(type));
} else if (isWrapperType(type)) {
@@ -1139,8 +1139,8 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType
|| type == ContainerTypeEntry::MultiHashContainer
|| type == ContainerTypeEntry::PairContainer) {
QString pyType = (type == ContainerTypeEntry::PairContainer) ? QLatin1String("Pair") : QLatin1String("Dict");
- const AbstractMetaType* firstType = metaType->instantiations().first();
- const AbstractMetaType* secondType = metaType->instantiations().last();
+ const AbstractMetaType* firstType = metaType->instantiations().constFirst();
+ const AbstractMetaType* secondType = metaType->instantiations().constLast();
if (isPointerToWrapperType(firstType) && isPointerToWrapperType(secondType)) {
typeCheck += QString::fromLatin1("check%1Types(%2, %3, ").arg(pyType)
.arg(cpythonTypeNameExt(firstType), cpythonTypeNameExt(secondType));
@@ -1966,8 +1966,8 @@ void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVa
while (rit.hasNext()) {
const QRegularExpressionMatch match = rit.next();
const QStringList list = match.capturedTexts();
- QString conversionString = list.first();
- QString conversionTypeName = list.last();
+ QString conversionString = list.constFirst();
+ QString conversionTypeName = list.constLast();
const AbstractMetaType* conversionType = buildAbstractMetaTypeFromString(conversionTypeName);
if (!conversionType) {
qFatal(qPrintable(QString::fromLatin1("Could not find type '%1' for use in '%2' conversion. "
@@ -1986,7 +1986,7 @@ void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVa
while (code.at(start).isSpace())
++start;
QString varType = code.mid(start, end - start);
- conversionString = varType + list.first();
+ conversionString = varType + list.constFirst();
varType = miniNormalizer(varType);
QString varName = list.at(1).trimmed();
if (!varType.isEmpty()) {
@@ -2193,7 +2193,7 @@ AbstractMetaFunctionList ShibokenGenerator::getMethodsWithBothStaticAndNonStatic
if (overloads.isEmpty())
continue;
if (OverloadData::hasStaticAndInstanceFunctions(overloads))
- methods.append(overloads.first());
+ methods.append(overloads.constFirst());
}
}
return methods;