diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-13 15:33:34 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-14 12:14:22 +0200 |
commit | 84becad3db953a692eb4c1e49531b1fc5d04812f (patch) | |
tree | 01578c9679c04fdab969c1a7233bdb9c34d89f24 /sources/shiboken2/generator/shiboken2/cppgenerator.cpp | |
parent | 93ae00636551b84ebda8df208f064e132f1c8b5c (diff) |
shiboken2: Some Refactorings
- AbstractMetaType: Pass TypeEntry to constructor
- AbstractMetaType: Return instantiations() by const ref
- AbstractMetaClass: Make baseTemplateInstantiations a member instead of
a global hash.
Simplify the code accordingly.
Task-number: PYSIDE-1202
Change-Id: I1a18aa4ff97481af8cb13e8732fe3952c48edb29
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/generator/shiboken2/cppgenerator.cpp')
-rw-r--r-- | sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index ea970331e..906e82c93 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -85,10 +85,9 @@ static const char *typeNameOf(const T &t) inline AbstractMetaType *getTypeWithoutContainer(AbstractMetaType *arg) { if (arg && arg->typeEntry()->isContainer()) { - AbstractMetaTypeList lst = arg->instantiations(); // only support containers with 1 type - if (lst.size() == 1) - return lst[0]; + if (arg->instantiations().size() == 1) + return arg->instantiations().constFirst(); } return arg; } @@ -6265,7 +6264,7 @@ void CppGenerator::writeDefaultSequenceMethods(QTextStream &s, const GeneratorCo << CPP_SELF_VAR << "->begin();\n" << INDENT << "std::advance(_item, _i);\n"; - const AbstractMetaTypeList instantiations = metaClass->templateBaseClassInstantiations(); + const AbstractMetaTypeList &instantiations = metaClass->templateBaseClassInstantiations(); if (instantiations.isEmpty()) { qFatal("shiboken: %s: Internal error, no instantiations of \"%s\" were found.", __FUNCTION__, qPrintable(metaClass->qualifiedCppName())); |