view dwt/internal/cocoa/NSXMLElement.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
line wrap: on
line source

/*******************************************************************************
 * 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);
    }

}