aboutsummaryrefslogtreecommitdiffstats
path: root/cppgenerator.h
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-01-19 13:58:41 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-01-19 14:36:38 -0300
commit7c53af9664740467c65724577c9210593e308a85 (patch)
tree1718a875154fa7d6fd6d10abe13cd3d1cd478705 /cppgenerator.h
parentcca03574c6a683e9644210d3038775843792f9d7 (diff)
Generator now supports overloads with both static and non-static methods.
When a class contains one or more overloads with static and non-static signatures Python must accept both usages, but for this to work some steps must be taken: * The overload method is defined with its own PyMethodDef structure, instead of being parte of an array of definitions. * The overload method is marked as static in the PyMethodDef. * This method definition is inserted in the PyMethodDef array for the class. * A tp_getattro function is generated and registered for the Python wrapper. It is used to intercept instance calls to methods with static versions to add the 'self' to the PyMethod. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'cppgenerator.h')
-rw-r--r--cppgenerator.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/cppgenerator.h b/cppgenerator.h
index 2648d054b..796273f82 100644
--- a/cppgenerator.h
+++ b/cppgenerator.h
@@ -70,6 +70,8 @@ private:
void writeSbkCopyCppObjectFunction(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeGetattroFunction(QTextStream& s, const AbstractMetaClass* metaClass);
+
/**
* Writes Python to C++ conversions for arguments on Python wrappers.
* If implicit conversions, and thus new object allocation, are needed,
@@ -114,6 +116,7 @@ private:
void writeClassRegister(QTextStream& s, const AbstractMetaClass* metaClass);
void writeClassDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList overloads);
void writeMethodDefinition(QTextStream& s, const AbstractMetaFunctionList overloads);
/// Writes the implementation of all methods part of python sequence protocol
void writeSequenceMethods(QTextStream& s, const AbstractMetaClass* metaClass);