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