summaryrefslogtreecommitdiffstats
path: root/headergenerator.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-09-29 10:18:39 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-10-01 11:19:35 -0300
commit4213b0176ae9af91221dbe38e1dead10638ff054 (patch)
tree414d08c2d3f8f0b3d9c36b8bdfe8ca5e607a19a2 /headergenerator.cpp
parent1129ff5d3b65dfa6b8221a1df5383781bd6862d2 (diff)
downloadshiboken-4213b0176ae9af91221dbe38e1dead10638ff054.tar.gz
shiboken-4213b0176ae9af91221dbe38e1dead10638ff054.tar.xz
shiboken-4213b0176ae9af91221dbe38e1dead10638ff054.zip
modified the generator do deal with all value type conversions in
the same manner as it does with object types, in other words using pointers instead of copies when converting the Python wrappers to C++
Diffstat (limited to 'headergenerator.cpp')
-rw-r--r--headergenerator.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 4bdad7b1..6fcf1faf 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -192,7 +192,10 @@ void HeaderGenerator::writeTypeConverterDecl(QTextStream& s, const TypeEntry* ty
if (type->isObject())
s << "const ";
s << cppName << " cppobj);" << endl;
- s << INDENT << "static " << cppName << " toCpp(PyObject* pyobj);" << endl;
+ s << INDENT << "static " << cppName;
+ if (type->isValue())
+ s << '*';
+ s << " toCpp(PyObject* pyobj);" << endl;
s << "};" << endl;
}
@@ -243,7 +246,10 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
s << INDENT << "return pyobj;" << endl;
s << '}' << endl << endl;
- s << "inline " << cppName << " Converter< " << cppName << " >::toCpp(PyObject* pyobj)" << endl;
+ s << "inline " << cppName;
+ if (type->isValue())
+ s << '*';
+ s << " Converter< " << cppName << " >::toCpp(PyObject* pyobj)" << endl;
s << '{' << endl;
if (type->isValue()) {
@@ -267,8 +273,10 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
s << "if (" << cpythonCheckFunction(argType) << "(pyobj))" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "return " << cppName;
- s << "(Converter< " << argType->cppSignature() << " >::toCpp(pyobj));" << endl;
+ s << INDENT << "return ";
+ if (type->isValue())
+ s << "new ";
+ s << cppName << "(Converter< " << argType->cppSignature() << " >::toCpp(pyobj));" << endl;
}
}
}
@@ -277,8 +285,6 @@ 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 << '*';