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