diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2010-02-04 16:59:22 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2010-02-04 17:04:50 -0200 |
commit | 46ea7e162321028a786dfc02cc8325cb20f2d957 (patch) | |
tree | 00bff4bea741c5dd0488826f6252d9d5a8b5d057 /shibokengenerator.cpp | |
parent | 9e080452addad7853b41f416a0fb66d3d74a292a (diff) |
When used inside a static function, %CPPSELF will be replaced by the
class type, and %CPPSELF. by "<Class Type>::"
Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'shibokengenerator.cpp')
-rw-r--r-- | shibokengenerator.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp index 1b4d6e9e8..1ee65d94e 100644 --- a/shibokengenerator.cpp +++ b/shibokengenerator.cpp @@ -871,11 +871,16 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s, // replace template variable for pointer to C++ this object if (func->implementingClass()) { QString cppSelf; - if (snip.language == TypeSystem::NativeCode) + QString replacement("%1->"); + if (func->isStatic()) { + cppSelf = func->ownerClass()->qualifiedCppName(); + replacement = "%1::"; + } else if (snip.language == TypeSystem::NativeCode) { cppSelf = "this"; - else + } else { cppSelf = "cppSelf"; - code.replace("%CPPSELF.", QString("%1->").arg(cppSelf)); + } + code.replace("%CPPSELF.", replacement.arg(cppSelf)); code.replace("%CPPSELF", cppSelf); // replace template variable for the Python Type object for the |