aboutsummaryrefslogtreecommitdiffstats
path: root/shibokengenerator.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-11-27 19:50:48 -0200
committerHugo Lima <hugo.lima@openbossa.org>2009-11-30 13:56:28 -0200
commit0986fe76a6caedcd77d0334efe2c09e38ff2a087 (patch)
tree133dbba6ded11b80bdb6b06b9a57124df7123ebf /shibokengenerator.cpp
parent78bf7bca1fe92052ae7b64827ae81bbe25bd8c3d (diff)
Add the generator flag "enable-parent-ctor-heuristic".
When enabled, this heuristic will check every constructor for an argument named "parent", if the argument is a pointer, then it'll be the parent of this object.
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r--shibokengenerator.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index 5b6734cbf..e4d207c8a 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -29,7 +29,7 @@
#include <limits>
#define NULL_VALUE "NULL"
-#define COMMENT_LINE_WIDTH 77
+#define PARENT_CTOR_HEURISTIC "enable-parent-ctor-heuristic"
static Indentor INDENT;
//static void dumpFunction(AbstractMetaFunctionList lst);
@@ -1180,8 +1180,21 @@ QPair< int, int > ShibokenGenerator::getMinMaxArguments(const AbstractMetaFuncti
return qMakePair(minArgs, maxArgs);
}
+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.");
+ return opts;
+}
+
bool ShibokenGenerator::doSetup(const QMap<QString, QString>& args)
{
+ m_useCtorHeuristic = args.contains(PARENT_CTOR_HEURISTIC);
return true;
}
+bool ShibokenGenerator::useCtorHeuristic() const
+{
+ return m_useCtorHeuristic;
+}
+