[Kde-bindings] branches/work/kdebindings-smoke2

Arno Rehn kde at arnorehn.de
Wed Jul 18 22:59:38 UTC 2007


SVN commit 689711 by arnorehn:

* First steps to implement Richard's proposal of a global
  "class name => smoke module" map.

CCMAIL: kde-bindings at kde.org



 M  +5 -0      ChangeLog  
 M  +3 -0      kalyptus/kalyptusCxxToSmoke.pm  
 M  +9 -0      smoke/smoke.h  


--- branches/work/kdebindings-smoke2/ChangeLog #689710:689711
@@ -1,3 +1,8 @@
+2007-07-19  Arno Rehn  <arno at arnorehn.de>
+
+	* First steps to implement Richard's proposal of a global
+	  "class name => smoke module" map.
+
 2007-07-18  Arno Rehn  <arno at arnorehn.de>
 
 	* Made some more or less final changes to smoke.h
--- branches/work/kdebindings-smoke2/kalyptus/kalyptusCxxToSmoke.pm #689710:689711
@@ -2989,6 +2989,9 @@
 #    print OUT "}\n";
     print OUT "\n";
     my @modules = keys(%parentModules);
+    if ($#modules == 0) { # seems like a module without parents, so initialize Smoke::classMap
+	print OUT "Smoke::StringSmokeMap Smoke::classMap = Smoke::StringSmokeMap();\n\n"
+    }
     for (my $i = 0; $i < $#modules; $i++) {
 	print OUT "Smoke *$modules[$i]_Smoke;\n";
 	print OUT "void init_$modules[$i]_Smoke();\n\n";
--- branches/work/kdebindings-smoke2/smoke/smoke.h #689710:689711
@@ -2,6 +2,8 @@
 #define SMOKE_H
 
 #include <string.h>
+#include <string>
+#include <map>
 
 /*
    Copyright (C) 2002, Ashley Winters <qaqortog at nwlink.com>
@@ -43,6 +45,9 @@
     const char *module_name;
 
 public:
+    typedef std::map<std::string, Smoke*> StringSmokeMap;
+    static StringSmokeMap classMap;
+
     union StackItem; // defined below
     /**
      * A stack is an array of arguments, passed to a method when calling it.
@@ -303,6 +308,10 @@
 
 		    // On initialization this field is 0, so set it now to "this".
 		    parentModules[0] = this;
+
+		    for (Index i = 1; i < numClasses; ++i) {
+			classMap[className(i)] = this;
+		    }
 		}
 
     /**



More information about the Kde-bindings mailing list