[Kde-bindings] KDE/kdebindings/kalyptus

Arno Rehn kde at arnorehn.de
Sun Jun 29 00:17:38 UTC 2008


SVN commit 825689 by arnorehn:

* Better resolve enum-types in templates.
  Thanks to Andre Barboza for the bug report.

CCMAIL: kde-bindings at kde.org



 M  +1 -0      ChangeLog  
 M  +39 -1     kalyptusDataDict.pm  


--- trunk/KDE/kdebindings/kalyptus/ChangeLog #825688:825689
@@ -1,6 +1,7 @@
 2008-06-28  Arno Rehn  <arno at arnorehn.de>
 
 	* Resolve typedefs in kalyptus.
+	* Better resolve enum-types in templates. Thanks to Andre Barboza for the bug report.
 
 2008-06-19  Arno Rehn  <arno at arnorehn.de>
 
--- trunk/KDE/kdebindings/kalyptus/kalyptusDataDict.pm #825688:825689
@@ -2921,11 +2921,49 @@
 	    my $tmpl = $2;
             my $before = $`.$1;
             my $after = $';
+            $before = resolveType( $before, $contextClass, $rootnode );
+            my $tmplNode = kdocAstUtil::findRef( $rootnode, $before );
+            my $tmplType;
+            my @tmplTypeList;
+			if ($tmplNode) {
+				$tmplType = $tmplNode->{Tmpl};
+				$tmplType =~ s/^template//;
+				$tmplType =~ s/^\s+//;
+				@tmplTypeList = kdocUtil::splitUnnested( ',', $tmplType );
+				for my $t(@tmplTypeList) {
+					$t =~ s/\s.*//;
+				}
+			}
             my @args = kdocUtil::splitUnnested( ',', $tmpl);
             grep s/^\s+//, @args;
             grep s/\s+$//, @args;
+            my $i = 0;
             for my $a(@args) {
-		$a = resolveType( $a, $contextClass, $rootnode );
+		# ok, this gets tricky
+		# check if the template type is a class, struct or enum
+		if ($tmplTypeList[$i] eq 'class' || $tmplTypeList[$i] eq 'struct'
+		    || $tmplTypeList[$i] eq 'enum' || $tmplTypeList[$i] eq 'typename'
+		    || $tmplTypeList[$i] eq '')
+		{
+			$a = resolveType( $a, $contextClass, $rootnode );
+		} else {
+			# no, it's a typename
+			my $tmp = resolveType( $tmplTypeList[$i], $contextClass, $rootnode );
+			$tmp =~ s/\s*([\&\*]+)$// ? $1 : ''; # strip * and &
+			my $ref = kdocAstUtil::findRef( $rootnode, $tmp );
+			# for the moment we're only interested in enums
+			if ($ref && $ref->{NodeType} eq 'enum') {
+				if ($tmp =~ /::/) {
+					my @list = split('::', $tmp);
+					pop @list;
+					$tmp = join('::', @list);
+				}
+				$a = $tmp.'::'.$a;
+			} else {
+				$a = resolveType( $a, $contextClass, $rootnode );
+			}
+		}
+		$i++;
             }
             # normalize
 	    $argType = $before."<".join( ", ", @args).">".$after;



More information about the Kde-bindings mailing list