Mercurial > projects > dstep
annotate dstep/foundation/NSXMLElement.d @ 25:b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 06 Apr 2010 11:37:27 +0200 |
parents | 19885b43130e |
children |
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 { | |
25
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
21 mixin ObjcWrap; |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
22 |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
23 this (id object) |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
24 { |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
25 super(object); |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
26 } |
16
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 this () |
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 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
32 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
33 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
34 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
35 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
36 } |
14 | 37 |
38 Object initWithName (NSString name) | |
39 { | |
40 return invokeObjcSelf!(Object, "initWithName:", NSString)(name); | |
41 } | |
42 | |
43 this (NSString name) | |
44 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
45 typeof(this).alloc.initWithName(name); |
14 | 46 } |
47 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 Object initWithName_URL (NSString name, NSString URI) |
14 | 49 { |
50 return invokeObjcSelf!(Object, "initWithName:URI:", NSString, NSString)(name, URI); | |
51 } | |
52 | |
53 Object initWithName (NSString name, NSString string) | |
54 { | |
55 return invokeObjcSelf!(Object, "initWithName:stringValue:", NSString, NSString)(name, string); | |
56 } | |
57 | |
58 this (NSString name, NSString string) | |
59 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
60 typeof(this).alloc.initWithName(name, string); |
14 | 61 } |
62 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
63 Object initWithXMLString (NSString string, ref NSError error) |
14 | 64 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
65 id err = error ? new objc_object : null; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
66 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
|
67 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
68 if (err) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
69 error = new NSError(err); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
70 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
71 return result; |
14 | 72 } |
73 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
74 this (NSString string, ref NSError error) |
14 | 75 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
76 typeof(this).alloc.initWithXMLString(string, error); |
14 | 77 } |
78 | |
79 NSArray elementsForName (NSString name) | |
80 { | |
81 return invokeObjcSelf!(NSArray, "elementsForName:", NSString)(name); | |
82 } | |
83 | |
84 NSArray elementsForLocalName (NSString localName, NSString URI) | |
85 { | |
86 return invokeObjcSelf!(NSArray, "elementsForLocalName:URI:", NSString, NSString)(localName, URI); | |
87 } | |
88 | |
89 void addAttribute (NSXMLNode attribute) | |
90 { | |
91 return invokeObjcSelf!(void, "addAttribute:", NSXMLNode)(attribute); | |
92 } | |
93 | |
94 void removeAttributeForName (NSString name) | |
95 { | |
96 return invokeObjcSelf!(void, "removeAttributeForName:", NSString)(name); | |
97 } | |
98 | |
99 void setAttributes (NSArray attributes) | |
100 { | |
101 return invokeObjcSelf!(void, "setAttributes:", NSArray)(attributes); | |
102 } | |
103 | |
104 void setAttributesAsDictionary (NSDictionary attributes) | |
105 { | |
106 return invokeObjcSelf!(void, "setAttributesAsDictionary:", NSDictionary)(attributes); | |
107 } | |
108 | |
109 NSArray attributes () | |
110 { | |
111 return invokeObjcSelf!(NSArray, "attributes"); | |
112 } | |
113 | |
114 NSXMLNode attributeForName (NSString name) | |
115 { | |
116 return invokeObjcSelf!(NSXMLNode, "attributeForName:", NSString)(name); | |
117 } | |
118 | |
119 NSXMLNode attributeForLocalName (NSString localName, NSString URI) | |
120 { | |
121 return invokeObjcSelf!(NSXMLNode, "attributeForLocalName:URI:", NSString, NSString)(localName, URI); | |
122 } | |
123 | |
124 void addNamespace (NSXMLNode aNamespace) | |
125 { | |
126 return invokeObjcSelf!(void, "addNamespace:", NSXMLNode)(aNamespace); | |
127 } | |
128 | |
129 void removeNamespaceForPrefix (NSString name) | |
130 { | |
131 return invokeObjcSelf!(void, "removeNamespaceForPrefix:", NSString)(name); | |
132 } | |
133 | |
134 void setNamespaces (NSArray namespaces) | |
135 { | |
136 return invokeObjcSelf!(void, "setNamespaces:", NSArray)(namespaces); | |
137 } | |
138 | |
139 NSArray namespaces () | |
140 { | |
141 return invokeObjcSelf!(NSArray, "namespaces"); | |
142 } | |
143 | |
144 NSXMLNode namespaceForPrefix (NSString name) | |
145 { | |
146 return invokeObjcSelf!(NSXMLNode, "namespaceForPrefix:", NSString)(name); | |
147 } | |
148 | |
149 NSXMLNode resolveNamespaceForName (NSString name) | |
150 { | |
151 return invokeObjcSelf!(NSXMLNode, "resolveNamespaceForName:", NSString)(name); | |
152 } | |
153 | |
154 NSString resolvePrefixForNamespaceURI (NSString namespaceURI) | |
155 { | |
156 return invokeObjcSelf!(NSString, "resolvePrefixForNamespaceURI:", NSString)(namespaceURI); | |
157 } | |
158 | |
159 void insertChild (NSXMLNode child, NSUInteger index) | |
160 { | |
161 return invokeObjcSelf!(void, "insertChild:atIndex:", NSXMLNode, NSUInteger)(child, index); | |
162 } | |
163 | |
164 void insertChildren (NSArray children, NSUInteger index) | |
165 { | |
166 return invokeObjcSelf!(void, "insertChildren:atIndex:", NSArray, NSUInteger)(children, index); | |
167 } | |
168 | |
169 void removeChildAtIndex (NSUInteger index) | |
170 { | |
171 return invokeObjcSelf!(void, "removeChildAtIndex:", NSUInteger)(index); | |
172 } | |
173 | |
174 void setChildren (NSArray children) | |
175 { | |
176 return invokeObjcSelf!(void, "setChildren:", NSArray)(children); | |
177 } | |
178 | |
179 void addChild (NSXMLNode child) | |
180 { | |
181 return invokeObjcSelf!(void, "addChild:", NSXMLNode)(child); | |
182 } | |
183 | |
184 void replaceChildAtIndex (NSUInteger index, NSXMLNode node) | |
185 { | |
186 return invokeObjcSelf!(void, "replaceChildAtIndex:withNode:", NSUInteger, NSXMLNode)(index, node); | |
187 } | |
188 | |
189 void normalizeAdjacentTextNodesPreservingCDATA (bool preserve) | |
190 { | |
191 return invokeObjcSelf!(void, "normalizeAdjacentTextNodesPreservingCDATA:", bool)(preserve); | |
192 } | |
193 } | |
194 |