aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-15 19:17:08 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:13:54 -0300
commitf64bae8cf884845d045ff09f8bc93fd80beb4da8 (patch)
tree5f2e183bc5e352abd61900d08a3a0ffe0d1d205b
parent97b09244d0361296bae44c3ee63a1d2b2957d07f (diff)
Add support to the remove attribute of reference-count tag.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Luciano Wolf <luciano.wolf@openbossa.org>
-rw-r--r--generator/cppgenerator.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/generator/cppgenerator.cpp b/generator/cppgenerator.cpp
index 055cf5783..a2623c34e 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -2246,15 +2246,23 @@ void CppGenerator::writeMethodCall(QTextStream& s, const AbstractMetaFunction* f
} else if (!refcount_mods.isEmpty()) {
foreach (ArgumentModification arg_mod, refcount_mods) {
- if (arg_mod.referenceCounts.first().action != ReferenceCount::Set) {
- ReportHandler::warning("\"set\" is the only value supported by Shiboken for action attribute of reference-count tag.");
+ ReferenceCount refCount = arg_mod.referenceCounts.first();
+ if (refCount.action != ReferenceCount::Set
+ && refCount.action != ReferenceCount::Remove) {
+ ReportHandler::warning("\"set\" and \"remove\" are the only values supported by Shiboken for action attribute of reference-count tag.");
continue;
}
const AbstractMetaClass* wrappedClass = 0;
- QString pyArgName = argumentNameFromIndex(func, arg_mod.index, &wrappedClass);
- if (pyArgName.isEmpty()) {
- s << "#error Invalid reference count modification for argument " << arg_mod.index << endl << endl;
- break;
+
+ QString pyArgName;
+ if (refCount.action == ReferenceCount::Remove) {
+ pyArgName = "Py_None";
+ } else {
+ pyArgName = argumentNameFromIndex(func, arg_mod.index, &wrappedClass);
+ if (pyArgName.isEmpty()) {
+ s << "#error Invalid reference count modification for argument " << arg_mod.index << endl << endl;
+ break;
+ }
}
s << INDENT << "Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(self), \"";