[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/kdom/bindings
From:       Nikolas Zimmermann <wildfox () kde ! org>
Date:       2005-08-09 23:36:29
Message-ID: 1123630589.314511.22805.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 444385 by wildfox:

* Include module in resulting string when determining topmost base class.
* Centralize dom exception in one string, use it everywhere (include namespace \
again...)

Two last cases have to be done, to get svg generation workin' again.
I am aware and will fix them ASAP

CCMAIL: buis@kde.org


 M  +8 -6      IDLCodeGenerator.pm  
 M  +24 -7     IDLCodeGeneratorCpp.pm  
 M  +1 -1      IDLStructure.pm  


--- trunk/kdenonbeta/kdom/bindings/IDLCodeGenerator.pm #444384:444385
@@ -76,7 +76,7 @@
 
 	my $object = shift;
 	my $interface = shift;
-	$interface =~ s/[a-zA-Z0-9]*:://; # Strip namespace.
+	$interface =~ s/[a-zA-Z0-9]*:://; # Strip module.
 
 	my $topBaseClass = "";
 	
@@ -102,18 +102,20 @@
 			foreach(@{$document->classes}) {
 				my $class = $_;
 
-				if($class->name eq $interface) {
+				my $useInterface = $interface;
+
+				if($class->name eq $useInterface) {
 					my @parents = @{$class->parents};
 					my $parentsMax = @{$class->parents};
 
 					$interface = "";
 
 					# Exception: For the DOM 'Node' is our topmost baseclass, not EventTarget.
-					if(($parentsMax > 0) and ($parents[0] ne "EventTarget")) {
+					if(($parentsMax > 0) and ($parents[0] ne "events::EventTarget")) {
 						$interface = $parents[0];
-						$interface =~ s/[a-zA-Z0-9]*:://; # Strip namespace.
-					} elsif(!$class->noDPtrFlag) {
-						$topBaseClass = $class->name;
+						$interface =~ s/[a-zA-Z0-9]*:://; # Strip module;
+					} elsif(!$class->noDPtrFlag) { # Include 'module' ...
+						$topBaseClass = $document->module . "::" . $class->name;
 					}
 				}	
 			}
--- trunk/kdenonbeta/kdom/bindings/IDLCodeGeneratorCpp.pm #444384:444385
@@ -106,9 +106,19 @@
 	my $topBaseClass = "";
 
 	# Exception: For the DOM 'Node' is our topmost baseclass, not EventTarget.
-	if(($parentsMax > 0) and ($parents[0] ne "EventTarget")) { # Determine topmost \
                baseclass, if needed
-		$topBaseClass = $codeGenerator->FindTopBaseClass($parents[0]);
-		if($topBaseClass ne "") {
+	if(($parentsMax > 0) and ($parents[0] ne "events::EventTarget")) { # Determine \
topmost baseclass, if needed +		my %firstParentType = \
$object->ExtractNamespace($parents[0], 1); +
+		$topBaseClass = $codeGenerator->FindTopBaseClass($firstParentType{'type'});
+		my %baseClassType = $object->ExtractNamespace($topBaseClass, 1);
+
+		if($baseClassType{'type'} ne "") {
+			if(($baseClassType{'namespace'} ne "") and ($baseClassType{'namespace'} ne \
$useModuleNS)) { +				$topBaseClass = $baseClassType{'namespace'} . "::" . \
$baseClassType{'type'}; +			} else {
+				$topBaseClass = $baseClassType{'type'};
+			}
+
 			print "  |  |----> Determined \"$topBaseClass\" as topmost baseclass!\n  |  |\n";
 		}
 	}
@@ -135,6 +145,7 @@
 sub GenerateHeader
 {
 	my $object = shift;
+
 	my $dataNode = shift;
 	my $topBaseClass = shift;
 
@@ -486,6 +497,13 @@
 		$dptrCheck = "\tif(!impl)\n\t";
 	}
 
+	my $notFoundException = "throw new ";
+	if($useModuleNS !~ /^KDOM.*/) {
+		$notFoundException .= "KDOM::DOMExceptionImpl(KDOM::NOT_FOUND_ERR);";
+	} else {
+		$notFoundException .= "DOMExceptionImpl(NOT_FOUND_ERR);";
+	}
+
 	# - Add 'impl' define & null object
 	push(@implContent, "\n#define impl (static_cast<" . $extractedType{'type'} . "Impl \
*>($dptrAccessor))\n");  push(@implContent, "\n" . $extractedType{'type'} . " " . \
$extractedType{'type'} . "::null;\n\n"); @@ -557,8 +575,7 @@
 		my $retName = $object->ReturnStringForType($attribute->signature->type, "impl->" .
 					  $attribute->signature->name . "()");
 
-		$attributeString .= "$dptrCheck\tthrow new DOMExceptionImpl(NOT_FOUND_ERR);" .
-							"\n\n\treturn $retName\n}\n";
+		$attributeString .= "$dptrCheck\t$notFoundException\n\n\treturn $retName\n}\n";
 
 		if($attribute->type eq "attribute") { # Read-write accessors!
 			my $name = $attribute->signature->name; $name = ucfirst($name);
@@ -572,7 +589,7 @@
 			my $nameString = $attribute->signature->name;
 			$nameString .= ".handle()" if($type =~ /const/);
 
-			$attributeString .= "$dptrCheck\tthrow new DOMExceptionImpl(NOT_FOUND_ERR);\n\n" \
. +			$attributeString .= "$dptrCheck\t$notFoundException\n\n" .
 								"\timpl->set$name($nameString);\n}\n";
 		}
 
@@ -610,7 +627,7 @@
 		my $name = $object->ReturnStringForType($function->signature->type, "impl->" .
 												$function->signature->name . "($valueString)");
 
-		$functionString .= ")\n{\n$dptrCheck\tthrow new \
DOMExceptionImpl(NOT_FOUND_ERR);\n\n\treturn $name\n}"; +		$functionString .= \
")\n{\n$dptrCheck\t$notFoundException\n\n\treturn $name\n}";  
 		$functionString .= "\n" if($j++ < $functionMax - 1);
 		push(@implContent, $functionString);
--- trunk/kdenonbeta/kdom/bindings/IDLStructure.pm #444384:444385
@@ -15,7 +15,7 @@
 
 # Used to represent 'interface' / 'exception' blocks
 struct( domClass => {
-		name => '$',		# Class identifier (include namespace)
+		name => '$',		# Class identifier (without module)
 		parents => '@',		# List of strings
 		constants => '@',	# List of 'domConstant'
 		functions => '@',	# List of 'domFunction'


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic