aboutsummaryrefslogtreecommitdiffstats
path: root/headergenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'headergenerator.cpp')
-rw-r--r--headergenerator.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 6fcf1faf2..4bdad7b16 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -192,10 +192,7 @@ void HeaderGenerator::writeTypeConverterDecl(QTextStream& s, const TypeEntry* ty
if (type->isObject())
s << "const ";
s << cppName << " cppobj);" << endl;
- s << INDENT << "static " << cppName;
- if (type->isValue())
- s << '*';
- s << " toCpp(PyObject* pyobj);" << endl;
+ s << INDENT << "static " << cppName << " toCpp(PyObject* pyobj);" << endl;
s << "};" << endl;
}
@@ -246,10 +243,7 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
s << INDENT << "return pyobj;" << endl;
s << '}' << endl << endl;
- s << "inline " << cppName;
- if (type->isValue())
- s << '*';
- s << " Converter< " << cppName << " >::toCpp(PyObject* pyobj)" << endl;
+ s << "inline " << cppName << " Converter< " << cppName << " >::toCpp(PyObject* pyobj)" << endl;
s << '{' << endl;
if (type->isValue()) {
@@ -273,10 +267,8 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
s << "if (" << cpythonCheckFunction(argType) << "(pyobj))" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "return ";
- if (type->isValue())
- s << "new ";
- s << cppName << "(Converter< " << argType->cppSignature() << " >::toCpp(pyobj));" << endl;
+ s << INDENT << "return " << cppName;
+ s << "(Converter< " << argType->cppSignature() << " >::toCpp(pyobj));" << endl;
}
}
}
@@ -285,6 +277,8 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
if (type->isEnum() || type->isFlags()) {
s << '(' << type->qualifiedCppName() << ") ((Shiboken::PyEnumObject*)pyobj)->ob_ival";
} else {
+ if (type->isValue())
+ s << '*';
s << "((" << cppName;
if (type->isValue())
s << '*';