[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdebindings/kalyptus
From: Richard Dale <Richard_Dale () tipitina ! demon ! co ! uk>
Date: 2006-01-07 12:36:09
Message-ID: 1136637369.257943.15241.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 495199 by rdale:
* If an enum name clashes with a method name when the method starts with an upper case
letter, then the method starts with a lower case letter.
* C# Enums are now used in method calls rather than ints.
M +23 -8 kalyptusCxxToKimono.pm
--- branches/KDE/3.5/kdebindings/kalyptus/kalyptusCxxToKimono.pm #495198:495199
@@ -234,6 +234,7 @@
'QAbstractSpinBox::StepEnabled' => 'int',
'QDockWidget::DockWidgetFeatures' => 'int',
'QStyle::SubControls' => 'int',
+ 'QSocket::State' => 'int',
);
%operatorNames =
@@ -620,7 +621,12 @@
$node = kdocAstUtil::findRef( $rootnode, $1 );
$item = kdocAstUtil::findRef( $node, $2 ) if defined $node;
if (defined $item && $item->{NodeType} eq 'enum') {
- return "int";
+ if ($2 eq 'Type') {
+ return "$1.E_$2";
+ } else {
+ return "$1.$2";
+ }
+
} elsif (defined $item && ($item->{NodeType} eq 'class' || $item->{NodeType} eq 'struct')) {
return $skippedClasses{$className} ? "" : $2;
}
@@ -2071,9 +2077,21 @@
} elsif ($csharpSignature =~ /copyTo/ and $csharpClassName eq "KDesktopFile" ) {
$altReturnType = "KConfig";
}
-
+
+
if ($name =~ /^([a-z])(.*)/) {
$name = uc($1) . $2;
+
+ # Only change the method name to start with an upper case letter
+ # if it doesn't clash with an enum with the same name
+ my $item = kdocAstUtil::findRef( $classNode, $name );
+ if ( defined $item && $item->{NodeType} eq 'enum' && $name =~ /^([A-Z])(.*)/) {
+ $name = lc($1) . $2;
+ }
+
+ if ($classNode->{astNodeName} eq 'QIODevice' and $name eq 'State') {
+ $name = 'state';
+ }
}
if ( defined $altReturnType ) {
@@ -2173,13 +2191,10 @@
}
$m->{astNodeName} =~ /(.)(.*)/;
- my $item = kdocAstUtil::findRef( $classNode, lc($1) . $2 );
- if ( defined $item && $item->{NodeType} eq 'method' || $m->{astNodeName} eq 'Type') {
- # Enums and capitalized method names share the same namespace in C#, so add
- # 'E_' to the front to avoid a clash.
- $methodCode .= "\t\tenum E_" . $m->{astNodeName} . " {\n";
+ if ($m->{astNodeName} eq 'Type') {
+ $methodCode .= "\t\tpublic enum E_Type {\n";
} else {
- $methodCode .= "\t\tenum " . $m->{astNodeName} . " {\n";
+ $methodCode .= "\t\tpublic enum " . $m->{astNodeName} . " {\n";
}
my @enums = split(",", $m->{Params});
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic