Mercurial > projects > dstep
comparison dstep/foundation/NSCoder.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 | 89f3c3ef1fd2 |
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.NSCoder; | 7 module dstep.foundation.NSCoder; |
8 | 8 |
9 import dstep.foundation.NSData; | 9 import dstep.foundation.NSData; |
10 import dstep.foundation.NSGeometry; | |
11 import dstep.foundation.NSKeyedArchiver; | |
12 import dstep.foundation.NSObjCRuntime; | |
10 import dstep.foundation.NSObject; | 13 import dstep.foundation.NSObject; |
11 import dstep.foundation.NSString; | 14 import dstep.foundation.NSString; |
15 import dstep.foundation.NSZone; | |
12 import dstep.objc.bridge.Bridge; | 16 import dstep.objc.bridge.Bridge; |
13 import dstep.objc.objc : id; | 17 import dstep.objc.objc; |
18 | |
19 import bindings = dstep.foundation.NSCoder_bindings; | |
20 | |
21 const TNSExtendedCoder = ` | |
22 | |
23 void encodeObject (Object object) | |
24 { | |
25 return invokeObjcSelf!(void, "encodeObject:", Object)(object); | |
26 } | |
27 | |
28 void encodePropertyList (Object aPropertyList) | |
29 { | |
30 return invokeObjcSelf!(void, "encodePropertyList:", Object)(aPropertyList); | |
31 } | |
32 | |
33 void encodeRootObject (Object rootObject) | |
34 { | |
35 return invokeObjcSelf!(void, "encodeRootObject:", Object)(rootObject); | |
36 } | |
37 | |
38 void encodeBycopyObject (Object anObject) | |
39 { | |
40 return invokeObjcSelf!(void, "encodeBycopyObject:", Object)(anObject); | |
41 } | |
42 | |
43 void encodeByrefObject (Object anObject) | |
44 { | |
45 return invokeObjcSelf!(void, "encodeByrefObject:", Object)(anObject); | |
46 } | |
47 | |
48 void encodeConditionalObject (Object object) | |
49 { | |
50 return invokeObjcSelf!(void, "encodeConditionalObject:", Object)(object); | |
51 } | |
52 | |
53 void encodeValuesOfObjCTypes (char* encodeValuesOfObjCTypes, ...) | |
54 { | |
55 return invokeObjcSelf!(void, "encodeValuesOfObjCTypes:", char*)(encodeValuesOfObjCTypes); | |
56 } | |
57 | |
58 void encodeArrayOfObjCType (char* type, NSUInteger count, void* array) | |
59 { | |
60 return invokeObjcSelf!(void, "encodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(type, count, array); | |
61 } | |
62 | |
63 void encodeBytes (void* byteaddr, NSUInteger length) | |
64 { | |
65 return invokeObjcSelf!(void, "encodeBytes:length:", void*, NSUInteger)(byteaddr, length); | |
66 } | |
67 | |
68 Object decodeObject () | |
69 { | |
70 return invokeObjcSelf!(Object, "decodeObject"); | |
71 } | |
72 | |
73 Object decodePropertyList () | |
74 { | |
75 return invokeObjcSelf!(Object, "decodePropertyList"); | |
76 } | |
77 | |
78 void decodeValuesOfObjCTypes (char* decodeValuesOfObjCTypes, ...) | |
79 { | |
80 return invokeObjcSelf!(void, "decodeValuesOfObjCTypes:", char*)(decodeValuesOfObjCTypes); | |
81 } | |
82 | |
83 void decodeArrayOfObjCType (char* itemType, NSUInteger count, void* array) | |
84 { | |
85 return invokeObjcSelf!(void, "decodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(itemType, count, array); | |
86 } | |
87 | |
88 void* decodeBytesWithReturnedLength (NSUInteger* lengthp) | |
89 { | |
90 return invokeObjcSelf!(void*, "decodeBytesWithReturnedLength:", NSUInteger*)(lengthp); | |
91 } | |
92 | |
93 void setObjectZone (NSZone* zone) | |
94 { | |
95 return invokeObjcSelf!(void, "setObjectZone:", NSZone*)(zone); | |
96 } | |
97 | |
98 NSZone* objectZone () | |
99 { | |
100 return invokeObjcSelf!(NSZone*, "objectZone"); | |
101 } | |
102 | |
103 uint systemVersion () | |
104 { | |
105 return invokeObjcSelf!(uint, "systemVersion"); | |
106 } | |
107 | |
108 bool allowsKeyedCoding () | |
109 { | |
110 return invokeObjcSelf!(bool, "allowsKeyedCoding"); | |
111 } | |
112 | |
113 void encodeObject (Object objv, NSString key) | |
114 { | |
115 return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); | |
116 } | |
117 | |
118 void encodeConditionalObject (Object objv, NSString key) | |
119 { | |
120 return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); | |
121 } | |
122 | |
123 void encodeBool (bool boolv, NSString key) | |
124 { | |
125 return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); | |
126 } | |
127 | |
128 void encodeInt (int intv, NSString key) | |
129 { | |
130 return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); | |
131 } | |
132 | |
133 void encodeInt32 (int intv, NSString key) | |
134 { | |
135 return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); | |
136 } | |
137 | |
138 void encodeInt64 (long intv, NSString key) | |
139 { | |
140 return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); | |
141 } | |
142 | |
143 void encodeFloat (float realv, NSString key) | |
144 { | |
145 return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); | |
146 } | |
147 | |
148 void encodeDouble (double realv, NSString key) | |
149 { | |
150 return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); | |
151 } | |
152 | |
153 void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) | |
154 { | |
155 return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); | |
156 } | |
157 | |
158 bool containsValueForKey (NSString key) | |
159 { | |
160 return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); | |
161 } | |
162 | |
163 Object decodeObjectForKey (NSString key) | |
164 { | |
165 return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); | |
166 } | |
167 | |
168 bool decodeBoolForKey (NSString key) | |
169 { | |
170 return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); | |
171 } | |
172 | |
173 int decodeIntForKey (NSString key) | |
174 { | |
175 return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); | |
176 } | |
177 | |
178 int decodeInt32ForKey (NSString key) | |
179 { | |
180 return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); | |
181 } | |
182 | |
183 long decodeInt64ForKey (NSString key) | |
184 { | |
185 return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); | |
186 } | |
187 | |
188 float decodeFloatForKey (NSString key) | |
189 { | |
190 return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); | |
191 } | |
192 | |
193 double decodeDoubleForKey (NSString key) | |
194 { | |
195 return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); | |
196 } | |
197 | |
198 char* decodeBytesForKey (NSString key, NSUInteger* lengthp) | |
199 { | |
200 return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); | |
201 } | |
202 | |
203 void encodeInteger (NSInteger intv, NSString key) | |
204 { | |
205 return invokeObjcSelf!(void, "encodeInteger:forKey:", NSInteger, NSString)(intv, key); | |
206 } | |
207 | |
208 NSInteger decodeIntegerForKey (NSString key) | |
209 { | |
210 return invokeObjcSelf!(NSInteger, "decodeIntegerForKey:", NSString)(key); | |
211 } | |
212 `; | |
213 | |
214 const TNSTypedstreamCompatibility = ` | |
215 | |
216 void encodeNXObject (Object object) | |
217 { | |
218 return invokeObjcSelf!(void, "encodeNXObject:", Object)(object); | |
219 } | |
220 | |
221 Object decodeNXObject () | |
222 { | |
223 return invokeObjcSelf!(Object, "decodeNXObject"); | |
224 } | |
225 `; | |
14 | 226 |
15 class NSCoder : NSObject | 227 class NSCoder : NSObject |
16 { | 228 { |
17 mixin ObjcWrap; | 229 mixin (ObjcWrap); |
18 mixin TNSGeometryCoding; | 230 |
19 mixin TNSExtendedCoder; | 231 this () |
20 mixin TNSTypedstreamCompatibility; | 232 { |
21 mixin TNSGeometryKeyedCoding; | 233 super(typeof(this).alloc.init.objcObject); |
234 } | |
235 | |
236 NSCoder init () | |
237 { | |
238 return invokeObjcSelf!(NSCoder, "init"); | |
239 } | |
22 | 240 |
23 void encodeValueOfObjCType (char* type, void* addr) | 241 void encodeValueOfObjCType (char* type, void* addr) |
24 { | 242 { |
25 return invokeObjcSelf!(void, "encodeValueOfObjCType:at:", char*, void*)(type, addr); | 243 return invokeObjcSelf!(void, "encodeValueOfObjCType:at:", char*, void*)(type, addr); |
26 } | 244 } |
42 | 260 |
43 NSInteger versionForClassName (NSString className) | 261 NSInteger versionForClassName (NSString className) |
44 { | 262 { |
45 return invokeObjcSelf!(NSInteger, "versionForClassName:", NSString)(className); | 263 return invokeObjcSelf!(NSInteger, "versionForClassName:", NSString)(className); |
46 } | 264 } |
47 } | 265 |
48 | 266 |
49 template TNSExtendedCoder () | 267 // TNSGeometryCoding |
50 { | 268 void encodePoint (NSPoint point) |
269 { | |
270 return invokeObjcSelf!(void, "encodePoint:", NSPoint)(point); | |
271 } | |
272 | |
273 NSPoint decodePoint () | |
274 { | |
275 return invokeObjcSelf!(NSPoint, "decodePoint"); | |
276 } | |
277 | |
278 void encodeSize (NSSize size) | |
279 { | |
280 return invokeObjcSelf!(void, "encodeSize:", NSSize)(size); | |
281 } | |
282 | |
283 NSSize decodeSize () | |
284 { | |
285 return invokeObjcSelf!(NSSize, "decodeSize"); | |
286 } | |
287 | |
288 void encodeRect (NSRect rect) | |
289 { | |
290 return invokeObjcSelf!(void, "encodeRect:", NSRect)(rect); | |
291 } | |
292 | |
293 NSRect decodeRect () | |
294 { | |
295 return invokeObjcSelf!(NSRect, "decodeRect"); | |
296 } | |
297 | |
298 // TNSExtendedCoder | |
51 void encodeObject (Object object) | 299 void encodeObject (Object object) |
52 { | 300 { |
53 return invokeObjcSelf!(void, "encodeObject:", Object)(object); | 301 return invokeObjcSelf!(void, "encodeObject:", Object)(object); |
54 } | 302 } |
55 | 303 |
56 void encodePropertyList (Object aPropertyList) | 304 void encodePropertyList (Object aPropertyList) |
57 { | 305 { |
58 return invokeObjcSelf!(void, "encodePropertyList:", Object)(aPropertyList); | 306 return invokeObjcSelf!(void, "encodePropertyList:", Object)(aPropertyList); |
59 } | 307 } |
60 | 308 |
61 void encodeRootObject (Object rootObject) | 309 void encodeRootObject (Object rootObject) |
62 { | 310 { |
63 return invokeObjcSelf!(void, "encodeRootObject:", Object)(rootObject); | 311 return invokeObjcSelf!(void, "encodeRootObject:", Object)(rootObject); |
64 } | 312 } |
65 | 313 |
66 void encodeBycopyObject (Object anObject) | 314 void encodeBycopyObject (Object anObject) |
67 { | 315 { |
68 return invokeObjcSelf!(void, "encodeBycopyObject:", Object)(anObject); | 316 return invokeObjcSelf!(void, "encodeBycopyObject:", Object)(anObject); |
69 } | 317 } |
70 | 318 |
71 void encodeByrefObject (Object anObject) | 319 void encodeByrefObject (Object anObject) |
72 { | 320 { |
73 return invokeObjcSelf!(void, "encodeByrefObject:", Object)(anObject); | 321 return invokeObjcSelf!(void, "encodeByrefObject:", Object)(anObject); |
74 } | 322 } |
75 | 323 |
76 void encodeConditionalObject (Object object) | 324 void encodeConditionalObject (Object object) |
77 { | 325 { |
78 return invokeObjcSelf!(void, "encodeConditionalObject:", Object)(object); | 326 return invokeObjcSelf!(void, "encodeConditionalObject:", Object)(object); |
79 } | 327 } |
80 | 328 |
81 void encodeValuesOfObjCTypes (char* encodeValuesOfObjCTypes, ...) | 329 void encodeValuesOfObjCTypes (char* encodeValuesOfObjCTypes, ...) |
82 { | 330 { |
83 return invokeObjcSelf!(void, "encodeValuesOfObjCTypes:", char*)(encodeValuesOfObjCTypes); | 331 return invokeObjcSelf!(void, "encodeValuesOfObjCTypes:", char*)(encodeValuesOfObjCTypes); |
84 } | 332 } |
85 | 333 |
86 void encodeArrayOfObjCType (char* type, NSUInteger count, void* array) | 334 void encodeArrayOfObjCType (char* type, NSUInteger count, void* array) |
87 { | 335 { |
88 return invokeObjcSelf!(void, "encodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(type, count, array); | 336 return invokeObjcSelf!(void, "encodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(type, count, array); |
89 } | 337 } |
90 | 338 |
91 void encodeBytes (void* byteaddr, NSUInteger length) | 339 void encodeBytes (void* byteaddr, NSUInteger length) |
92 { | 340 { |
93 return invokeObjcSelf!(void, "encodeBytes:length:", void*, NSUInteger)(byteaddr, length); | 341 return invokeObjcSelf!(void, "encodeBytes:length:", void*, NSUInteger)(byteaddr, length); |
94 } | 342 } |
95 | 343 |
96 Object decodeObject () | 344 Object decodeObject () |
97 { | 345 { |
98 return invokeObjcSelf!(Object, "decodeObject"); | 346 return invokeObjcSelf!(Object, "decodeObject"); |
99 } | 347 } |
100 | 348 |
101 Object decodePropertyList () | 349 Object decodePropertyList () |
102 { | 350 { |
103 return invokeObjcSelf!(Object, "decodePropertyList"); | 351 return invokeObjcSelf!(Object, "decodePropertyList"); |
104 } | 352 } |
105 | 353 |
106 void decodeValuesOfObjCTypes (char* decodeValuesOfObjCTypes, ...) | 354 void decodeValuesOfObjCTypes (char* decodeValuesOfObjCTypes, ...) |
107 { | 355 { |
108 return invokeObjcSelf!(void, "decodeValuesOfObjCTypes:", char*)(decodeValuesOfObjCTypes); | 356 return invokeObjcSelf!(void, "decodeValuesOfObjCTypes:", char*)(decodeValuesOfObjCTypes); |
109 } | 357 } |
110 | 358 |
111 void decodeArrayOfObjCType (char* itemType, NSUInteger count, void* array) | 359 void decodeArrayOfObjCType (char* itemType, NSUInteger count, void* array) |
112 { | 360 { |
113 return invokeObjcSelf!(void, "decodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(itemType, count, array); | 361 return invokeObjcSelf!(void, "decodeArrayOfObjCType:count:at:", char*, NSUInteger, void*)(itemType, count, array); |
114 } | 362 } |
115 | 363 |
116 void* decodeBytesWithReturnedLength (NSUInteger* lengthp) | 364 void* decodeBytesWithReturnedLength (NSUInteger* lengthp) |
117 { | 365 { |
118 return invokeObjcSelf!(void*, "decodeBytesWithReturnedLength:", NSUInteger*)(lengthp); | 366 return invokeObjcSelf!(void*, "decodeBytesWithReturnedLength:", NSUInteger*)(lengthp); |
119 } | 367 } |
120 | 368 |
121 void setObjectZone (NSZone* zone) | 369 void setObjectZone (NSZone* zone) |
122 { | 370 { |
123 return invokeObjcSelf!(void, "setObjectZone:", NSZone*)(zone); | 371 return invokeObjcSelf!(void, "setObjectZone:", NSZone*)(zone); |
124 } | 372 } |
125 | 373 |
126 NSZone* objectZone () | 374 NSZone* objectZone () |
127 { | 375 { |
128 return invokeObjcSelf!(NSZone*, "objectZone"); | 376 return invokeObjcSelf!(NSZone*, "objectZone"); |
129 } | 377 } |
130 | 378 |
131 uint systemVersion () | 379 uint systemVersion () |
132 { | 380 { |
133 return invokeObjcSelf!(uint, "systemVersion"); | 381 return invokeObjcSelf!(uint, "systemVersion"); |
134 } | 382 } |
135 | 383 |
136 bool allowsKeyedCoding () | 384 bool allowsKeyedCoding () |
137 { | 385 { |
138 return invokeObjcSelf!(bool, "allowsKeyedCoding"); | 386 return invokeObjcSelf!(bool, "allowsKeyedCoding"); |
139 } | 387 } |
140 | 388 |
141 void encodeObject (Object objv, NSString key) | 389 void encodeObject (Object objv, NSString key) |
142 { | 390 { |
143 return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); | 391 return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); |
144 } | 392 } |
145 | 393 |
146 void encodeConditionalObject (Object objv, NSString key) | 394 void encodeConditionalObject (Object objv, NSString key) |
147 { | 395 { |
148 return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); | 396 return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); |
149 } | 397 } |
150 | 398 |
151 void encodeBool (bool boolv, NSString key) | 399 void encodeBool (bool boolv, NSString key) |
152 { | 400 { |
153 return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); | 401 return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); |
154 } | 402 } |
155 | 403 |
156 void encodeInt (int intv, NSString key) | 404 void encodeInt (int intv, NSString key) |
157 { | 405 { |
158 return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); | 406 return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); |
159 } | 407 } |
160 | 408 |
161 void encodeInt32 (int intv, NSString key) | 409 void encodeInt32 (int intv, NSString key) |
162 { | 410 { |
163 return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); | 411 return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); |
164 } | 412 } |
165 | 413 |
166 void encodeInt64 (long intv, NSString key) | 414 void encodeInt64 (long intv, NSString key) |
167 { | 415 { |
168 return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); | 416 return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); |
169 } | 417 } |
170 | 418 |
171 void encodeFloat (float realv, NSString key) | 419 void encodeFloat (float realv, NSString key) |
172 { | 420 { |
173 return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); | 421 return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); |
174 } | 422 } |
175 | 423 |
176 void encodeDouble (double realv, NSString key) | 424 void encodeDouble (double realv, NSString key) |
177 { | 425 { |
178 return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); | 426 return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); |
179 } | 427 } |
180 | 428 |
181 void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) | 429 void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) |
182 { | 430 { |
183 return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); | 431 return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); |
184 } | 432 } |
185 | 433 |
186 bool containsValueForKey (NSString key) | 434 bool containsValueForKey (NSString key) |
187 { | 435 { |
188 return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); | 436 return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); |
189 } | 437 } |
190 | 438 |
191 Object decodeObjectForKey (NSString key) | 439 Object decodeObjectForKey (NSString key) |
192 { | 440 { |
193 return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); | 441 return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); |
194 } | 442 } |
195 | 443 |
196 bool decodeBoolForKey (NSString key) | 444 bool decodeBoolForKey (NSString key) |
197 { | 445 { |
198 return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); | 446 return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); |
199 } | 447 } |
200 | 448 |
201 int decodeIntForKey (NSString key) | 449 int decodeIntForKey (NSString key) |
202 { | 450 { |
203 return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); | 451 return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); |
204 } | 452 } |
205 | 453 |
206 int decodeInt32ForKey (NSString key) | 454 int decodeInt32ForKey (NSString key) |
207 { | 455 { |
208 return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); | 456 return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); |
209 } | 457 } |
210 | 458 |
211 long decodeInt64ForKey (NSString key) | 459 long decodeInt64ForKey (NSString key) |
212 { | 460 { |
213 return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); | 461 return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); |
214 } | 462 } |
215 | 463 |
216 float decodeFloatForKey (NSString key) | 464 float decodeFloatForKey (NSString key) |
217 { | 465 { |
218 return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); | 466 return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); |
219 } | 467 } |
220 | 468 |
221 double decodeDoubleForKey (NSString key) | 469 double decodeDoubleForKey (NSString key) |
222 { | 470 { |
223 return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); | 471 return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); |
224 } | 472 } |
225 | 473 |
226 char* decodeBytesForKey (NSString key, NSUInteger* lengthp) | 474 char* decodeBytesForKey (NSString key, NSUInteger* lengthp) |
227 { | 475 { |
228 return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); | 476 return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); |
229 } | 477 } |
230 | 478 |
231 void encodeInteger (NSInteger intv, NSString key) | 479 void encodeInteger (NSInteger intv, NSString key) |
232 { | 480 { |
233 return invokeObjcSelf!(void, "encodeInteger:forKey:", NSInteger, NSString)(intv, key); | 481 return invokeObjcSelf!(void, "encodeInteger:forKey:", NSInteger, NSString)(intv, key); |
234 } | 482 } |
235 | 483 |
236 NSInteger decodeIntegerForKey (NSString key) | 484 NSInteger decodeIntegerForKey (NSString key) |
237 { | 485 { |
238 return invokeObjcSelf!(NSInteger, "decodeIntegerForKey:", NSString)(key); | 486 return invokeObjcSelf!(NSInteger, "decodeIntegerForKey:", NSString)(key); |
239 } | 487 } |
240 } | 488 |
241 | 489 // TNSTypedstreamCompatibility |
242 template TNSTypedstreamCompatibility () | |
243 { | |
244 void encodeNXObject (Object object) | 490 void encodeNXObject (Object object) |
245 { | 491 { |
246 return invokeObjcSelf!(void, "encodeNXObject:", Object)(object); | 492 return invokeObjcSelf!(void, "encodeNXObject:", Object)(object); |
247 } | 493 } |
248 | 494 |
249 Object decodeNXObject () | 495 Object decodeNXObject () |
250 { | 496 { |
251 return invokeObjcSelf!(Object, "decodeNXObject"); | 497 return invokeObjcSelf!(Object, "decodeNXObject"); |
252 } | 498 } |
253 } | 499 } |
254 | 500 |
255 NSObject NXReadNSObjectFromCoder (NSCoder decoder) | 501 NSObject NXReadNSObjectFromCoder (NSCoder decoder) |
256 { | 502 { |
257 return Bridge.invokeObjcFunction!(NSObject, bindings.NXReadNSObjectFromCoder, NSCoder)(decoder); | 503 //return Bridge.invokeObjcFunction!(NSObject, bindings.NXReadNSObjectFromCoder, NSCoder)(decoder); |
504 | |
505 id result = bindings.NXReadNSObjectFromCoder(decoder ? decoder.objcObject : null); | |
506 return result ? new NSObject(result) : null; | |
258 } | 507 } |
259 |