view dwt/internal/cocoa/NSXMLNode.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 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.NSXMLNode;

import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSDictionary;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSObject;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSXMLDocument;
import dwt.internal.cocoa.NSXMLElement;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

enum NSXMLNodeKind : NSUInteger
{
    NSXMLInvalidKind = 0,
    NSXMLDocumentKind,
    NSXMLElementKind,
    NSXMLAttributeKind,
    NSXMLNamespaceKind,
    NSXMLProcessingInstructionKind,
    NSXMLCommentKind,
    NSXMLTextKind,
    NSXMLDTDKind,
    NSXMLEntityDeclarationKind,
    NSXMLAttributeDeclarationKind,
    NSXMLElementDeclarationKind,
    NSXMLNotationDeclarationKind
}

alias NSXMLNodeKind.NSXMLInvalidKind NSXMLInvalidKind;
alias NSXMLNodeKind.NSXMLDocumentKind NSXMLDocumentKind;
alias NSXMLNodeKind.NSXMLElementKind NSXMLElementKind;
alias NSXMLNodeKind.NSXMLAttributeKind NSXMLAttributeKind;
alias NSXMLNodeKind.NSXMLNamespaceKind NSXMLNamespaceKind;
alias NSXMLNodeKind.NSXMLProcessingInstructionKind NSXMLProcessingInstructionKind;
alias NSXMLNodeKind.NSXMLCommentKind NSXMLCommentKind;
alias NSXMLNodeKind.NSXMLTextKind NSXMLTextKind;
alias NSXMLNodeKind.NSXMLDTDKind NSXMLDTDKind;
alias NSXMLNodeKind.NSXMLEntityDeclarationKind NSXMLEntityDeclarationKind;
alias NSXMLNodeKind.NSXMLAttributeDeclarationKind NSXMLAttributeDeclarationKind;
alias NSXMLNodeKind.NSXMLElementDeclarationKind NSXMLElementDeclarationKind;
alias NSXMLNodeKind.NSXMLNotationDeclarationKind NSXMLNotationDeclarationKind;

