diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2009-12-01 20:29:10 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2009-12-01 20:41:19 -0200 |
commit | 4d2edcd46c8b4cfaddb03edf2dfb5fbc7068e720 (patch) | |
tree | 4f0db8407abeafdf03b11bdca7a101175e7b36f9 /shibokengenerator.cpp | |
parent | ebb3ddc32fbab6793263652e9a92738678bbc310 (diff) |
Try to guess the check function for custom types.
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r-- | shibokengenerator.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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; |