Mercurial > projects > dstep
comparison 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 |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) |
6 */ | 6 */ |
7 module dstep.foundation.NSCharacterSet; | 7 module dstep.foundation.NSCharacterSet; |
8 | 8 |
9 import dstep.corefoundation.CFCharacterSet; | 9 import dstep.corefoundation.CFCharacterSet; |
10 import dstep.foundation.NSCoder; | |
10 import dstep.foundation.NSData; | 11 import dstep.foundation.NSData; |
11 import dstep.foundation.NSObject; | 12 import dstep.foundation.NSObject; |
12 import dstep.foundation.NSRange; | 13 import dstep.foundation.NSRange; |
13 import dstep.foundation.NSString; | 14 import dstep.foundation.NSString; |
15 import dstep.foundation.NSZone; | |
14 import dstep.objc.bridge.Bridge; | 16 import dstep.objc.bridge.Bridge; |
15 import dstep.objc.objc : id; | 17 import dstep.objc.objc; |
16 | 18 |
17 enum | 19 enum |
18 { | 20 { |
19 NSOpenStepUnicodeReservedBase = 0xF400 | 21 NSOpenStepUnicodeReservedBase = 0xF400 |
20 } | 22 } |
21 | 23 |
22 class NSCharacterSet : NSObject, INSCopying, INSMutableCopying, INSCoding | 24 class NSCharacterSet : NSObject, INSCopying, INSMutableCopying, INSCoding |
23 { | 25 { |
24 mixin ObjcWrap; | 26 mixin (ObjcWrap); |
27 | |
28 this () | |
29 { | |
30 super(typeof(this).alloc.init.objcObject); | |
31 } | |
32 | |
33 typeof(this) init () | |
34 { | |
35 return invokeObjcSelf!(typeof(this), "init"); | |
36 } | |
25 | 37 |
26 static Object controlCharacterSet () | 38 static Object controlCharacterSet () |
27 { | 39 { |
28 return invokeObjcSelfClass!(Object, "controlCharacterSet"); | 40 return invokeObjcSuperClass!(Object, "controlCharacterSet"); |
29 } | 41 } |
30 | 42 |
31 static Object whitespaceCharacterSet () | 43 static Object whitespaceCharacterSet () |
32 { | 44 { |
33 return invokeObjcSelfClass!(Object, "whitespaceCharacterSet"); | 45 return invokeObjcSuperClass!(Object, "whitespaceCharacterSet"); |
34 } | 46 } |
35 | 47 |
36 static Object whitespaceAndNewlineCharacterSet () | 48 static Object whitespaceAndNewlineCharacterSet () |
37 { | 49 { |
38 return invokeObjcSelfClass!(Object, "whitespaceAndNewlineCharacterSet"); | 50 return invokeObjcSuperClass!(Object, "whitespaceAndNewlineCharacterSet"); |
39 } | 51 } |
40 | 52 |
41 static Object decimalDigitCharacterSet () | 53 static Object decimalDigitCharacterSet () |
42 { | 54 { |
43 return invokeObjcSelfClass!(Object, "decimalDigitCharacterSet"); | 55 return invokeObjcSuperClass!(Object, "decimalDigitCharacterSet"); |
44 } | 56 } |
45 | 57 |
46 static Object letterCharacterSet () | 58 static Object letterCharacterSet () |
47 { | 59 { |
48 return invokeObjcSelfClass!(Object, "letterCharacterSet"); | 60 return invokeObjcSuperClass!(Object, "letterCharacterSet"); |
49 } | 61 } |
50 | 62 |
51 static Object lowercaseLetterCharacterSet () | 63 static Object lowercaseLetterCharacterSet () |
52 { | 64 { |
53 return invokeObjcSelfClass!(Object, "lowercaseLetterCharacterSet"); | 65 return invokeObjcSuperClass!(Object, "lowercaseLetterCharacterSet"); |
54 } | 66 } |
55 | 67 |
56 static Object uppercaseLetterCharacterSet () | 68 static Object uppercaseLetterCharacterSet () |
57 { | 69 { |
58 return invokeObjcSelfClass!(Object, "uppercaseLetterCharacterSet"); | 70 return invokeObjcSuperClass!(Object, "uppercaseLetterCharacterSet"); |
59 } | 71 } |
60 | 72 |
61 static Object nonBaseCharacterSet () | 73 static Object nonBaseCharacterSet () |
62 { | 74 { |
63 return invokeObjcSelfClass!(Object, "nonBaseCharacterSet"); | 75 return invokeObjcSuperClass!(Object, "nonBaseCharacterSet"); |
64 } | 76 } |
65 | 77 |
66 static Object alphanumericCharacterSet () | 78 static Object alphanumericCharacterSet () |
67 { | 79 { |
68 return invokeObjcSelfClass!(Object, "alphanumericCharacterSet"); | 80 return invokeObjcSuperClass!(Object, "alphanumericCharacterSet"); |
69 } | 81 } |
70 | 82 |
71 static Object decomposableCharacterSet () | 83 static Object decomposableCharacterSet () |
72 { | 84 { |
73 return invokeObjcSelfClass!(Object, "decomposableCharacterSet"); | 85 return invokeObjcSuperClass!(Object, "decomposableCharacterSet"); |
74 } | 86 } |
75 | 87 |
76 static Object illegalCharacterSet () | 88 static Object illegalCharacterSet () |
77 { | 89 { |
78 return invokeObjcSelfClass!(Object, "illegalCharacterSet"); | 90 return invokeObjcSuperClass!(Object, "illegalCharacterSet"); |
79 } | 91 } |
80 | 92 |
81 static Object punctuationCharacterSet () | 93 static Object punctuationCharacterSet () |
82 { | 94 { |
83 return invokeObjcSelfClass!(Object, "punctuationCharacterSet"); | 95 return invokeObjcSuperClass!(Object, "punctuationCharacterSet"); |
84 } | 96 } |
85 | 97 |
86 static Object capitalizedLetterCharacterSet () | 98 static Object capitalizedLetterCharacterSet () |
87 { | 99 { |
88 return invokeObjcSelfClass!(Object, "capitalizedLetterCharacterSet"); | 100 return invokeObjcSuperClass!(Object, "capitalizedLetterCharacterSet"); |
89 } | 101 } |
90 | 102 |
91 static Object symbolCharacterSet () | 103 static Object symbolCharacterSet () |
92 { | 104 { |
93 return invokeObjcSelfClass!(Object, "symbolCharacterSet"); | 105 return invokeObjcSuperClass!(Object, "symbolCharacterSet"); |
94 } | 106 } |
95 | 107 |
96 static Object newlineCharacterSet () | 108 static Object newlineCharacterSet () |
97 { | 109 { |
98 return invokeObjcSelfClass!(Object, "newlineCharacterSet"); | 110 return invokeObjcSuperClass!(Object, "newlineCharacterSet"); |
99 } | 111 } |
100 | 112 |
101 static Object characterSetWithRange (NSRange aRange) | 113 static Object characterSetWithRange (NSRange aRange) |
102 { | 114 { |
103 return invokeObjcSelfClass!(Object, "characterSetWithRange:", NSRange)(aRange); | 115 return invokeObjcSuperClass!(Object, "characterSetWithRange:", NSRange)(aRange); |
104 } | 116 } |
105 | 117 |
106 static Object characterSetWithCharactersInString (NSString aString) | 118 static Object characterSetWithCharactersInString (NSString aString) |
107 { | 119 { |
108 return invokeObjcSelfClass!(Object, "characterSetWithCharactersInString:", NSString)(aString); | 120 return invokeObjcSuperClass!(Object, "characterSetWithCharactersInString:", NSString)(aString); |
109 } | 121 } |
110 | 122 |
111 static Object characterSetWithBitmapRepresentation (NSData data) | 123 static Object characterSetWithBitmapRepresentation (NSData data) |
112 { | 124 { |
113 return invokeObjcSelfClass!(Object, "characterSetWithBitmapRepresentation:", NSData)(data); | 125 return invokeObjcSuperClass!(Object, "characterSetWithBitmapRepresentation:", NSData)(data); |
114 } | 126 } |
115 | 127 |
116 static Object characterSetWithContentsOfFile (NSString fName) | 128 static Object characterSetWithContentsOfFile (NSString fName) |
117 { | 129 { |
118 return invokeObjcSelfClass!(Object, "characterSetWithContentsOfFile:", NSString)(fName); | 130 return invokeObjcSuperClass!(Object, "characterSetWithContentsOfFile:", NSString)(fName); |
119 } | 131 } |
120 | 132 |
121 bool characterIsMember (ushort aCharacter) | 133 bool characterIsMember (ushort aCharacter) |
122 { | 134 { |
123 return invokeObjcSelf!(bool, "characterIsMember:", ushort)(aCharacter); | 135 return invokeObjcSelf!(bool, "characterIsMember:", ushort)(aCharacter); |
169 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | 181 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); |
170 } | 182 } |
171 | 183 |
172 this (NSCoder aDecoder) | 184 this (NSCoder aDecoder) |
173 { | 185 { |
174 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 186 typeof(this).alloc.initWithCoder(aDecoder); |
175 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); | |
176 | |
177 if (result) | |
178 objcObject = ret; | |
179 | |
180 dObject = this; | |
181 } | 187 } |
182 } | 188 } |
183 | 189 |
184 class NSMutableCharacterSet : NSCharacterSet, INSCopying, INSMutableCopying | 190 class NSMutableCharacterSet : NSCharacterSet, INSCopying, INSMutableCopying |
185 { | 191 { |
186 mixin ObjcWrap; | 192 mixin (ObjcWrap); |
193 | |
194 this () | |
195 { | |
196 super(typeof(this).alloc.init.objcObject); | |
197 } | |
198 | |
199 typeof(this) init () | |
200 { | |
201 return invokeObjcSelf!(typeof(this), "init"); | |
202 } | |
187 | 203 |
188 void addCharactersInRange (NSRange aRange) | 204 void addCharactersInRange (NSRange aRange) |
189 { | 205 { |
190 return invokeObjcSelf!(void, "addCharactersInRange:", NSRange)(aRange); | 206 return invokeObjcSelf!(void, "addCharactersInRange:", NSRange)(aRange); |
191 } | 207 } |