Mercurial > projects > dstep
annotate dstep/foundation/NSXMLElement.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children | b9de51448c6b |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSXMLElement; | |
8 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
9 import dstep.foundation.NSArray; |
14 | 10 import dstep.foundation.NSDictionary; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
11 import dstep.foundation.NSError; |
14 | 12 import dstep.foundation.NSEnumerator; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
13 import dstep.foundation.NSObjCRuntime; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
14 import dstep.foundation.NSString; |
14 | 15 import dstep.foundation.NSXMLNode; |
16 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
17 import dstep.objc.objc; |
14 | 18 |
19 class NSXMLElement : NSXMLNode | |
20 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 } |
14 | 32 |
33 Object initWithName (NSString name) | |
34 { | |
35 return invokeObjcSelf!(Object, "initWithName:", NSString)(name); | |
36 } | |
37 | |
38 this (NSString name) | |
39 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
40 typeof(this).alloc.initWithName(name); |
14 | 41 } |
42 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 Object initWithName_URL (NSString name, NSString URI) |
14 | 44 { |
45 return invokeObjcSelf!(Object, "initWithName:URI:", NSString, NSString)(name, URI); | |
46 } | |
47 | |
48 Object initWithName (NSString name, NSString string) | |
49 { | |
50 return invokeObjcSelf!(Object, "initWithName:stringValue:", NSString, NSString)(name, string); | |
51 } | |
52 | |
53 this (NSString name, NSString string) | |
54 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
55 typeof(this).alloc.initWithName(name, string); |
14 | 56 } |
57 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
58 Object initWithXMLString (NSString string, ref NSError error) |
14 | 59 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
60 id err = error ? new objc_object : null; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
61 Object result = invokeObjcSelf!(Object, "initWithXMLString:error:", NSString, id*)(string, &err); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
62 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
63 if (err) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
64 error = new NSError(err); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
65 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
66 return result; |
14 | 67 } |
68 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
69 this (NSString string, ref NSError error) |
14 | 70 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
71 typeof(this).alloc.initWithXMLString(string, error); |
14 | 72 } |
73 | |
74 NSArray elementsForName (NSString name) | |
75 { | |
76 return invokeObjcSelf!(NSArray, "elementsForName:", NSString)(name); | |
77 } | |
78 | |
79 NSArray elementsForLocalName (NSString localName, NSString URI) | |
80 { | |
81 return invokeObjcSelf!(NSArray, "elementsForLocalName:URI:", NSString, NSString)(localName, URI); | |
82 } | |
83 | |
84 void addAttribute (NSXMLNode attribute) | |
85 { | |
86 return invokeObjcSelf!(void, "addAttribute:", NSXMLNode)(attribute); | |
87 } | |
88 | |
89 void removeAttributeForName (NSString name) | |
90 { | |
91 return invokeObjcSelf!(void, "removeAttributeForName:", NSString)(name); | |
92 } | |
93 | |
94 void setAttributes (NSArray attributes) | |
95 { | |
96 return invokeObjcSelf!(void, "setAttributes:", NSArray)(attributes); | |
97 } | |
98 | |
99 void setAttributesAsDictionary (NSDictionary attributes) | |
100 { | |
101 return invokeObjcSelf!(void, "setAttributesAsDictionary:", NSDictionary)(attributes); | |
102 } | |
103 | |
104 NSArray attributes () | |
105 { | |
106 return invokeObjcSelf!(NSArray, "attributes"); | |
107 } | |
108 | |
109 NSXMLNode attributeForName (NSString name) | |
110 { | |
111 return invokeObjcSelf!(NSXMLNode, "attributeForName:", NSString)(name); | |
112 } | |
113 | |
114 NSXMLNode attributeForLocalName (NSString localName, NSString URI) | |
115 { | |
116 return invokeObjcSelf!(NSXMLNode, "attributeForLocalName:URI:", NSString, NSString)(localName, URI); | |
117 } | |
118 | |
119 void addNamespace (NSXMLNode aNamespace) | |
120 { | |
121 return invokeObjcSelf!(void, "addNamespace:", NSXMLNode)(aNamespace); | |
122 } | |
123 | |
124 void removeNamespaceForPrefix (NSString name) | |
125 { | |
126 return invokeObjcSelf!(void, "removeNamespaceForPrefix:", NSString)(name); | |
127 } | |
128 | |
129 void setNamespaces (NSArray namespaces) | |
130 { | |
131 return invokeObjcSelf!(void, "setNamespaces:", NSArray)(namespaces); | |
132 } | |
133 | |
134 NSArray namespaces () | |
135 { | |
136 return invokeObjcSelf!(NSArray, "namespaces"); | |
137 } | |
138 | |
139 NSXMLNode namespaceForPrefix (NSString name) | |
140 { | |
141 return invokeObjcSelf!(NSXMLNode, "namespaceForPrefix:", NSString)(name); | |
142 } | |
143 | |
144 NSXMLNode resolveNamespaceForName (NSString name) | |
145 { | |
146 return invokeObjcSelf!(NSXMLNode, "resolveNamespaceForName:", NSString)(name); | |
147 } | |
148 | |
149 NSString resolvePrefixForNamespaceURI (NSString namespaceURI) | |
150 { | |
151 return invokeObjcSelf!(NSString, "resolvePrefixForNamespaceURI:", NSString)(namespaceURI); | |
152 } | |
153 | |
154 void insertChild (NSXMLNode child, NSUInteger index) | |
155 { | |
156 return invokeObjcSelf!(void, "insertChild:atIndex:", NSXMLNode, NSUInteger)(child, index); | |
157 } | |
158 | |
159 void insertChildren (NSArray children, NSUInteger index) | |
160 { | |
161 return invokeObjcSelf!(void, "insertChildren:atIndex:", NSArray, NSUInteger)(children, index); | |
162 } | |
163 | |
164 void removeChildAtIndex (NSUInteger index) | |
165 { | |
166 return invokeObjcSelf!(void, "removeChildAtIndex:", NSUInteger)(index); | |
167 } | |
168 | |
169 void setChildren (NSArray children) | |
170 { | |
171 return invokeObjcSelf!(void, "setChildren:", NSArray)(children); | |
172 } | |
173 | |
174 void addChild (NSXMLNode child) | |
175 { | |
176 return invokeObjcSelf!(void, "addChild:", NSXMLNode)(child); | |
177 } | |
178 | |
179 void replaceChildAtIndex (NSUInteger index, NSXMLNode node) | |
180 { | |
181 return invokeObjcSelf!(void, "replaceChildAtIndex:withNode:", NSUInteger, NSXMLNode)(index, node); | |
182 } | |
183 | |
184 void normalizeAdjacentTextNodesPreservingCDATA (bool preserve) | |
185 { | |
186 return invokeObjcSelf!(void, "normalizeAdjacentTextNodesPreservingCDATA:", bool)(preserve); | |
187 } | |
188 } | |
189 |