[Kde-bindings] KDE/kdebindings/kalyptus

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sun Jan 21 10:09:34 UTC 2007


SVN commit 625814 by rdale:

* Added a table of classes which need to be defined as partial classes
* Fixed a bug in code generation for template based arg types with QString
  or QStringList in them.
* 'operator<<' and 'operator>>' methods are no longer converted to C# operator
  methods, but op_read() and op_write() instead. They are also no longer 
  converted from instance methods to static methods.

CCMAIL: kde-bindings at kde.org



 M  +30 -15    kalyptusCxxToKimono.pm  
 M  +3 -0      kalyptusCxxToSmoke.pm  


--- trunk/KDE/kdebindings/kalyptus/kalyptusCxxToKimono.pm #625813:625814
@@ -45,7 +45,7 @@
 	$kapplicationExtras $kmainwindowExtras
 	$methodNumber
 	%builtins %typeunion %allMethods %allTypes %enumValueToType %typedeflist %arraytypeslist %mungedTypeMap %csharpImports
-	%skippedClasses %operatorNames /;
+	%skippedClasses %partial_classes %operatorNames /;
 
 BEGIN
 {
@@ -268,6 +268,15 @@
    'ViewItemFeatures' => 'int',
 );
 
+# Some classes need extra info in addition to the autogenerated code.
+# So they are split into two sources FooBar.cs and FooBarExtras.cs
+# with the 'partial' modifier in the class definition
+%partial_classes =
+(
+   'QVariant' => '1',
+   'QDBusConnectionInterface' => '1',
+);
+
 %operatorNames =
 (
     'operator^' => 'op_xor',
@@ -726,7 +735,7 @@
 		return "out short";
 	} elsif ( $cplusplusType =~ /KCmdLineOptions/ ) {
 		return "string[][]";	
-	} elsif ( $cplusplusType =~ /char\s*\*\*/ || $cplusplusType =~ /QStringList/|| $cplusplusType =~ /QStrList/) {
+	} elsif ( $cplusplusType =~ /char\s*\*\*/ || $cplusplusType =~ /^[^<]*QStringList/|| $cplusplusType =~ /QStrList/) {
 		return "string[]";
 	} elsif ( $arraytypeslist{$cplusplusType} ) {
 		return "ArrayList"
@@ -753,7 +762,7 @@
 		return "char[]";
 	} elsif ( $cplusplusType =~ /QC?String/ and !$isConst ) {
 		return "StringBuilder"
-	} elsif ( $cplusplusType =~ /(DOM::)?DOMString/ || $cplusplusType =~ /QString/ || $cplusplusType =~ /QCString/ || kalyptusDataDict::ctypemap($cplusplusType) =~ /^(const )?char\s*\*/ ) {
+	} elsif ( $cplusplusType =~ /(DOM::)?DOMString/ || $cplusplusType =~ /^[^<]*QString/ || $cplusplusType =~ /QCString/ || kalyptusDataDict::ctypemap($cplusplusType) =~ /^(const )?char\s*\*/ ) {
 		return "string"
 	} elsif ( $cplusplusType =~ /QChar\s*[&\*]?/ || $cplusplusType =~ /^char$/ ) {
 		return "char"
@@ -1554,7 +1563,11 @@
 			$classdec .= "\t\t\t}\n";
 			$classdec .= "\t\t}\n";
 		} else {
-			$classdec .= "\tpublic class $csharpClassName : MarshalByRefObject";
+			if ( $partial_classes{$csharpClassName} ) {
+				$classdec .= "\tpublic partial class $csharpClassName : MarshalByRefObject";
+			} else {
+				$classdec .= "\tpublic class $csharpClassName : MarshalByRefObject";
+			}
 			if ( defined interfaceForClass($csharpClassName) ) {
 				$classdec .= ", " . interfaceForClass($csharpClassName);
 			}
@@ -1569,7 +1582,11 @@
 		}
 	} else {
 		$classdec = "\t[SmokeClass(\"$className\")]\n";
-		$classdec .= "\tpublic class $csharpClassName : ";
+		if ( $partial_classes{$csharpClassName} ) {
+			$classdec .= "\tpublic partial class $csharpClassName : ";
+		} else {
+			$classdec .= "\tpublic class $csharpClassName : ";
+		}
 		my $ancestor;
 		foreach $ancestor ( @ancestors ) {
 			if ( !defined interfaceForClass($ancestor) or $ancestor eq @ancestors[$#ancestors] ) {
@@ -2302,7 +2319,7 @@
 	
 		my $access = $m->{Access};
 		$access =~ s/_slots//;
-	    
+
 		if ($isConstructor) {
 			if ( $generateConstructors ) {
 #				$proxyInterfaceCode .= "\t\t\tvoid new$csharpClassName($csharpparams);\n";
@@ -2317,7 +2334,7 @@
 				$methodCode .= "\t\t\tProxy$csharpClassName().New$csharpClassName(@csharpArgList[0..$#csharpArgTypeList]);\n";
 				$methodCode .= "\t\t}\n";
 			}
-		} elsif ($name =~ /^operator.*/) {
+		} elsif ( $name =~ /^operator.*/ && $name ne 'operator<<' && $name ne 'operator>>' ) {
 			$name =~ s/ //;
 			$name =~ s!([|&*/+^-])=!$1!;
 			if (!$isStatic) {
@@ -2334,15 +2351,10 @@
 			$methodCode .= "\t\t" . $access . " static ";
 			$methodCode .= $csharpReturnType;
 			
-			if ($classNode->{astNodeName} eq $main::globalSpaceClassName
-				|| $name eq 'operator<<' 
-				|| $name eq 'operator>>' ) 
-			{
+			if ($classNode->{astNodeName} eq $main::globalSpaceClassName) {
 				# In C# an operator method must be in the same class as its first operand,
 				# so any operator methods in QGlobalSpace must be left as ordinary method
 				# calls. eg op_write()
-				# 'operator<<' and 'operator>>' can only have int types as the second
-				# arg in C#, so convert them to op_read() and op_write() calls
 	    		$methodCode .= " $operatorNames{$name}($csharpparams) \{\n";
 			} else {
 	    		$methodCode .= " $name($csharpparams) \{\n";
@@ -2423,8 +2435,11 @@
 	    			$altReturnType = "KConfig";
 				}
 
-
-				if ($name =~ /^([a-z])(.*)/) {
+				if ($name eq 'operator<<' || $name eq 'operator>>') {
+					# 'operator<<' and 'operator>>' can only have int types as the second
+					# arg in C#, so convert them to op_read() and op_write() calls
+					$name = $operatorNames{$name}
+				} elsif ($name =~ /^([a-z])(.*)/) {
 					if ($name ne 'type') {
 						$name = uc($1) . $2;
 					}
--- trunk/KDE/kdebindings/kalyptus/kalyptusCxxToSmoke.pm #625813:625814
@@ -384,6 +384,7 @@
 	    ($className eq 'QSysInfo' and $main::qt4) ||
 	    ($className eq 'QPNGImageWriter' and $main::qt4) ||
 	    ($className eq 'QPNGImagePacker' and $main::qt4) ||
+	    ($className eq 'QSqlRelationalDelegate' and $main::qt4) ||
 	    ($className eq 'QTextCodec::ConverterState' and $main::qt4) ||
 	    ($className eq 'QTextLayout::Selection' and $main::qt4) ||
 	    ($className eq 'QTextStreamManipulator' and $main::qt4) ||
@@ -748,6 +749,8 @@
 				|| ($classNode->{astNodeName} eq 'QDBusBusService' and $name eq 'requestName')
 				|| ($classNode->{astNodeName} eq 'QGLFormat' and $name eq 'openGLVersionFlags')
 				|| ($classNode->{astNodeName} eq 'QAbstractUndoItem' and $name eq '~QAbstractUndoItem')
+				|| ($classNode->{astNodeName} eq 'QApplication' and $name eq 'setKeypadNavigationEnabled')
+				|| ($classNode->{astNodeName} eq 'QApplication' and $name eq 'keypadNavigationEnabled')
 				|| ($name eq 'qDBusMetaTypeId')
 				|| ($m->{ReturnType} =~ /template/)
 				|| ($m->{ReturnType} =~ /QT3_SUPPORT/) ) )



More information about the Kde-bindings mailing list