aboutsummaryrefslogtreecommitdiffstats
path: root/cppgenerator.h
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-11-04 16:02:47 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-04 16:02:47 -0300
commit35eec1b536db375ca271e8216f857bf9ba333f82 (patch)
tree87663f263d2094b343b73fa7a32bd5de6c31e045 /cppgenerator.h
parentfcf09b6b5f20c43899126db2cf97d26058298caf (diff)
added the CppGenerator::writeArgumentConversion method to be used
on Python method wrappers that should convert from Python arguments to C++ arguments; if implicit conversions are needed code to deallocate any created object is also written.
Diffstat (limited to 'cppgenerator.h')
-rw-r--r--cppgenerator.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/cppgenerator.h b/cppgenerator.h
index af62504dc..3e50d1eb8 100644
--- a/cppgenerator.h
+++ b/cppgenerator.h
@@ -58,6 +58,28 @@ private:
void writeErrorSection(QTextStream& s, OverloadData& overloadData);
void writeTypeCheck(QTextStream& s, const OverloadData* overloadData, QString argumentName);
+ /**
+ * Writes Python to C++ conversions for arguments on Python wrappers.
+ * If implicit conversions, and thus new object allocation, are needed,
+ * code to deallocate a possible new instance is also generated.
+ * \param s text stream to write
+ * \param metatype a pointer to the argument type to be converted
+ * \param context the current meta class
+ * \param argName C++ argument name
+ * \param argName Python argument name
+ */
+ void writeArgumentConversion(QTextStream& s, const AbstractMetaType* argType,
+ QString argName, QString pyArgName,
+ const AbstractMetaClass* context = 0);
+ /// Convenience method to call writeArgumentConversion with an AbstractMetaArgument
+ /// instead of an AbstractMetaType.
+ void writeArgumentConversion(QTextStream& s, const AbstractMetaArgument* arg,
+ QString argName, QString pyArgName,
+ const AbstractMetaClass* context = 0)
+ {
+ writeArgumentConversion(s, arg->type(), argName, pyArgName, context);
+ }
+
void writeOverloadedMethodDecisor(QTextStream& s, OverloadData* parentOverloadData);
void writeMethodCall(QTextStream& s, const AbstractMetaFunction* func, int maxArgs = 0);