[Kde-bindings] KDE/kdebindings/kalyptus

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Jan 18 18:31:52 UTC 2007


SVN commit 625023 by rdale:

* Make a start changing the code generation to have generic List<type> instead
  of ArrayLists
* Make Qt::ToolBarAreas a C# enum in arguments, rather than an int

CCMAIL: kde-bindings at kde.org



 M  +13 -5     kalyptusCxxToKimono.pm  


--- trunk/KDE/kdebindings/kalyptus/kalyptusCxxToKimono.pm #625022:625023
@@ -223,7 +223,6 @@
    'Qt::KeyboardModifiers' => 'int',
    'Qt::MatchFlags' => 'int',
    'Qt::MouseButtons' => 'int',
-   'Qt::ToolBarAreas' => 'int',
    'Qt::WindowFlags' => 'int',
    'Qt::WindowStates' => 'int',
    'RenderFlags' => 'int',
@@ -681,6 +680,8 @@
 		return "";
 	} elsif ( cplusplusToCSharp($classname_ptr) eq "ArrayList" ) {
 		return "System.Collections";
+	} elsif ( cplusplusToCSharp($classname_ptr) =~ /^List</ ) {
+		return "System.Collections.Generic";
 	} elsif ( cplusplusToCSharp($classname_ptr) eq "StringBuilder" ) {
 		return "System.Text";
 	} elsif ( cplusplusToCSharp($classname_ptr) eq "string" ) {
@@ -1501,7 +1502,7 @@
 	} else {
 		if ( $className eq 'QListView' or $className eq 'QListViewItem' or $className eq 'QUriDrag' ) {
 			# Special case these two classes as they have methods that use ArrayList added as 'extras'
-	    	print CLASS "\tusing System.Collections;\n";
+	    	print CLASS "\tusing System.Collections.Generic;\n";
 		}
 
 		if ( $className eq 'QObject' ) {
@@ -1919,6 +1920,8 @@
 	else {
 		if ( cplusplusToCSharp($it) eq 'ArrayList' ) {
 			$addImport->{"System.Collections"} = 1;
+		} elsif ( cplusplusToCSharp($it) =~ /^List</ ) {
+			$addImport->{"System.Collections.Generic"} = 1;
 		} else {
 			print " No import found for $type\n" if ($debugCI); 
 		} 
@@ -2209,6 +2212,10 @@
 	if ( $csharpReturnType =~ s/string\[\]/ArrayList/ ) {
 		$addImport->{"System.Collections"} = 1;
 	}
+
+	if ( $csharpReturnType =~ s/string\[\]/List<string>/ ) {
+		$addImport->{"System.Collections.Generic"} = 1;
+	}
 	
 	if ($m->{ReturnType} =~ /^int\&/) {
 		$csharpReturnType = 'int';
@@ -3877,9 +3884,10 @@
 		if ($node->{NodeType} eq "Param") {
 			$line =~ s/(const )?QC?StringList(\s*&)?/string[]/g;
 		} else {
-			$line =~ s/(const )?QC?StringList(\s*&)?/ArrayList/g;
+			$line =~ s/(const )?QC?StringList(\s*&)?/List<string>/g;
 		}
-		$line =~ s/NodeList|KTrader::OfferList/ArrayList/g;
+		$line =~ s/NodeList/ArrayList/g;
+		$line =~ s/KTrader::OfferList/ArrayList/g;
 		$line =~ s/QString::null/null/g;
 		$line =~ s/(const )?QC?String(\s*&)?/string/g;
 		$line =~ s/(const )?KCmdLineOptions\s*(\w+)\[\]/string[][] $2/;
@@ -3982,7 +3990,7 @@
 	$returntext =~ s/KParts#([A-Z])/$1/g;
 	$returntext =~ s/const\s+(\w+)\s*\&/$1/g;
 	$returntext =~ s/QChar/char/g;
-	$returntext =~ s/QStringList/ArrayList/g;
+	$returntext =~ s/QStringList/List<string>/g;
 	$returntext =~ s/([Aa]) ArrayList/$1n ArrayList/g;
 	$returntext =~ s/QString/string/g;
 	$returntext =~ s/KCmdLineOptions/string[][]/;



More information about the Kde-bindings mailing list