diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-20 17:49:26 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2010-02-20 18:20:32 -0300 |
commit | 5ce831e73fc4b8bee7a5b62d7485eee11f498a92 (patch) | |
tree | f81c4d1243a75545be0adecdcf298b5420df9438 /shibokengenerator.cpp | |
parent | 02e5d72cceae2b03ce25068567e3c4c903a4df3d (diff) |
Adds the convenience method 'isCString' to ShibokenGenerator.
It checks if an AbstractMetaType represents a C string.
Also updated code to make use of the new method.
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r-- | shibokengenerator.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp index aeacb25b5..46f7083d1 100644 --- a/shibokengenerator.cpp +++ b/shibokengenerator.cpp @@ -379,7 +379,7 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func) result += m_formatUnits[ptype->name()]; else result += 'O'; - } else if (arg->type()->isNativePointer() && arg->type()->name() == "char") { + } else if (isCString(arg->type())) { result += 'z'; } else { ReportHandler::warning("Unknown type used in ShibokenGenerator::getFormatUnitString!"); @@ -391,7 +391,7 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func) QString ShibokenGenerator::cpythonBaseName(const AbstractMetaType* type) { - if (type->name() == "char" && type->isNativePointer()) + if (isCString(type)) return QString("PyString"); return cpythonBaseName(type->typeEntry()); } @@ -554,6 +554,11 @@ bool ShibokenGenerator::isPyInt(const AbstractMetaType* type) return isPyInt(type->typeEntry()); } +bool ShibokenGenerator::isCString(const AbstractMetaType* type) +{ + return type->isNativePointer() && type->name() == "char"; +} + bool ShibokenGenerator::shouldDereferenceArgumentPointer(const AbstractMetaArgument* arg) { return shouldDereferenceAbstractMetaTypePointer(arg->type()); |