aboutsummaryrefslogtreecommitdiffstats
path: root/shibokengenerator.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2010-02-02 11:43:52 -0200
committerHugo Lima <hugo.lima@openbossa.org>2010-02-02 14:32:58 -0200
commit8fb11ea5ff063f23785ac4ce7e1f3187ae0aa774 (patch)
tree6f31e3b314fce10706439f3c3ffb2c86ffadd65c /shibokengenerator.cpp
parent7bed51517c9bcb9e5f152751b1a3c43d71682f55 (diff)
Implement return value heuristic.
If the method returns a pointer and there are no policies for the return type, the returned value is considered child of the current object (self). Reviewed by Renato Araújo <renato.filho@openbossa.org>
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r--shibokengenerator.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 078c33938..83ccbc33c 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -31,6 +31,7 @@
#define NULL_VALUE "NULL"
#define PARENT_CTOR_HEURISTIC "enable-parent-ctor-heuristic"
+#define RETURN_VALUE_HEURISTIC "enable-return-value-heuristic"
#define ENABLE_PYSIDE_EXTENSIONS "enable-pyside-extensions"
static Indentor INDENT;
@@ -1208,6 +1209,7 @@ QMap<QString, QString> ShibokenGenerator::options() const
{
QMap<QString, QString> opts(Generator::options());
opts.insert(PARENT_CTOR_HEURISTIC, "Enable heuristics to detect parent relationship on constructors.");
+ opts.insert(RETURN_VALUE_HEURISTIC, "Enable heuristics to detect parent relationship on return values (USE WITH CAUTION!)");
opts.insert(ENABLE_PYSIDE_EXTENSIONS, "Enable PySide extensions, such as support for signal/slots, use this if you are creating a binding for a Qt-based library.");
return opts;
}
@@ -1216,6 +1218,7 @@ bool ShibokenGenerator::doSetup(const QMap<QString, QString>& args)
{
m_useCtorHeuristic = args.contains(PARENT_CTOR_HEURISTIC);
m_usePySideExtensions = args.contains(ENABLE_PYSIDE_EXTENSIONS);
+ m_userReturnValueHeuristic = args.contains(RETURN_VALUE_HEURISTIC);
return true;
}
@@ -1224,6 +1227,11 @@ bool ShibokenGenerator::useCtorHeuristic() const
return m_useCtorHeuristic;
}
+bool ShibokenGenerator::useReturnValueHeuristic() const
+{
+ return m_userReturnValueHeuristic;
+}
+
bool ShibokenGenerator::usePySideExtensions() const
{
return m_usePySideExtensions;