public class NSXMLNode : NSObject
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

    public static id DTDNodeWithXMLString (NSString string)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_DTDNodeWithXMLString_1, string !is null ? string.id : null);
        return result !is null ? new id(result) : null;
    }

    public NSString URI ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_URI);
        return result !is null ? new NSString(result) : null;
    }

    public NSString XMLString ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_XMLString);
        return result !is null ? new NSString(result) : null;
    }

    public NSString XMLStringWithOptions (NSUInteger options)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_XMLStringWithOptions_1, options);
        return result !is null ? new NSString(result) : null;
    }

    public NSString XPath ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_XPath);
        return result !is null ? new NSString(result) : null;
    }

    public static id static_attributeWithName_URI_stringValue_ (NSString name, NSString URI, NSString stringValue)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_attributeWithName_1URI_1stringValue_1, name !is null ? name.id : null,
                URI !is null ? URI.id : null, stringValue !is null ? stringValue.id : null);
        return result !is null ? new id(result) : null;
    }

    public static id static_attributeWithName_stringValue_ (NSString name, NSString stringValue)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_attributeWithName_1stringValue_1, name !is null ? name.id : null,
                stringValue !is null ? stringValue.id : null);
        return result !is null ? new id(result) : null;
    }

    public NSString canonicalXMLStringPreservingComments (bool comments)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_canonicalXMLStringPreservingComments_1, comments);
        return result !is null ? new NSString(result) : null;
    }

    public NSXMLNode childAtIndex (NSUInteger index)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_childAtIndex_1, index);
        return result is this.id ? this : (result !is null ? new NSXMLNode(result) : null);
    }

    public NSUInteger childCount ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_childCount);
    }

    public NSArray children ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_children);
        return result !is null ? new NSArray(result) : null;
    }

    public static id commentWithStringValue (NSString stringValue)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_commentWithStringValue_1, stringValue !is null ? stringValue.id : null);
        return result !is null ? new id(result) : null;
    }

    public NSString description ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_description);
        return result !is null ? new NSString(result) : null;
    }

    public void detach ()
    {
        OS.objc_msgSend(this.id, OS.sel_detach);
    }

    public static id document ()
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_document);
        return result !is null ? new id(result) : null;
    }

    public static id documentWithRootElement (NSXMLElement element)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_documentWithRootElement_1, element !is null ? element.id : null);
        return result !is null ? new id(result) : null;
    }

    public static id static_elementWithName_ (NSString name)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_elementWithName_1, name !is null ? name.id : null);
        return result !is null ? new id(result) : null;
    }

    public static id static_elementWithName_URI_ (NSString name, NSString URI)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_elementWithName_1URI_1, name !is null ? name.id : null,
                URI !is null ? URI.id : null);
        return result !is null ? new id(result) : null;
    }

    public static id static_elementWithName_children_attributes_ (NSString name, NSArray children, NSArray attributes)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_elementWithName_1children_1attributes_1, name !is null ? name.id : null,
                children !is null ? children.id : null, attributes !is null ? attributes.id : null);
        return result !is null ? new id(result) : null;
    }

    public static id static_elementWithName_stringValue_ (NSString name, NSString string)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_elementWithName_1stringValue_1, name !is null ? name.id : null,
                string !is null ? string.id : null);
        return result !is null ? new id(result) : null;
    }

    public NSUInteger index ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_index);
    }

    public id initWithKind_ (NSXMLNodeKind kind)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithKind_1, kind);
        return result !is null ? new id(result) : null;
    }

    public id initWithKind_options_ (NSXMLNodeKind kind, NSUInteger options)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithKind_1options_1, kind, options);
        return result !is null ? new id(result) : null;
    }

    public NSXMLNodeKind kind ()
    {
        return cast(NSXMLNodeKind) OS.objc_msgSend(this.id, OS.sel_kind);
    }

    public NSUInteger level ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id, OS.sel_level);
    }

    public NSString localName ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_localName);
        return result !is null ? new NSString(result) : null;
    }

    public static NSString localNameForName (NSString name)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_localNameForName_1, name !is null ? name.id : null);
        return result !is null ? new NSString(result) : null;
    }

    public NSString name ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_name);
        return result !is null ? new NSString(result) : null;
    }

    public static id namespaceWithName (NSString name, NSString stringValue)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_namespaceWithName_1stringValue_1, name !is null ? name.id : null,
                stringValue !is null ? stringValue.id : null);
        return result !is null ? new id(result) : null;
    }

    public NSXMLNode nextNode ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_nextNode);
        return result is this.id ? this : (result !is null ? new NSXMLNode(result) : null);
    }

    public NSXMLNode nextSibling ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_nextSibling);
        return result is this.id ? this : (result !is null ? new NSXMLNode(result) : null);
    }

    public NSArray nodesForXPath (NSString xpath, /*NSError** */objc.id** error)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_nodesForXPath_1error_1, xpath !is null ? xpath.id : null, error);
        return result !is null ? new NSArray(result) : null;
    }

    public id objectValue ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_objectValue);
        return result !is null ? new id(result) : null;
    }

    public NSArray objectsForXQuery_constants_error_ (NSString xquery, NSDictionary constants, /*NSError** */objc.id** error)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_objectsForXQuery_1constants_1error_1, xquery !is null ? xquery.id : null,
                constants !is null ? constants.id : null, error);
        return result !is null ? new NSArray(result) : null;
    }

    public NSArray objectsForXQuery_error_ (NSString xquery, /*NSError** */objc.id** error)
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_objectsForXQuery_1error_1, xquery !is null ? xquery.id : null, error);
        return result !is null ? new NSArray(result) : null;
    }

    public NSXMLNode parent ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_parent);
        return result is this.id ? this : (result !is null ? new NSXMLNode(result) : null);
    }

    public static NSXMLNode predefinedNamespaceForPrefix (NSString name)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_predefinedNamespaceForPrefix_1, name !is null ? name.id : null);
        return result !is null ? new NSXMLNode(result) : null;
    }

    public NSString prefix ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_prefix);
        return result !is null ? new NSString(result) : null;
    }

    public static NSString prefixForName (NSString name)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_prefixForName_1, name !is null ? name.id : null);
        return result !is null ? new NSString(result) : null;
    }

    public NSXMLNode previousNode ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_previousNode);
        return result is this.id ? this : (result !is null ? new NSXMLNode(result) : null);
    }

    public NSXMLNode previousSibling ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_previousSibling);
        return result is this.id ? this : (result !is null ? new NSXMLNode(result) : null);
    }

    public static id processingInstructionWithName (NSString name, NSString stringValue)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_processingInstructionWithName_1stringValue_1, name !is null ? name.id : null,
                stringValue !is null ? stringValue.id : null);
        return result !is null ? new id(result) : null;
    }

    public NSXMLDocument rootDocument ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_rootDocument);
        return result !is null ? new NSXMLDocument(result) : null;
    }

    public void setName (NSString name)
    {
        OS.objc_msgSend(this.id, OS.sel_setName_1, name !is null ? name.id : null);
    }

    public void setObjectValue (id value)
    {
        OS.objc_msgSend(this.id, OS.sel_setObjectValue_1, value !is null ? value.id : null);
    }

    public void setStringValue_ (NSString string)
    {
        OS.objc_msgSend(this.id, OS.sel_setStringValue_1, string !is null ? string.id : null);
    }

    public void setStringValue_resolvingEntities_ (NSString string, bool resolve)
    {
        OS.objc_msgSend(this.id, OS.sel_setStringValue_1resolvingEntities_1, string !is null ? string.id : null, resolve);
    }

    public void setURI (NSString URI)
    {
        OS.objc_msgSend(this.id, OS.sel_setURI_1, URI !is null ? URI.id : null);
    }

    public NSString stringValue ()
    {
        objc.id result = OS.objc_msgSend(this.id, OS.sel_stringValue);
        return result !is null ? new NSString(result) : null;
    }

    public static id textWithStringValue (NSString stringValue)
    {
        objc.id result = OS.objc_msgSend(OS.class_NSXMLNode, OS.sel_textWithStringValue_1, stringValue !is null ? stringValue.id : null);
        return result !is null ? new id(result) : null;
    }

}