From 4d2edcd46c8b4cfaddb03edf2dfb5fbc7068e720 Mon Sep 17 00:00:00 2001 From: Hugo Lima Date: Tue, 1 Dec 2009 20:29:10 -0200 Subject: Try to guess the check function for custom types. --- shibokengenerator.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'shibokengenerator.cpp') diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp index 0b2008f57..570e6ebac 100644 --- a/shibokengenerator.cpp +++ b/shibokengenerator.cpp @@ -534,14 +534,25 @@ static QString checkFunctionName(QString baseName, bool genericNumberType, bool QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType, bool genericNumberType, bool checkExact) { + if (metaType->typeEntry()->isCustom()) + return guessCPythonCheckFunction(metaType->typeEntry()->name()); return checkFunctionName(cpythonBaseName(metaType), genericNumberType, checkExact); } QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry* type, bool genericNumberType, bool checkExact) { + if (type->isCustom()) + return guessCPythonCheckFunction(type->name()); return checkFunctionName(cpythonBaseName(type), genericNumberType, checkExact); } +QString ShibokenGenerator::guessCPythonCheckFunction(const QString& type) +{ + if (type == "PyTypeObject") + return "PyType_Check"; + return type+"_Check"; +} + QString ShibokenGenerator::cpythonIsConvertibleFunction(const TypeEntry* type) { QString baseName; -- cgit v1.2.3