Mercurial > projects > dwt-mac
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSXMLElement; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.NSXMLNode; | |
22 import dwt.internal.cocoa.OS; | |
23 import objc = dwt.internal.objc.runtime; | |
24 | |
25 public class NSXMLElement : NSXMLNode | |
26 { | |
27 | |
28 public this () | |
29 { | |
30 super(); | |
31 } | |
32 | |
33 public this (objc.id id) | |
34 { | |
35 super(id); | |
36 } | |
37 | |
38 public void addAttribute (NSXMLNode attribute) | |
39 { | |
40 OS.objc_msgSend(this.id, OS.sel_addAttribute_1, attribute !is null ? attribute.id : null); | |
41 } | |
42 | |
43 public void addChild (NSXMLNode child) | |
44 { | |
45 OS.objc_msgSend(this.id, OS.sel_addChild_1, child !is null ? child.id : null); | |
46 } | |
47 | |
48 public void addNamespace (NSXMLNode aNamespace) | |
49 { | |
50 OS.objc_msgSend(this.id, OS.sel_addNamespace_1, aNamespace !is null ? aNamespace.id : null); | |
51 } | |
52 | |
53 public NSXMLNode attributeForLocalName (NSString localName, NSString URI) | |
54 { | |
55 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeForLocalName_1URI_1, localName !is null ? localName.id : null, | |
56 URI !is null ? URI.id : null); | |
57 return result !is null ? new NSXMLNode(result) : null; | |
58 } | |
59 | |
60 public NSXMLNode attributeForName (NSString name) | |
61 { | |
62 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeForName_1, name !is null ? name.id : null); | |
63 return result !is null ? new NSXMLNode(result) : null; | |
64 } | |
65 | |
66 public NSArray attributes () | |
67 { | |
68 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributes); | |
69 return result !is null ? new NSArray(result) : null; | |
70 } | |
71 | |
72 public NSArray elementsForLocalName (NSString localName, NSString URI) | |
73 { | |
74 objc.id result = OS.objc_msgSend(this.id, OS.sel_elementsForLocalName_1URI_1, localName !is null ? localName.id : null, | |
75 URI !is null ? URI.id : null); | |
76 return result !is null ? new NSArray(result) : null; | |
77 } | |
78 | |
79 public NSArray elementsForName (NSString name) | |
80 { | |
81 objc.id result = OS.objc_msgSend(this.id, OS.sel_elementsForName_1, name !is null ? name.id : null); | |
82 return result !is null ? new NSArray(result) : null; | |
83 } | |
84 | |
85 public id initWithName_ (NSString name) | |
86 { | |
87 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1, name !is null ? name.id : null); | |
88 return result !is null ? new id(result) : null; | |
89 } | |
90 | |
91 public id initWithName_URI_ (NSString name, NSString URI) | |
92 { | |
93 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); | |
94 return result !is null ? new id(result) : null; | |
95 } | |
96 | |
97 public id initWithName_stringValue_ (NSString name, NSString string) | |
98 { | |
99 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1stringValue_1, name !is null ? name.id : null, | |
100 string !is null ? string.id : null); | |
101 return result !is null ? new id(result) : null; | |
102 } | |
103 | |
104 public id initWithXMLString (NSString string, /*NSError** */objc.id** error) | |
105 { | |
106 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithXMLString_1error_1, string !is null ? string.id : null, error); | |
107 return result !is null ? new id(result) : null; | |
108 } | |
109 | |
110 public void insertChild (NSXMLNode child, NSUInteger index) | |
111 { | |
112 OS.objc_msgSend(this.id, OS.sel_insertChild_1atIndex_1, child !is null ? child.id : null, index); | |
113 } | |
114 | |
115 public void insertChildren (NSArray children, NSUInteger index) | |
116 { | |
117 OS.objc_msgSend(this.id, OS.sel_insertChildren_1atIndex_1, children !is null ? children.id : null, index); | |
118 } | |
119 | |
120 public NSXMLNode namespaceForPrefix (NSString name) | |
121 { | |
122 objc.id result = OS.objc_msgSend(this.id, OS.sel_namespaceForPrefix_1, name !is null ? name.id : null); | |
123 return result !is null ? new NSXMLNode(result) : null; | |
124 } | |
125 | |
126 public NSArray namespaces () | |
127 { | |
128 objc.id result = OS.objc_msgSend(this.id, OS.sel_namespaces); | |
129 return result !is null ? new NSArray(result) : null; | |
130 } | |
131 | |
132 public void normalizeAdjacentTextNodesPreservingCDATA (bool preserve) | |
133 { | |
134 OS.objc_msgSend(this.id, OS.sel_normalizeAdjacentTextNodesPreservingCDATA_1, preserve); | |
135 } | |
136 | |
137 public void removeAttributeForName (NSString name) | |
138 { | |
139 OS.objc_msgSend(this.id, OS.sel_removeAttributeForName_1, name !is null ? name.id : null); | |
140 } | |
141 | |
142 public void removeChildAtIndex (NSUInteger index) | |
143 { | |
144 OS.objc_msgSend(this.id, OS.sel_removeChildAtIndex_1, index); | |
145 } | |
146 | |
147 public void removeNamespaceForPrefix (NSString name) | |
148 { | |
149 OS.objc_msgSend(this.id, OS.sel_removeNamespaceForPrefix_1, name !is null ? name.id : null); | |
150 } | |
151 | |
152 public void replaceChildAtIndex (NSUInteger index, NSXMLNode node) | |
153 { | |
154 OS.objc_msgSend(this.id, OS.sel_replaceChildAtIndex_1withNode_1, index, node !is null ? node.id : null); | |
155 } | |
156 | |
157 public NSXMLNode resolveNamespaceForName (NSString name) | |
158 { | |
159 objc.id result = OS.objc_msgSend(this.id, OS.sel_resolveNamespaceForName_1, name !is null ? name.id : null); | |
160 return result !is null ? new NSXMLNode(result) : null; | |
161 } | |
162 | |
163 public NSString resolvePrefixForNamespaceURI (NSString namespaceURI) | |
164 { | |
165 objc.id result = OS.objc_msgSend(this.id, OS.sel_resolvePrefixForNamespaceURI_1, namespaceURI !is null ? namespaceURI.id : null); | |
166 return result !is null ? new NSString(result) : null; | |
167 } | |
168 | |
169 public void setAttributes (NSArray attributes) | |
170 { | |
171 OS.objc_msgSend(this.id, OS.sel_setAttributes_1, attributes !is null ? attributes.id : null); | |
172 } | |
173 | |
174 public void setAttributesAsDictionary (NSDictionary attributes) | |
175 { | |
176 OS.objc_msgSend(this.id, OS.sel_setAttributesAsDictionary_1, attributes !is null ? attributes.id : null); | |
177 } | |
178 | |
179 public void setChildren (NSArray children) | |
180 { | |
181 OS.objc_msgSend(this.id, OS.sel_setChildren_1, children !is null ? children.id : null); | |
182 } | |
183 | |
184 public void setNamespaces (NSArray namespaces) | |
185 { | |
186 OS.objc_msgSend(this.id, OS.sel_setNamespaces_1, namespaces !is null ? namespaces.id : null); | |
187 } | |
188 | |
189 } |