summaryrefslogtreecommitdiffstats
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>2011-02-15 19:35:42 -0200
commitbccea1fb7ca73490c766694cc19f2ca9b43baebb (patch)
tree32c30223e389a47190f8f7bfc1ae3da0304cd79d
parent938c2e314c94acf9ab24999e79464e58d8e8371d (diff)
downloadshiboken-bccea1fb7ca73490c766694cc19f2ca9b43baebb.tar.gz
shiboken-bccea1fb7ca73490c766694cc19f2ca9b43baebb.tar.xz
shiboken-bccea1fb7ca73490c766694cc19f2ca9b43baebb.zip
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 9d509a37..e6fdbda9 100644
--- a/generator/cppgenerator.cpp
+++ b/generator/cppgenerator.cpp
@@ -2244,15 +2244,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), \"";