my $exceptionInit = "WebCore::ExceptionCode ec = 0;";
my $exceptionRaiseOnError = "raiseOnDOMError(ec);";
-
# Default Licence Templates
my $headerLicenceTemplate = << "EOF";
/*
$implIncludes{"DOMImplementationFront.h"} = 1;
}
-
# Add type specific internal types.
$implIncludes{"DOMHTMLInternal.h"} = 1 if ($type =~ /^HTML/);
push(@headerConstants, $output);
}
+
my $combinedConstants = join(",\n", @headerConstants);
# FIXME: the formatting of the enums should line up the equal signs.
my $attributeIsReadonly = ($attribute->type =~ /^readonly/);
my $catagory = $attribute->signature->extendedAttributes->{"ObjCCatagory"};
- # - GETTER
- my $getter = "- (" . $attributeType . ")" . $attributeName . ";\n";
-
- if ($catagory) {
- push(@{ $hashOfCatagories{$catagory} }, $getter);
+ if ($ENV{"MACOSX_DEPLOYMENT_TARGET"} >= 10.5) {
+ my $property = "\@property" . ($attributeIsReadonly ? "(readonly)" : "") . " " . $attributeType . ($attributeType =~ /\*$/ ? "" : " ") . $attributeName . ";\n";
+
+ if ($catagory) {
+ push(@{ $hashOfCatagories{$catagory} }, $property);
+ } else {
+ push(@headerAttributes, $property);
+ }
} else {
- push(@headerAttributes, $getter);
- }
+ # - GETTER
+ my $getter = "- (" . $attributeType . ")" . $attributeName . ";\n";
-
- # - SETTER
- if (!$attributeIsReadonly) {
- my $setter = "- (void)set" . ucfirst($attributeName) . ":(" . $attributeType . ")" . $attributeName . ";\n";
-
if ($catagory) {
- push(@{ $hashOfCatagories{$catagory} }, $setter);
+ push(@{ $hashOfCatagories{$catagory} }, $getter);
} else {
- push(@headerAttributes, $setter);
+ push(@headerAttributes, $getter);
+ }
+
+ # - SETTER
+ if (!$attributeIsReadonly) {
+ my $setter = "- (void)set" . ucfirst($attributeName) . ":(" . $attributeType . ")new" . ucfirst($attributeName) . ";\n";
+
+ if ($catagory) {
+ push(@{ $hashOfCatagories{$catagory} }, $setter);
+ } else {
+ push(@headerAttributes, $setter);
+ }
}
}
}
if (@headerAttributes > 0) {
- push(@headerContent, "\n// Attributes\n");
push(@headerContent, @headerAttributes);
}
}
}
if (@headerFunctions > 0) {
- push(@headerContent, "\n// Methods\n");
+ push(@headerContent, "\n");
push(@headerContent, @headerFunctions);
}
}
# - End @interface
- push(@headerContent, "\n\@end\n");
+ push(@headerContent, "\@end\n");
# Add additional Catagories (if any)
if (scalar(keys(%hashOfCatagories))) {
-
foreach(sort(keys(%hashOfCatagories))) {
my $catagory = $_;
my $implClassName = GetImplClassName($interfaceName);
my $parentImplClassName = GetParentImplClassName($dataNode);
-
my $numAttributes = @{$dataNode->attributes};
my $numFunctions = @{$dataNode->functions};
my $hasFunctionsOrAttributes = $numAttributes + $numFunctions;
if ($hasFunctionsOrAttributes) {
if ($parentImplClassName eq "Object") {
# Only generate 'dealloc' and 'finalize' methods for direct subclasses of DOMObject.
-
push(@implContent, "- (void)dealloc\n");
push(@implContent, "{\n");
push(@implContent, " if (_internal)\n");
push(@implContent, "{\n");
push(@implContent, " return DOM_cast<$implClassName *>(_internal);\n");
push(@implContent, "}\n\n");
-
} else {
-
my $internalBaseType;
if ($interfaceName eq "CSSPrimitiveValue") {
# FIXME: this should be a regex matching CSS...Value.
} else {
$internalBaseType = "WebCore::Node"
}
+
push(@implContent, "- ($implClassName *)$internalCastingName\n");
push(@implContent, "{\n");
push(@implContent, " return static_cast<$implClassName *>(DOM_cast<$internalBaseType *>(_internal));\n");
# - SETTER
if (!$attributeIsReadonly) {
-
# Exception handling
my $hasSetterException = @{$attribute->setterExceptions};
$attributeName = "set" . ucfirst($attributeName);
my $setterName = "set" . ucfirst($interfaceName);
+ my $argName = "new" . ucfirst($interfaceName);
- my $setterSig = "- (void)$setterName:($attributeType)$interfaceName\n";
+ my $setterSig = "- (void)$setterName:($attributeType)$argName\n";
push(@implContent, $setterSig);
push(@implContent, "{\n");
if ($hasSetterException) {
# FIXME: asserts exsist in the exsisting bindings, but I am unsure why they are
# there in the first place;
- push(@implContent, " ASSERT($interfaceName);\n\n");
+ push(@implContent, " ASSERT($argName);\n\n");
push(@implContent, " $exceptionInit\n");
- push(@implContent, " $implementation->$attributeName($interfaceName, ec);\n");
+ push(@implContent, " $implementation->$attributeName($argName, ec);\n");
push(@implContent, " $exceptionRaiseOnError\n");
} else {
- push(@implContent, " $implementation->$attributeName($interfaceName);\n");
+ push(@implContent, " $implementation->$attributeName($argName);\n");
}
push(@implContent, "}\n\n");
if ($returnType eq "void") {
# Special case 'void' return type.
-
my $functionContentHead = "$implementation->$functionName(";
my $functionContentTail = ");";
my $content = "";
} else {
push(@functionContent, " $content\n");
}
-
} else {
-
my $functionContentHead = $implementation . "->" . $functionName . "(";
my $functionContentTail = ")";
}
}
-
if ($raisesExceptions) {
# Differentiated between when the return type is a pointer and
# not for white space issue (ie. Foo *result vs. int result).
push(@implContent, " [NSException raise:NSGenericException format:\@\"createExpression currently does not work with custom NS resolvers\"];\n");
push(@implContent, " DOMNativeXPathNSResolver *nativeResolver = (DOMNativeXPathNSResolver *)$paramName;\n\n");
}
+
push(@implContent, @functionContent);
push(@implContent, "}\n\n");
@implContent = "";
%implIncludes = ();
}
-
+
if (defined($HEADER)) {
# Write content to file.
print $HEADER @headerContentHeader;