[Kde-bindings] KDE/kdebindings/kalyptus

Richard Dale Richard_Dale at tipitina.demon.co.uk
Sat Jul 5 12:59:32 UTC 2008


SVN commit 828333 by rdale:

* Make the type signature for slots and signals more similar to those in the moc generated
  code. Remove 'const' and '&' from the arguments, and don't fully resolve the types, just
  use the type as was originally written in the C++ code for the slot.
* Don't resolve typedefs for qint64 and quint64 as they are platform specific and it might
  be necessary to have platform specific marshallers

CCMAIL: kde-bindings at kde.org

 M  +37 -5     kalyptusCxxToKimono.pm  
 M  +3 -1      kalyptusDataDict.pm  


--- trunk/KDE/kdebindings/kalyptus/kalyptusCxxToKimono.pm #828332:828333
@@ -99,8 +99,6 @@
      'KSharedConfig::Ptr&' => '#',
      'KSharedConfigPtr' => '#',
      'KSharedConfigPtr&' => '#',
-     'KSharedPtr<KConfigBackend>' => '#',
-     'KSharedPtr<KConfigBackend>&' => '#',
      'KSycocaEntry::Ptr' => '#',
      'KSycocaEntry::Ptr&' => '#',
      'Plasma::PackageStructure::Ptr' => '#',
@@ -167,7 +165,9 @@
    'KSharedConfigPtr'  =>  'KSharedConfig',
    'AnimId'  =>  'int',
    'Plasma::Phase::AnimId'  =>  'int',
-   'KIO::filesize_t' => 'long'
+   'KIO::filesize_t' => 'long',
+   'long long' => 'long',
+   'unsigned long long' => 'ulong'
 );
 
 # Some classes need extra info in addition to the autogenerated code.
@@ -563,6 +563,8 @@
 		return "long";
 	} elsif ( $cplusplusType eq 'qulonglong') {
 		return "ulong";
+	} elsif ( $cplusplusType =~ /^KSharedPtr<(.*)>&?/) {
+		return $1;
 	} elsif ( $cplusplusType =~ /^QPair<(.*), (.*)>/) {
 		my $generic1 = cplusplusToCSharp($1);
 		my $generic2 = cplusplusToCSharp($2);
@@ -1058,6 +1060,18 @@
 		}
 		else
 		{
+		    if (($m->{Access} =~ /slot/ || $m->{Access} =~ /signal/)
+		        && !(defined($excludeClasses{$className}) && !($m->{Flags} =~ "v"))) {
+                # The Qt moc doesn't distinguish between reference types and value types, but
+				# the smoke runtime does, so register a type with '&', and then strip it off.
+				# Not that registerType() here will do anything much to affect the generated
+				# code
+				my $type = $arg->{ArgType};
+				$type =~ s/^const\s//;
+				registerType( $type );
+				$type =~ s/&//;
+            	$arg->{NormalizedArgType} = $type;
+		    }
 		    # Resolve type in full, e.g. for QSessionManager::RestartHint
 		    # (QSessionManagerJBridge doesn't inherit QSessionManager)
 		    $arg->{ArgType} = kalyptusDataDict::resolveType($arg->{ArgType}, $classNode, $rootnode);
@@ -1716,6 +1730,23 @@
     return $sig;
 }
 
+# Same as methodSignature, but uses the unresolved arguments as found in
+# the original method declaration
+sub slotSignature($$) {
+    my $method = shift;
+    my $last = shift;
+    my $sig = $method->{astNodeName};
+    my @argTypeList;
+    my $argId = 0;
+    foreach my $arg ( @{$method->{ParamList}} ) {
+	last if $argId > $last;
+	push @argTypeList, $arg->{NormalizedArgType};
+	$argId++;
+    }
+    $sig .= "(". join(", ", at argTypeList) .")";
+    return $sig;
+}
+
 # Return the string containing the signature for this method (without return type).
 # If the 2nd arg is not the size of $m->{ParamList}, this method returns a
 # partial signature (this is used to handle default values).
@@ -2210,6 +2241,7 @@
 	local($") = ",";
 	my $argsSignature = argsSignature( $m, $#argTypeList );
 	my $signature = methodSignature( $m, $#argTypeList );
+	my $slotSignature = slotSignature( $m, $#argTypeList );
 	my $mungedSignature = mungedSignature( $m, $#argTypeList );
 	my $mungedMethod = $m->{astNodeName} . $mungedSignature;
 	my $csharpparams = join( ", ", @csharpArgTypeList );
@@ -2434,7 +2466,7 @@
 				}
 
 				if ( $m->{Access} =~ /_slots/ && !$isStatic )  {
-					$methodCode .= "\t\t[Q_SLOT(\"". $m->{ReturnType} . " $signature" . "\")]\n";
+					$methodCode .= "\t\t[Q_SLOT(\"". $m->{ReturnType} . " $slotSignature" . "\")]\n";
 				}
 
 				my $overridenVirtualMethod = $virtualMethods->{$signature}{method};
@@ -2553,7 +2585,7 @@
 						my $csharpdocComment = printCSharpdocComment( $docnode, "", "\t\t/// ", "" );
 						$signalCode .=  $csharpdocComment unless $csharpdocComment =~ /^\s*$/;
 					}
-					$signalCode .= "\t\t[Q_SIGNAL(\"" . $m->{ReturnType} . " $signature" . "\")]\n";
+					$signalCode .= "\t\t[Q_SIGNAL(\"" . $m->{ReturnType} . " $slotSignature" . "\")]\n";
 	    			$signalCode .= "\t\tvoid $name($csharpparams);\n";
 				}
 			}
--- trunk/KDE/kdebindings/kalyptus/kalyptusDataDict.pm #828332:828333
@@ -3055,7 +3055,9 @@
 	    && $argType !~ /Display/
 	    && $argType !~ /KMD5::Digest/
 	    && $argType !~ /K_UID/
-	    && $argType !~ /K_GID/ )
+	    && $argType !~ /K_GID/
+	    && $argType !~ /filesize_t/
+	    && $argType !~ /qreal|qint64|quint64|qlonglong|qulonglong/ )
 	{
 		return $prefix.resolveType($node->{Type}, $node, $rootnode, $argType).$suffix;
 	} else {



More information about the Kde-bindings mailing list