diff dwt/internal/cocoa/NSXMLElement.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSXMLElement.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ * Port to the D Programming language:
+ *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *******************************************************************************/
+module dwt.internal.cocoa.NSXMLElement;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSXMLNode;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSXMLElement : NSXMLNode
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public void addAttribute (NSXMLNode attribute)
+    {
+        OS.objc_msgSend(this.id, OS.sel_addAttribute_1, attribute !is null ? attribute.id : null);
+    }
+
+    public void addChild (NSXMLNode child)
+    {
+        OS.objc_msgSend(this.id, OS.sel_addChild_1, child !is null ? child.id : null);
+    }
+
+    public void addNamespace (NSXMLNode aNamespace)
+    {
+        OS.objc_msgSend(this.id, OS.sel_addNamespace_1, aNamespace !is null ? aNamespace.id : null);
+    }
+
+    public NSXMLNode attributeForLocalName (NSString localName, NSString URI)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeForLocalName_1URI_1, localName !is null ? localName.id : null,
+                URI !is null ? URI.id : null);
+        return result !is null ? new NSXMLNode(result) : null;
+    }
+
+    public NSXMLNode attributeForName (NSString name)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeForName_1, name !is null ? name.id : null);
+        return result !is null ? new NSXMLNode(result) : null;
+    }
+
+    public NSArray attributes ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_attributes);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSArray elementsForLocalName (NSString localName, NSString URI)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_elementsForLocalName_1URI_1, localName !is null ? localName.id : null,
+                URI !is null ? URI.id : null);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public NSArray elementsForName (NSString name)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_elementsForName_1, name !is null ? name.id : null);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public id initWithName_ (NSString name)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1, name !is null ? name.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithName_URI_ (NSString name, NSString URI)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1URI_1, name !is null ? name.id : null, URI !is null ? URI.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithName_stringValue_ (NSString name, NSString string)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1stringValue_1, name !is null ? name.id : null,
+                string !is null ? string.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithXMLString (NSString string, /*NSError** */objc.id** error)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithXMLString_1error_1, string !is null ? string.id : null, error);
+        return result !is null ? new id(result) : null;
+    }
+
+    public void insertChild (NSXMLNode child, NSUInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_insertChild_1atIndex_1, child !is null ? child.id : null, index);
+    }
+
+    public void insertChildren (NSArray children, NSUInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_insertChildren_1atIndex_1, children !is null ? children.id : null, index);
+    }
+
+    public NSXMLNode namespaceForPrefix (NSString name)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_namespaceForPrefix_1, name !is null ? name.id : null);
+        return result !is null ? new NSXMLNode(result) : null;
+    }
+
+    public NSArray namespaces ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_namespaces);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public void normalizeAdjacentTextNodesPreservingCDATA (bool preserve)
+    {
+        OS.objc_msgSend(this.id, OS.sel_normalizeAdjacentTextNodesPreservingCDATA_1, preserve);
+    }
+
+    public void removeAttributeForName (NSString name)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeAttributeForName_1, name !is null ? name.id : null);
+    }
+
+    public void removeChildAtIndex (NSUInteger index)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeChildAtIndex_1, index);
+    }
+
+    public void removeNamespaceForPrefix (NSString name)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeNamespaceForPrefix_1, name !is null ? name.id : null);
+    }
+
+    public void replaceChildAtIndex (NSUInteger index, NSXMLNode node)
+    {
+        OS.objc_msgSend(this.id, OS.sel_replaceChildAtIndex_1withNode_1, index, node !is null ? node.id : null);
+    }
+
+    public NSXMLNode resolveNamespaceForName (NSString name)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_resolveNamespaceForName_1, name !is null ? name.id : null);
+        return result !is null ? new NSXMLNode(result) : null;
+    }
+
+    public NSString resolvePrefixForNamespaceURI (NSString namespaceURI)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_resolvePrefixForNamespaceURI_1, namespaceURI !is null ? namespaceURI.id : null);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public void setAttributes (NSArray attributes)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setAttributes_1, attributes !is null ? attributes.id : null);
+    }
+
+    public void setAttributesAsDictionary (NSDictionary attributes)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setAttributesAsDictionary_1, attributes !is null ? attributes.id : null);
+    }
+
+    public void setChildren (NSArray children)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setChildren_1, children !is null ? children.id : null);
+    }
+
+    public void setNamespaces (NSArray namespaces)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setNamespaces_1, namespaces !is null ? namespaces.id : null);
+    }
+
+}