[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    [Kde-bindings]
From:       Arno Rehn <kde () arnorehn ! de>
Date:       2010-07-05 14:51:45
Message-ID: 20100705150120.5B539AC7E2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1146236 by arnorehn:

make x_classes inherit from __internal_SmokeClass to flag them as a smoke class.
Then use a dynamic_cast<__internal_SmokeClass*> to check whether a class was created \
by smoke or not. this will increase the overhead, but it's the only alternative to \
adding all inherited virtual methods to the smoke classes.

Fixes bug reported by Stefano Crocco. Thanks for reporting!

CCMAIL: kde-bindings@kde.org

 M  +6 -3      writeClasses.cpp  


--- branches/KDE/4.5/kdebindings/generator/generators/smoke/writeClasses.cpp \
#1146235:1146236 @@ -80,6 +80,8 @@
 
         fileOut << "\n#include <smoke.h>\n#include <" << Options::module << \
"_smoke.h>\n";  
+        fileOut << "\nclass __internal_SmokeClass { public: virtual \
~__internal_SmokeClass() {} };\n"; +
         fileOut << "\nnamespace __smoke" << Options::module << " {\n\n";
 
         // now the class code
@@ -194,7 +196,7 @@
     } else {
         // This is a virtual method. To know whether we should call with dynamic \
dispatch, we need a bit of RTTI magic.  includes.insert("typeinfo");
-        out << "        if (typeid(*this) == typeid(" << smokeClassName << ")) {\n"; \
// +        out << "        if (dynamic_cast<__internal_SmokeClass*>(static_cast<" << \
className << "*>(this))) {\n";   //  out << generateMethodBody("            ",   // \
                indent
                                   className, smokeClassName, meth, index, false, \
includes);  out << "        } else {\n";
@@ -363,8 +365,9 @@
     QTextStream switchOut(&switchCode);
 
     out << QString("class %1").arg(smokeClassName);
-    if (!klass->isNameSpace())
-        out << QString(" : public %1").arg(className);
+    if (!klass->isNameSpace()) {
+        out << QString(" : public %1, public __internal_SmokeClass").arg(className);
+    }
     out << " {\n";
     if (Util::canClassBeInstanciated(klass)) {
         out << "    SmokeBinding* _binding;\n";
_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic