Mercurial > projects > dstep
annotate dstep/foundation/NSCharacterSet.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.NSCharacterSet; | |
8 | |
9 import dstep.corefoundation.CFCharacterSet; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
10 import dstep.foundation.NSCoder; |
14 | 11 import dstep.foundation.NSData; |
12 import dstep.foundation.NSObject; | |
13 import dstep.foundation.NSRange; | |
14 import dstep.foundation.NSString; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
15 import dstep.foundation.NSZone; |
14 | 16 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
17 import dstep.objc.objc; |
14 | 18 |
19 enum | |
20 { | |
21 NSOpenStepUnicodeReservedBase = 0xF400 | |
22 } | |
23 | |
24 class NSCharacterSet : NSObject, INSCopying, INSMutableCopying, INSCoding | |
25 { | |
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
|
26 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
|
27 |
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
|
28 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
|
29 { |
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
|
30 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
|
31 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
32 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
33 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
34 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
35 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
36 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
37 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
38 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
39 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
40 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
41 } |
14 | 42 |
43 static Object controlCharacterSet () | |
44 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
45 return invokeObjcSuperClass!(Object, "controlCharacterSet"); |
14 | 46 } |
47 | |
48 static Object whitespaceCharacterSet () | |
49 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
50 return invokeObjcSuperClass!(Object, "whitespaceCharacterSet"); |
14 | 51 } |
52 | |
53 static Object whitespaceAndNewlineCharacterSet () | |
54 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
55 return invokeObjcSuperClass!(Object, "whitespaceAndNewlineCharacterSet"); |
14 | 56 } |
57 | |
58 static Object decimalDigitCharacterSet () | |
59 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
60 return invokeObjcSuperClass!(Object, "decimalDigitCharacterSet"); |
14 | 61 } |
62 | |
63 static Object letterCharacterSet () | |
64 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
65 return invokeObjcSuperClass!(Object, "letterCharacterSet"); |
14 | 66 } |
67 | |
68 static Object lowercaseLetterCharacterSet () | |
69 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
70 return invokeObjcSuperClass!(Object, "lowercaseLetterCharacterSet"); |
14 | 71 } |
72 | |
73 static Object uppercaseLetterCharacterSet () | |
74 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
75 return invokeObjcSuperClass!(Object, "uppercaseLetterCharacterSet"); |
14 | 76 } |
77 | |
78 static Object nonBaseCharacterSet () | |
79 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
80 return invokeObjcSuperClass!(Object, "nonBaseCharacterSet"); |
14 | 81 } |
82 | |
83 static Object alphanumericCharacterSet () | |
84 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
85 return invokeObjcSuperClass!(Object, "alphanumericCharacterSet"); |
14 | 86 } |
87 | |
88 static Object decomposableCharacterSet () | |
89 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
90 return invokeObjcSuperClass!(Object, "decomposableCharacterSet"); |
14 | 91 } |
92 | |
93 static Object illegalCharacterSet () | |
94 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
95 return invokeObjcSuperClass!(Object, "illegalCharacterSet"); |
14 | 96 } |
97 | |
98 static Object punctuationCharacterSet () | |
99 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
100 return invokeObjcSuperClass!(Object, "punctuationCharacterSet"); |
14 | 101 } |
102 | |
103 static Object capitalizedLetterCharacterSet () | |
104 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
105 return invokeObjcSuperClass!(Object, "capitalizedLetterCharacterSet"); |
14 | 106 } |
107 | |
108 static Object symbolCharacterSet () | |
109 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
110 return invokeObjcSuperClass!(Object, "symbolCharacterSet"); |
14 | 111 } |
112 | |
113 static Object newlineCharacterSet () | |
114 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
115 return invokeObjcSuperClass!(Object, "newlineCharacterSet"); |
14 | 116 } |
117 | |
118 static Object characterSetWithRange (NSRange aRange) | |
119 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
120 return invokeObjcSuperClass!(Object, "characterSetWithRange:", NSRange)(aRange); |
14 | 121 } |
122 | |
123 static Object characterSetWithCharactersInString (NSString aString) | |
124 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
125 return invokeObjcSuperClass!(Object, "characterSetWithCharactersInString:", NSString)(aString); |
14 | 126 } |
127 | |
128 static Object characterSetWithBitmapRepresentation (NSData data) | |
129 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
130 return invokeObjcSuperClass!(Object, "characterSetWithBitmapRepresentation:", NSData)(data); |
14 | 131 } |
132 | |
133 static Object characterSetWithContentsOfFile (NSString fName) | |
134 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
135 return invokeObjcSuperClass!(Object, "characterSetWithContentsOfFile:", NSString)(fName); |
14 | 136 } |
137 | |
138 bool characterIsMember (ushort aCharacter) | |
139 { | |
140 return invokeObjcSelf!(bool, "characterIsMember:", ushort)(aCharacter); | |
141 } | |
142 | |
143 NSData bitmapRepresentation () | |
144 { | |
145 return invokeObjcSelf!(NSData, "bitmapRepresentation"); | |
146 } | |
147 | |
148 NSCharacterSet invertedSet () | |
149 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
150 id result = invokeObjcSelf!(id, "invertedSet"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
151 return result is this.objcObject ? this : (result !is null ? new NSCharacterSet(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
152 } |
14 | 153 |
154 bool longCharacterIsMember (uint theLongChar) | |
155 { | |
156 return invokeObjcSelf!(bool, "longCharacterIsMember:", uint)(theLongChar); | |
157 } | |
158 | |
159 bool isSupersetOfSet (NSCharacterSet theOtherSet) | |
160 { | |
161 return invokeObjcSelf!(bool, "isSupersetOfSet:", NSCharacterSet)(theOtherSet); | |
162 } | |
163 | |
164 bool hasMemberInPlane (ubyte thePlane) | |
165 { | |
166 return invokeObjcSelf!(bool, "hasMemberInPlane:", ubyte)(thePlane); | |
167 } | |
168 | |
169 Object copyWithZone (NSZone* zone) | |
170 { | |
171 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
172 } | |
173 | |
174 Object mutableCopyWithZone (NSZone* zone) | |
175 { | |
176 return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); | |
177 } | |
178 | |
179 void encodeWithCoder (NSCoder aCoder) | |
180 { | |
181 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
182 } | |
183 | |
184 Object initWithCoder (NSCoder aDecoder) | |
185 { | |
186 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | |
187 } | |
188 | |
189 this (NSCoder aDecoder) | |
190 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
191 typeof(this).alloc.initWithCoder(aDecoder); |
14 | 192 } |
193 } | |
194 | |
195 class NSMutableCharacterSet : NSCharacterSet, INSCopying, INSMutableCopying | |
196 { | |
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
|
197 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
|
198 |
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
|
199 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
|
200 { |
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
|
201 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
|
202 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
203 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
204 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
205 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
206 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
207 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
208 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
209 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
210 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
211 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
212 } |
14 | 213 |
214 void addCharactersInRange (NSRange aRange) | |
215 { | |
216 return invokeObjcSelf!(void, "addCharactersInRange:", NSRange)(aRange); | |
217 } | |
218 | |
219 void removeCharactersInRange (NSRange aRange) | |
220 { | |
221 return invokeObjcSelf!(void, "removeCharactersInRange:", NSRange)(aRange); | |
222 } | |
223 | |
224 void addCharactersInString (NSString aString) | |
225 { | |
226 return invokeObjcSelf!(void, "addCharactersInString:", NSString)(aString); | |
227 } | |
228 | |
229 void removeCharactersInString (NSString aString) | |
230 { | |
231 return invokeObjcSelf!(void, "removeCharactersInString:", NSString)(aString); | |
232 } | |
233 | |
234 void formUnionWithCharacterSet (NSCharacterSet otherSet) | |
235 { | |
236 return invokeObjcSelf!(void, "formUnionWithCharacterSet:", NSCharacterSet)(otherSet); | |
237 } | |
238 | |
239 void formIntersectionWithCharacterSet (NSCharacterSet otherSet) | |
240 { | |
241 return invokeObjcSelf!(void, "formIntersectionWithCharacterSet:", NSCharacterSet)(otherSet); | |
242 } | |
243 | |
244 void invert () | |
245 { | |
246 return invokeObjcSelf!(void, "invert"); | |
247 } | |
248 | |
249 Object copyWithZone (NSZone* zone) | |
250 { | |
251 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
252 } | |
253 | |
254 Object mutableCopyWithZone (NSZone* zone) | |
255 { | |
256 return invokeObjcSelf!(Object, "mutableCopyWithZone:", NSZone*)(zone); | |
257 } | |
258 } | |
259 |