diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-07-18 16:22:21 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:17:03 -0300 |
commit | 3016b0de40d93de2ca3eb690c1ae96529643f26a (patch) | |
tree | 4d60ed064f3b454ad12020ab906552f228609ae3 /generator/shibokengenerator.h | |
parent | 742fc4d4b723425a2d8ee1bea12116521d528c96 (diff) |
Added convenience functions to improve code readability.
Checking if a type is an Object Type is a very common task, followed
by asking if a type is a pointer to a type that has a Python wrapper.
These functions solve the problem:
ShibokenGenerator::isObjectType(type)
ShibokenGenerator::isPointerToWrapperType(type)
I refactored the generator code to make use of those functions.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
Reviewed by Lauro Moura <lauro.neto@openbossa.org>
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'generator/shibokengenerator.h')
-rw-r--r-- | generator/shibokengenerator.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/generator/shibokengenerator.h b/generator/shibokengenerator.h index 526e5ac13..aafc40da0 100644 --- a/generator/shibokengenerator.h +++ b/generator/shibokengenerator.h @@ -241,6 +241,17 @@ public: static bool isCString(const AbstractMetaType* type); static bool isPairContainer(const AbstractMetaType* type); + /// Tells if the type or class is an Object (or QObject) Type. + static bool isObjectType(const ComplexTypeEntry* type); + static bool isObjectType(const AbstractMetaType* metaType); + static bool isObjectType(const AbstractMetaClass* metaClass); + + /** + * Checks if the type is an Object/QObject or pointer to Value Type. + * In other words, tells if the type is "T*" and T has a Python wrapper. + */ + static bool isPointerToWrapperType(const AbstractMetaType* type); + /// Checks if an argument type should be dereferenced by the Python method wrapper before calling the C++ method. static bool shouldDereferenceArgumentPointer(const AbstractMetaArgument* arg); /// Checks if a meta type should be dereferenced by the Python method wrapper passing it to C++. @@ -335,7 +346,7 @@ public: */ static Options getConverterOptions(const AbstractMetaType* metaType); - /** + /** * Helper function to find for argument default value */ static QString getDefaultValue(const AbstractMetaFunction* func, const AbstractMetaArgument* arg); |