summaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 15:30:08 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 15:36:29 -0200
commit5c813360b2f647753bfbacaf705504b7710d613c (patch)
treeb1adb090b1e7ad58010dbba801c5fe9166f051e2 /generator
parentf2a10c2257e40a7f24c457ad45d875f997a2cc5a (diff)
downloadshiboken-5c813360b2f647753bfbacaf705504b7710d613c.tar.gz
shiboken-5c813360b2f647753bfbacaf705504b7710d613c.tar.xz
shiboken-5c813360b2f647753bfbacaf705504b7710d613c.zip
Remove macro Shiboken_TypeCheck
Diffstat (limited to 'generator')
-rw-r--r--generator/headergenerator.cpp26
1 files changed, 6 insertions, 20 deletions
diff --git a/generator/headergenerator.cpp b/generator/headergenerator.cpp
index 4afbc1d7..d9560d2a 100644
--- a/generator/headergenerator.cpp
+++ b/generator/headergenerator.cpp
@@ -558,23 +558,17 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
s << "inline " << type->name() << " Shiboken::Converter<" << type->name() << " >::toCpp(PyObject* pyobj)" << endl;
s << '{' << endl;
- s << INDENT << "if (!Shiboken_TypeCheck(pyobj, " << type->name() << ")) {" << endl;
+ s << INDENT << "if (PyObject_TypeCheck(pyobj, SbkType<" << type->qualifiedCppName() << ">()))" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "SbkObjectType* shiboType = reinterpret_cast<SbkObjectType*>(SbkType<";
- s << type->name() << " >());" << endl;
+ s << INDENT << "return *" << cpythonWrapperCPtr(type, "pyobj") << ';' << endl;
}
- bool firstImplicitIf = true;
+
foreach (const AbstractMetaFunction* ctor, implicitConvs) {
if (ctor->isModifiedRemoved())
continue;
- Indentation indent(INDENT);
- s << INDENT;
- if (firstImplicitIf)
- firstImplicitIf = false;
- else
- s << "else ";
+ s << INDENT << "else ";
QString typeCheck;
QString toCppConv;
@@ -597,20 +591,12 @@ void HeaderGenerator::writeTypeConverterImpl(QTextStream& s, const TypeEntry* ty
}
{
- Indentation indent(INDENT);
- s << INDENT << "else if (shiboType->ext_isconvertible && shiboType->ext_tocpp && shiboType->ext_isconvertible(pyobj)) {" << endl;
+ s << INDENT << "else" << endl;
{
Indentation indent(INDENT);
- s << INDENT << type->name() << "* cptr = reinterpret_cast<" << type->name() << "*>(shiboType->ext_tocpp(pyobj));" << endl;
- s << INDENT << "std::auto_ptr<" << type->name() << " > cptr_auto_ptr(cptr);" << endl;
- s << INDENT << "return *cptr;" << endl;
+ s << INDENT << "return Shiboken::ValueTypeConverter<" << type->qualifiedCppName() << " >::toCpp(pyobj);" << endl;
}
- s << INDENT << '}' << endl;
}
-
- s << INDENT << '}' << endl;
-
- s << INDENT << "return *" << cpythonWrapperCPtr(type, "pyobj") << ';' << endl;
s << '}' << endl << endl;
}