diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-25 09:33:27 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-25 10:43:56 +0200 |
commit | ddfbbd346b522703a5b6f8d274a7f79983e5f319 (patch) | |
tree | 6ebd312287a1398b4b619b37045370cbeb83e1d1 /sources/shiboken2/generator | |
parent | 2eced73f6b8dd9f568e84e78f786a0ec8d6dd429 (diff) |
shiboken: Introduce nullptr
Apply Fixits by Qt Creator with some amendments.
Change-Id: Ie8300ddb834adb8b649324562f2c912a4e8cf4ce
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/generator')
7 files changed, 27 insertions, 27 deletions
diff --git a/sources/shiboken2/generator/generator.h b/sources/shiboken2/generator/generator.h index 1642752be..9d4201bc5 100644 --- a/sources/shiboken2/generator/generator.h +++ b/sources/shiboken2/generator/generator.h @@ -149,7 +149,7 @@ class GeneratorContext { public: GeneratorContext() = default; GeneratorContext(AbstractMetaClass *metaClass, - const AbstractMetaType *preciseType = 0, + const AbstractMetaType *preciseType = nullptr, bool forSmartPointer = false) : m_metaClass(metaClass), m_preciseClassType(preciseType), diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index 6abfde7c9..8d6c5903b 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -427,7 +427,7 @@ QString QtXmlToSphinx::resolveContextForMethod(const QString& methodName) const { const QStringRef currentClass = m_context.splitRef(QLatin1Char('.')).constLast(); - const AbstractMetaClass* metaClass = 0; + const AbstractMetaClass *metaClass = nullptr; const AbstractMetaClassList &classes = m_generator->classes(); for (const AbstractMetaClass *cls : classes) { if (cls->name() == currentClass) { @@ -444,7 +444,7 @@ QString QtXmlToSphinx::resolveContextForMethod(const QString& methodName) const funcList.append(func); } - const AbstractMetaClass* implementingClass = 0; + const AbstractMetaClass *implementingClass = nullptr; for (const AbstractMetaFunction *func : qAsConst(funcList)) { implementingClass = func->implementingClass(); if (implementingClass->name() == currentClass) @@ -1503,7 +1503,7 @@ static QString getFuncName(const AbstractMetaFunction* cppFunc) { return result; } -QtDocGenerator::QtDocGenerator() : m_docParser(0) +QtDocGenerator::QtDocGenerator() : m_docParser(nullptr) { } @@ -1656,8 +1656,8 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex "--------------------\n\n" << ".. _More:\n"; - writeInjectDocumentation(s, TypeSystem::DocModificationPrepend, metaClass, 0); - if (!writeInjectDocumentation(s, TypeSystem::DocModificationReplace, metaClass, 0)) + writeInjectDocumentation(s, TypeSystem::DocModificationPrepend, metaClass, nullptr); + if (!writeInjectDocumentation(s, TypeSystem::DocModificationReplace, metaClass, nullptr)) writeFormattedText(s, documentation, metaClass); if (!metaClass->isNamespace()) @@ -1679,7 +1679,7 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex writeFunction(s, metaClass, func); } - writeInjectDocumentation(s, TypeSystem::DocModificationAppend, metaClass, 0); + writeInjectDocumentation(s, TypeSystem::DocModificationAppend, metaClass, nullptr); } void QtDocGenerator::writeFunctionList(QTextStream& s, const AbstractMetaClass* cppClass) diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 73e1a7c3e..a37606923 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -1426,7 +1426,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla pc << INDENT << getFullTypeNameWithoutModifiers(sourceType) << " cppIn"; writeMinimalConstructorExpression(pc, sourceType); pc << ';' << endl; - writeToCppConversion(pc, sourceType, 0, QLatin1String("pyIn"), QLatin1String("cppIn")); + writeToCppConversion(pc, sourceType, nullptr, QLatin1String("pyIn"), QLatin1String("cppIn")); pc << ';'; toCppConv.append(QLatin1String("cppIn")); } else if (!isWrapperType(sourceType)) { @@ -2265,7 +2265,7 @@ const AbstractMetaType *CppGenerator::getArgumentType(const AbstractMetaFunction if (argPos < 0 || argPos > func->arguments().size()) { qCWarning(lcShiboken).noquote().nospace() << QStringLiteral("Argument index for function '%1' out of range.").arg(func->signature()); - return 0; + return nullptr; } const AbstractMetaType *argType = nullptr; @@ -2600,7 +2600,7 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream &s, const Ov || od->nextOverloadData().size() != 1 || od->overloads().size() != od->nextOverloadData().constFirst()->overloads().size()) { overloadData = od; - od = 0; + od = nullptr; } else { od = od->nextOverloadData().constFirst(); } @@ -3065,7 +3065,7 @@ void CppGenerator::writeNamedArgumentResolution(QTextStream &s, const AbstractMe QString CppGenerator::argumentNameFromIndex(const AbstractMetaFunction *func, int argIndex, const AbstractMetaClass **wrappedClass) { - *wrappedClass = 0; + *wrappedClass = nullptr; QString pyArgName; if (argIndex == -1) { pyArgName = QLatin1String("self"); @@ -4872,7 +4872,7 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEn s << "#endif" << endl << endl; s << INDENT << "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;" << endl; s << INDENT << "return "; - writeToPythonConversion(s, flagsType, 0, QLatin1String("cppResult")); + writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult")); s << ';' << endl; s << '}' << endl << endl; } @@ -4900,7 +4900,7 @@ void CppGenerator::writeFlagsUnaryOperator(QTextStream &s, const AbstractMetaEnu if (boolResult) s << "PyBool_FromLong(cppResult)"; else - writeToPythonConversion(s, flagsType, 0, QLatin1String("cppResult")); + writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult")); s << ';' << endl; s << '}' << endl << endl; } @@ -5479,7 +5479,7 @@ bool CppGenerator::finishGeneration() // Initialize smart pointer types. const QVector<const AbstractMetaType *> &smartPtrs = instantiatedSmartPointers(); for (const AbstractMetaType *metaType : smartPtrs) { - GeneratorContext context(0, metaType, true); + GeneratorContext context(nullptr, metaType, true); QString initFunctionName = getInitFunctionName(context); s_classInitDecl << "void init_" << initFunctionName << "(PyObject *module);" << endl; QString defineStr = QLatin1String("init_") + initFunctionName; diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.h b/sources/shiboken2/generator/shiboken2/cppgenerator.h index 44a04653a..9a4a02093 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.h +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.h @@ -117,7 +117,7 @@ private: */ void writeArgumentConversion(QTextStream &s, const AbstractMetaType *argType, const QString &argName, const QString &pyArgName, - const AbstractMetaClass *context = 0, + const AbstractMetaClass *context = nullptr, const QString &defaultValue = QString(), bool castArgumentAsUnused = false); @@ -138,7 +138,7 @@ private: const AbstractMetaType *type, const QString &pyIn, const QString &cppOut, - const AbstractMetaClass *context = 0, + const AbstractMetaClass *context = nullptr, const QString &defaultValue = QString()); /// Writes the conversion rule for arguments of regular and virtual methods. diff --git a/sources/shiboken2/generator/shiboken2/overloaddata.cpp b/sources/shiboken2/generator/shiboken2/overloaddata.cpp index 89c73576e..5c3d7d0b8 100644 --- a/sources/shiboken2/generator/shiboken2/overloaddata.cpp +++ b/sources/shiboken2/generator/shiboken2/overloaddata.cpp @@ -254,7 +254,7 @@ void OverloadData::sortNextOverloads() // be called. In the case of primitive types, list<double> must come before list<int>. if (instantiation->isPrimitive() && (signedIntegerPrimitives.contains(instantiation->name()))) { for (const QString &primitive : qAsConst(nonIntegerPrimitives)) - sortData.mapType(getImplicitConversionTypeName(ov->argType(), instantiation, 0, primitive)); + sortData.mapType(getImplicitConversionTypeName(ov->argType(), instantiation, nullptr, primitive)); } else { const AbstractMetaFunctionList &funcs = m_generator->implicitConversions(instantiation); for (const AbstractMetaFunction *function : funcs) @@ -346,7 +346,7 @@ void OverloadData::sortNextOverloads() if (instantiation->isPrimitive() && (signedIntegerPrimitives.contains(instantiation->name()))) { for (const QString &primitive : qAsConst(nonIntegerPrimitives)) { - QString convertibleTypeName = getImplicitConversionTypeName(ov->argType(), instantiation, 0, primitive); + QString convertibleTypeName = getImplicitConversionTypeName(ov->argType(), instantiation, nullptr, primitive); if (!graph.containsEdge(targetTypeId, sortData.map[convertibleTypeName])) // Avoid cyclic dependency. graph.addEdge(sortData.map[convertibleTypeName], targetTypeId); } @@ -467,8 +467,8 @@ void OverloadData::sortNextOverloads() * */ OverloadData::OverloadData(const AbstractMetaFunctionList &overloads, const ShibokenGenerator *generator) - : m_minArgs(256), m_maxArgs(0), m_argPos(-1), m_argType(0), - m_headOverloadData(this), m_previousOverloadData(0), m_generator(generator) + : m_minArgs(256), m_maxArgs(0), m_argPos(-1), m_argType(nullptr), + m_headOverloadData(this), m_previousOverloadData(nullptr), m_generator(generator) { for (const AbstractMetaFunction *func : overloads) { m_overloads.append(func); @@ -658,7 +658,7 @@ const AbstractMetaFunction *OverloadData::referenceFunction() const const AbstractMetaArgument *OverloadData::argument(const AbstractMetaFunction *func) const { if (isHeadOverloadData() || !m_overloads.contains(func)) - return 0; + return nullptr; int argPos = 0; int removed = 0; @@ -757,7 +757,7 @@ const AbstractMetaFunction *OverloadData::getFunctionWithDefaultValue() const if (!ShibokenGenerator::getDefaultValue(func, func->arguments().at(m_argPos + removedArgs)).isEmpty()) return func; } - return 0; + return nullptr; } QVector<int> OverloadData::invalidArgumentLengths() const diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp index 9ed175af4..693576444 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp @@ -340,7 +340,7 @@ void ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumLi static const AbstractMetaClass *getProperEnclosingClass(const AbstractMetaClass *metaClass) { if (!metaClass) - return 0; + return nullptr; if (metaClass->typeEntry()->codeGeneration() != TypeEntry::GenerateForSubclass) return metaClass; @@ -1252,7 +1252,7 @@ QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry *type, bool gene QString ShibokenGenerator::guessCPythonCheckFunction(const QString &type, AbstractMetaType **metaType) { - *metaType = 0; + *metaType = nullptr; if (type == QLatin1String("PyTypeObject")) return QLatin1String("PyType_Check"); diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.h b/sources/shiboken2/generator/shiboken2/shibokengenerator.h index fe6a1dc37..02231f1a0 100644 --- a/sources/shiboken2/generator/shiboken2/shibokengenerator.h +++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.h @@ -118,7 +118,7 @@ protected: const QVector<CodeSnip> & codeSnips, TypeSystem::CodeSnipPosition position, TypeSystem::Language language, - const AbstractMetaClass *context = 0); + const AbstractMetaClass *context = nullptr); /// Write user's custom code snippets at function level. void writeCodeSnips(QTextStream &s, const QVector<CodeSnip> & codeSnips, @@ -312,8 +312,8 @@ protected: QString cpythonIsConvertibleFunction(const AbstractMetaArgument *metaArg, bool genericNumberType = false); QString cpythonToCppConversionFunction(const AbstractMetaClass *metaClass); - QString cpythonToCppConversionFunction(const AbstractMetaType *type, const AbstractMetaClass *context = 0); - QString cpythonToPythonConversionFunction(const AbstractMetaType *type, const AbstractMetaClass *context = 0); + QString cpythonToCppConversionFunction(const AbstractMetaType *type, const AbstractMetaClass *context = nullptr); + QString cpythonToPythonConversionFunction(const AbstractMetaType *type, const AbstractMetaClass *context = nullptr); QString cpythonToPythonConversionFunction(const AbstractMetaClass *metaClass); QString cpythonToPythonConversionFunction(const TypeEntry *type); |