comparison dstep/foundation/NSDictionary.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.NSDictionary; 7 module dstep.foundation.NSDictionary;
8 8
9 import dstep.foundation.NSArray; 9 import dstep.foundation.NSArray;
10 import dstep.foundation.NSCoder;
11 import dstep.foundation.NSDate;
10 import dstep.foundation.NSEnumerator; 12 import dstep.foundation.NSEnumerator;
13 import dstep.foundation.NSFileManager;
14 import dstep.foundation.NSValue;
15 import dstep.foundation.NSObjCRuntime;
11 import dstep.foundation.NSObject; 16 import dstep.foundation.NSObject;
12 import dstep.foundation.NSString; 17 import dstep.foundation.NSString;
13 import dstep.foundation.NSURL; 18 import dstep.foundation.NSURL;
19 import dstep.foundation.NSZone;
14 import dstep.objc.bridge.Bridge; 20 import dstep.objc.bridge.Bridge;
15 import dstep.objc.objc : id; 21 import dstep.objc.objc;
22
23 const TNSDictionaryCreation = `
24
25 static Object dictionary ()
26 {
27 return invokeObjcSuperClass!(Object, "dictionary");
28 }
29
30 static Object dictionaryWithObject (Object object, Object key)
31 {
32 return invokeObjcSuperClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key);
33 }
34
35 static Object dictionaryWithObjects (id* objects, id* keys, NSUInteger cnt)
36 {
37 return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt);
38 }
39
40 static Object dictionaryWithObjectsAndKeys (Object dictionaryWithObjectsAndKeys, ...)
41 {
42 return invokeObjcSuperClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys);
43 }
44
45 static Object dictionaryWithDictionary (NSDictionary dict)
46 {
47 return invokeObjcSuperClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict);
48 }
49
50 static Object dictionaryWithObjects (NSArray objects, NSArray keys)
51 {
52 return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys);
53 }
54
55 Object initWithObjects (id* objects, id* keys, NSUInteger cnt)
56 {
57 return invokeObjcSelf!(Object, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt);
58 }
59
60 this (id* objects, id* keys, NSUInteger cnt)
61 {
62 typeof(this).alloc.initWithObjects(objects, keys, cnt);
63 }
64
65 Object initWithObjectsAndKeys (Object initWithObjectsAndKeys, ...)
66 {
67 return invokeObjcSelf!(Object, "initWithObjectsAndKeys:", Object)(initWithObjectsAndKeys);
68 }
69
70 this (Object initWithObjectsAndKeys, ...)
71 {
72 typeof(this).alloc.initWithObjectsAndKeys(initWithObjectsAndKeys);
73 }
74
75 Object initWithDictionary (NSDictionary otherDictionary)
76 {
77 return invokeObjcSelf!(Object, "initWithDictionary:", NSDictionary)(otherDictionary);
78 }
79
80 this (NSDictionary otherDictionary)
81 {
82 typeof(this).alloc.initWithDictionary(otherDictionary);
83 }
84
85 Object initWithDictionary (NSDictionary otherDictionary, bool flag)
86 {
87 return invokeObjcSelf!(Object, "initWithDictionary:copyItems:", NSDictionary, bool)(otherDictionary, flag);
88 }
89
90 this (NSDictionary otherDictionary, bool flag)
91 {
92 typeof(this).alloc.initWithDictionary(otherDictionary, flag);
93 }
94
95 Object initWithObjects (NSArray objects, NSArray keys)
96 {
97 return invokeObjcSelf!(Object, "initWithObjects:forKeys:", NSArray, NSArray)(objects, keys);
98 }
99
100 this (NSArray objects, NSArray keys)
101 {
102 typeof(this).alloc.initWithObjects(objects, keys);
103 }
104
105 static Object dictionaryWithContentsOfFile (NSString path)
106 {
107 return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path);
108 }
109
110 static Object dictionaryWithContentsOfURL (NSURL url)
111 {
112 return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url);
113 }
114
115 Object initWithContentsOfFile (NSString path)
116 {
117 return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path);
118 }
119
120 this (NSString path)
121 {
122 typeof(this).alloc.initWithContentsOfFile(path);
123 }
124
125 Object initWithContentsOfURL (NSURL url)
126 {
127 return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url);
128 }
129
130 this (NSURL url)
131 {
132 typeof(this).alloc.initWithContentsOfURL(url);
133 }
134 `;
135
136 const TNSMutableDictionaryCreation = `
137
138 static Object dictionaryWithCapacity (NSUInteger numItems)
139 {
140 return invokeObjcSuperClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems);
141 }
142
143 Object initWithCapacity (NSUInteger numItems)
144 {
145 return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems);
146 }
147
148 this (NSUInteger numItems)
149 {
150 typeof(this).alloc.initWithCapacity(numItems);
151 }
152 `;
153
154 const TNSExtendedMutableDictionary = `
155
156 void addEntriesFromDictionary (NSDictionary otherDictionary)
157 {
158 return invokeObjcSelf!(void, "addEntriesFromDictionary:", NSDictionary)(otherDictionary);
159 }
160
161 void removeAllObjects ()
162 {
163 return invokeObjcSelf!(void, "removeAllObjects");
164 }
165
166 void removeObjectsForKeys (NSArray keyArray)
167 {
168 return invokeObjcSelf!(void, "removeObjectsForKeys:", NSArray)(keyArray);
169 }
170
171 void setDictionary (NSDictionary otherDictionary)
172 {
173 return invokeObjcSelf!(void, "setDictionary:", NSDictionary)(otherDictionary);
174 }
175 `;
176
177 const TNSExtendedDictionary = `
178
179 NSArray allKeys ()
180 {
181 return invokeObjcSelf!(NSArray, "allKeys");
182 }
183
184 NSArray allKeysForObject (Object anObject)
185 {
186 return invokeObjcSelf!(NSArray, "allKeysForObject:", Object)(anObject);
187 }
188
189 NSArray allValues ()
190 {
191 return invokeObjcSelf!(NSArray, "allValues");
192 }
193
194 NSString description ()
195 {
196 return invokeObjcSelf!(NSString, "description");
197 }
198
199 NSString descriptionInStringsFileFormat ()
200 {
201 return invokeObjcSelf!(NSString, "descriptionInStringsFileFormat");
202 }
203
204 NSString descriptionWithLocale (Object locale)
205 {
206 return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale);
207 }
208
209 NSString descriptionWithLocale (Object locale, NSUInteger level)
210 {
211 return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level);
212 }
213
214 bool isEqualToDictionary (NSDictionary otherDictionary)
215 {
216 return invokeObjcSelf!(bool, "isEqualToDictionary:", NSDictionary)(otherDictionary);
217 }
218
219 NSEnumerator objectEnumerator ()
220 {
221 return invokeObjcSelf!(NSEnumerator, "objectEnumerator");
222 }
223
224 NSArray objectsForKeys (NSArray keys, Object marker)
225 {
226 return invokeObjcSelf!(NSArray, "objectsForKeys:notFoundMarker:", NSArray, Object)(keys, marker);
227 }
228
229 bool writeToFile (NSString path, bool useAuxiliaryFile)
230 {
231 return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile);
232 }
233
234 bool writeToURL (NSURL url, bool atomically)
235 {
236 return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically);
237 }
238
239 NSArray keysSortedByValueUsingSelector (SEL comparator)
240 {
241 return invokeObjcSelf!(NSArray, "keysSortedByValueUsingSelector:", SEL)(comparator);
242 }
243
244 void getObjects (id* objects, id* keys)
245 {
246 return invokeObjcSelf!(void, "getObjects:andKeys:", id*, id*)(objects, keys);
247 }
248 `;
16 249
17 class NSMutableDictionary : NSDictionary 250 class NSMutableDictionary : NSDictionary
18 { 251 {
19 mixin ObjcWrap; 252 mixin (ObjcWrap);
20 mixin TNSMutableDictionaryCreation; 253
21 mixin TNSExtendedMutableDictionary; 254 this ()
255 {
256 super(typeof(this).alloc.init.objcObject);
257 }
258
259 typeof(this) init ()
260 {
261 return invokeObjcSelf!(typeof(this), "init");
262 }
22 263
23 void removeObjectForKey (Object aKey) 264 void removeObjectForKey (Object aKey)
24 { 265 {
25 return invokeObjcSelf!(void, "removeObjectForKey:", Object)(aKey); 266 return invokeObjcSelf!(void, "removeObjectForKey:", Object)(aKey);
26 } 267 }
27 268
28 void setObject (Object anObject, Object aKey) 269 void setObject (Object anObject, Object aKey)
29 { 270 {
30 return invokeObjcSelf!(void, "setObject:forKey:", Object, Object)(anObject, aKey); 271 return invokeObjcSelf!(void, "setObject:forKey:", Object, Object)(anObject, aKey);
272 }
273
274 // TNSMutableDictionaryCreation
275 static Object dictionaryWithCapacity (NSUInteger numItems)
276 {
277 return invokeObjcSuperClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems);
278 }
279
280 Object initWithCapacity (NSUInteger numItems)
281 {
282 return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems);
283 }
284
285 this (NSUInteger numItems)
286 {
287 typeof(this).alloc.initWithCapacity(numItems);
288 }
289
290 // TNSExtendedMutableDictionary
291 void addEntriesFromDictionary (NSDictionary otherDictionary)
292 {
293 return invokeObjcSelf!(void, "addEntriesFromDictionary:", NSDictionary)(otherDictionary);
294 }
295
296 void removeAllObjects ()
297 {
298 return invokeObjcSelf!(void, "removeAllObjects");
299 }
300
301 void removeObjectsForKeys (NSArray keyArray)
302 {
303 return invokeObjcSelf!(void, "removeObjectsForKeys:", NSArray)(keyArray);
304 }
305
306 void setDictionary (NSDictionary otherDictionary)
307 {
308 return invokeObjcSelf!(void, "setDictionary:", NSDictionary)(otherDictionary);
31 } 309 }
32 } 310 }
33 311
34 class NSDictionary : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration 312 class NSDictionary : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration
35 { 313 {
36 mixin ObjcWrap; 314 mixin (ObjcWrap);
37 mixin TNSDictionaryCreation; 315
38 mixin TNSFileAttributes; 316 this ()
39 mixin TNSExtendedDictionary; 317 {
318 super(typeof(this).alloc.init.objcObject);
319 }
320
321 typeof(this) init ()
322 {
323 return invokeObjcSelf!(typeof(this), "init");
324 }
40 325
41 NSUInteger count () 326 NSUInteger count ()
42 { 327 {
43 return invokeObjcSelf!(NSUInteger, "count"); 328 return invokeObjcSelf!(NSUInteger, "count");
44 } 329 }
73 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); 358 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
74 } 359 }
75 360
76 this (NSCoder aDecoder) 361 this (NSCoder aDecoder)
77 { 362 {
78 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 363 typeof(this).alloc.initWithCoder(aDecoder);
79 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
80
81 if (result)
82 objcObject = ret;
83
84 dObject = this;
85 } 364 }
86 365
87 NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) 366 NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len)
88 { 367 {
89 return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); 368 return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len);
90 } 369 }
370
371 // TNSDictionaryCreation
372 static Object dictionary ()
373 {
374 return invokeObjcSuperClass!(Object, "dictionary");
375 }
376
377 static Object dictionaryWithObject (Object object, Object key)
378 {
379 return invokeObjcSuperClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key);
380 }
381
382 static Object dictionaryWithObjects (id* objects, id* keys, NSUInteger cnt)
383 {
384 return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt);
385 }
386
387 static Object dictionaryWithObjectsAndKeys (Object dictionaryWithObjectsAndKeys, ...)
388 {
389 return invokeObjcSuperClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys);
390 }
391
392 static Object dictionaryWithDictionary (NSDictionary dict)
393 {
394 return invokeObjcSuperClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict);
395 }
396
397 static Object dictionaryWithObjects (NSArray objects, NSArray keys)
398 {
399 return invokeObjcSuperClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys);
400 }
401
402 Object initWithObjects (id* objects, id* keys, NSUInteger cnt)
403 {
404 return invokeObjcSelf!(Object, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt);
405 }
406
407 this (id* objects, id* keys, NSUInteger cnt)
408 {
409 typeof(this).alloc.initWithObjects(objects, keys, cnt);
410 }
411
412 Object initWithObjectsAndKeys (Object initWithObjectsAndKeys, ...)
413 {
414 return invokeObjcSelf!(Object, "initWithObjectsAndKeys:", Object)(initWithObjectsAndKeys);
415 }
416
417 this (Object initWithObjectsAndKeys, ...)
418 {
419 typeof(this).alloc.initWithObjectsAndKeys(initWithObjectsAndKeys);
420 }
421
422 Object initWithDictionary (NSDictionary otherDictionary)
423 {
424 return invokeObjcSelf!(Object, "initWithDictionary:", NSDictionary)(otherDictionary);
425 }
426
427 this (NSDictionary otherDictionary)
428 {
429 typeof(this).alloc.initWithDictionary(otherDictionary);
430 }
431
432 Object initWithDictionary (NSDictionary otherDictionary, bool flag)
433 {
434 return invokeObjcSelf!(Object, "initWithDictionary:copyItems:", NSDictionary, bool)(otherDictionary, flag);
435 }
436
437 this (NSDictionary otherDictionary, bool flag)
438 {
439 typeof(this).alloc.initWithDictionary(otherDictionary, flag);
440 }
441
442 Object initWithObjects (NSArray objects, NSArray keys)
443 {
444 return invokeObjcSelf!(Object, "initWithObjects:forKeys:", NSArray, NSArray)(objects, keys);
445 }
446
447 this (NSArray objects, NSArray keys)
448 {
449 typeof(this).alloc.initWithObjects(objects, keys);
450 }
451
452 static Object dictionaryWithContentsOfFile (NSString path)
453 {
454 return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path);
455 }
456
457 static Object dictionaryWithContentsOfURL (NSURL url)
458 {
459 return invokeObjcSuperClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url);
460 }
461
462 Object initWithContentsOfFile (NSString path)
463 {
464 return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path);
465 }
466
467 this (NSString path)
468 {
469 typeof(this).alloc.initWithContentsOfFile(path);
470 }
471
472 Object initWithContentsOfURL (NSURL url)
473 {
474 return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url);
475 }
476
477 this (NSURL url)
478 {
479 typeof(this).alloc.initWithContentsOfURL(url);
480 }
481
482 // TNSFileAttributes
483 ulong fileSize ()
484 {
485 return invokeObjcSelf!(ulong, "fileSize");
486 }
487
488 NSDate fileModificationDate ()
489 {
490 return invokeObjcSelf!(NSDate, "fileModificationDate");
491 }
492
493 NSString fileType ()
494 {
495 return invokeObjcSelf!(NSString, "fileType");
496 }
497
498 NSUInteger filePosixPermissions ()
499 {
500 return invokeObjcSelf!(NSUInteger, "filePosixPermissions");
501 }
502
503 NSString fileOwnerAccountName ()
504 {
505 return invokeObjcSelf!(NSString, "fileOwnerAccountName");
506 }
507
508 NSString fileGroupOwnerAccountName ()
509 {
510 return invokeObjcSelf!(NSString, "fileGroupOwnerAccountName");
511 }
512
513 NSInteger fileSystemNumber ()
514 {
515 return invokeObjcSelf!(NSInteger, "fileSystemNumber");
516 }
517
518 NSUInteger fileSystemFileNumber ()
519 {
520 return invokeObjcSelf!(NSUInteger, "fileSystemFileNumber");
521 }
522
523 bool fileExtensionHidden ()
524 {
525 return invokeObjcSelf!(bool, "fileExtensionHidden");
526 }
527
528 uint fileHFSCreatorCode ()
529 {
530 return invokeObjcSelf!(uint, "fileHFSCreatorCode");
531 }
532
533 uint fileHFSTypeCode ()
534 {
535 return invokeObjcSelf!(uint, "fileHFSTypeCode");
536 }
537
538 bool fileIsImmutable ()
539 {
540 return invokeObjcSelf!(bool, "fileIsImmutable");
541 }
542
543 bool fileIsAppendOnly ()
544 {
545 return invokeObjcSelf!(bool, "fileIsAppendOnly");
546 }
547
548 NSDate fileCreationDate ()
549 {
550 return invokeObjcSelf!(NSDate, "fileCreationDate");
551 }
552
553 NSNumber fileOwnerAccountID ()
554 {
555 return invokeObjcSelf!(NSNumber, "fileOwnerAccountID");
556 }
557
558 NSNumber fileGroupOwnerAccountID ()
559 {
560 return invokeObjcSelf!(NSNumber, "fileGroupOwnerAccountID");
561 }
562
563 // TNSExtendedDictionary
564 NSArray allKeys ()
565 {
566 return invokeObjcSelf!(NSArray, "allKeys");
567 }
568
569 NSArray allKeysForObject (Object anObject)
570 {
571 return invokeObjcSelf!(NSArray, "allKeysForObject:", Object)(anObject);
572 }
573
574 NSArray allValues ()
575 {
576 return invokeObjcSelf!(NSArray, "allValues");
577 }
578
579 NSString description ()
580 {
581 return invokeObjcSelf!(NSString, "description");
582 }
583
584 NSString descriptionInStringsFileFormat ()
585 {
586 return invokeObjcSelf!(NSString, "descriptionInStringsFileFormat");
587 }
588
589 NSString descriptionWithLocale (Object locale)
590 {
591 return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale);
592 }
593
594 NSString descriptionWithLocale (Object locale, NSUInteger level)
595 {
596 return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level);
597 }
598
599 bool isEqualToDictionary (NSDictionary otherDictionary)
600 {
601 return invokeObjcSelf!(bool, "isEqualToDictionary:", NSDictionary)(otherDictionary);
602 }
603
604 NSEnumerator objectEnumerator ()
605 {
606 return invokeObjcSelf!(NSEnumerator, "objectEnumerator");
607 }
608
609 NSArray objectsForKeys (NSArray keys, Object marker)
610 {
611 return invokeObjcSelf!(NSArray, "objectsForKeys:notFoundMarker:", NSArray, Object)(keys, marker);
612 }
613
614 bool writeToFile (NSString path, bool useAuxiliaryFile)
615 {
616 return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile);
617 }
618
619 bool writeToURL (NSURL url, bool atomically)
620 {
621 return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically);
622 }
623
624 NSArray keysSortedByValueUsingSelector (SEL comparator)
625 {
626 return invokeObjcSelf!(NSArray, "keysSortedByValueUsingSelector:", SEL)(comparator);
627 }
628
629 void getObjects (id* objects, id* keys)
630 {
631 return invokeObjcSelf!(void, "getObjects:andKeys:", id*, id*)(objects, keys);
632 }
91 } 633 }
92
93 template TNSDictionaryCreation ()
94 {
95 static Object dictionary ()
96 {
97 return invokeObjcSelfClass!(Object, "dictionary");
98 }
99
100 static Object dictionaryWithObject (Object object, Object key)
101 {
102 return invokeObjcSelfClass!(Object, "dictionaryWithObject:forKey:", Object, Object)(object, key);
103 }
104
105 static Object dictionaryWithObjects (id* objects, id* keys, NSUInteger cnt)
106 {
107 return invokeObjcSelfClass!(Object, "dictionaryWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt);
108 }
109
110 static Object dictionaryWithObjectsAndKeys (Object dictionaryWithObjectsAndKeys, ...)
111 {
112 return invokeObjcSelfClass!(Object, "dictionaryWithObjectsAndKeys:", Object)(dictionaryWithObjectsAndKeys);
113 }
114
115 static Object dictionaryWithDictionary (NSDictionary dict)
116 {
117 return invokeObjcSelfClass!(Object, "dictionaryWithDictionary:", NSDictionary)(dict);
118 }
119
120 static Object dictionaryWithObjects (NSArray objects, NSArray keys)
121 {
122 return invokeObjcSelfClass!(Object, "dictionaryWithObjects:forKeys:", NSArray, NSArray)(objects, keys);
123 }
124
125 Object initWithObjects (id* objects, id* keys, NSUInteger cnt)
126 {
127 return invokeObjcSelf!(Object, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objects, keys, cnt);
128 }
129
130 this (id* objects, id* keys, NSUInteger cnt)
131 {
132 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
133 id result = Bridge.invokeObjcMethod!(id, "initWithObjects:forKeys:count:", id*, id*, NSUInteger)(objcObject, objects, keys, cnt);
134
135 if (result)
136 objcObject = ret;
137
138 dObject = this;
139 }
140
141 Object initWithObjectsAndKeys (Object initWithObjectsAndKeys, ...)
142 {
143 return invokeObjcSelf!(Object, "initWithObjectsAndKeys:", Object)(initWithObjectsAndKeys);
144 }
145
146 this (Object initWithObjectsAndKeys, ...)
147 {
148 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
149 id result = Bridge.invokeObjcMethod!(id, "initWithObjectsAndKeys:", Object)(objcObject, initWithObjectsAndKeys);
150
151 if (result)
152 objcObject = ret;
153
154 dObject = this;
155 }
156
157 Object initWithDictionary (NSDictionary otherDictionary)
158 {
159 return invokeObjcSelf!(Object, "initWithDictionary:", NSDictionary)(otherDictionary);
160 }
161
162 this (NSDictionary otherDictionary)
163 {
164 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
165 id result = Bridge.invokeObjcMethod!(id, "initWithDictionary:", NSDictionary)(objcObject, otherDictionary);
166
167 if (result)
168 objcObject = ret;
169
170 dObject = this;
171 }
172
173 Object initWithDictionary (NSDictionary otherDictionary, bool flag)
174 {
175 return invokeObjcSelf!(Object, "initWithDictionary:copyItems:", NSDictionary, bool)(otherDictionary, flag);
176 }
177
178 this (NSDictionary otherDictionary, bool flag)
179 {
180 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
181 id result = Bridge.invokeObjcMethod!(id, "initWithDictionary:copyItems:", NSDictionary, bool)(objcObject, otherDictionary, flag);
182
183 if (result)
184 objcObject = ret;
185
186 dObject = this;
187 }
188
189 Object initWithObjects (NSArray objects, NSArray keys)
190 {
191 return invokeObjcSelf!(Object, "initWithObjects:forKeys:", NSArray, NSArray)(objects, keys);
192 }
193
194 this (NSArray objects, NSArray keys)
195 {
196 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
197 id result = Bridge.invokeObjcMethod!(id, "initWithObjects:forKeys:", NSArray, NSArray)(objcObject, objects, keys);
198
199 if (result)
200 objcObject = ret;
201
202 dObject = this;
203 }
204
205 static Object dictionaryWithContentsOfFile (NSString path)
206 {
207 return invokeObjcSelfClass!(Object, "dictionaryWithContentsOfFile:", NSString)(path);
208 }
209
210 static Object dictionaryWithContentsOfURL (NSURL url)
211 {
212 return invokeObjcSelfClass!(Object, "dictionaryWithContentsOfURL:", NSURL)(url);
213 }
214
215 Object initWithContentsOfFile (NSString path)
216 {
217 return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path);
218 }
219
220 this (NSString path)
221 {
222 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
223 id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path);
224
225 if (result)
226 objcObject = ret;
227
228 dObject = this;
229 }
230
231 Object initWithContentsOfURL (NSURL url)
232 {
233 return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url);
234 }
235
236 this (NSURL url)
237 {
238 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
239 id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url);
240
241 if (result)
242 objcObject = ret;
243
244 dObject = this;
245 }
246 }
247
248 template TNSMutableDictionaryCreation ()
249 {
250 static Object dictionaryWithCapacity (NSUInteger numItems)
251 {
252 return invokeObjcSelfClass!(Object, "dictionaryWithCapacity:", NSUInteger)(numItems);
253 }
254
255 Object initWithCapacity (NSUInteger numItems)
256 {
257 return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems);
258 }
259
260 this (NSUInteger numItems)
261 {
262 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
263 id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems);
264
265 if (result)
266 objcObject = ret;
267
268 dObject = this;
269 }
270 }
271
272 template TNSExtendedMutableDictionary ()
273 {
274 void addEntriesFromDictionary (NSDictionary otherDictionary)
275 {
276 return invokeObjcSelf!(void, "addEntriesFromDictionary:", NSDictionary)(otherDictionary);
277 }
278
279 void removeAllObjects ()
280 {
281 return invokeObjcSelf!(void, "removeAllObjects");
282 }
283
284 void removeObjectsForKeys (NSArray keyArray)
285 {
286 return invokeObjcSelf!(void, "removeObjectsForKeys:", NSArray)(keyArray);
287 }
288
289 void setDictionary (NSDictionary otherDictionary)
290 {
291 return invokeObjcSelf!(void, "setDictionary:", NSDictionary)(otherDictionary);
292 }
293 }
294
295 template TNSExtendedDictionary ()
296 {
297 NSArray allKeys ()
298 {
299 return invokeObjcSelf!(NSArray, "allKeys");
300 }
301
302 NSArray allKeysForObject (Object anObject)
303 {
304 return invokeObjcSelf!(NSArray, "allKeysForObject:", Object)(anObject);
305 }
306
307 NSArray allValues ()
308 {
309 return invokeObjcSelf!(NSArray, "allValues");
310 }
311
312 NSString description ()
313 {
314 return invokeObjcSelf!(NSString, "description");
315 }
316
317 NSString descriptionInStringsFileFormat ()
318 {
319 return invokeObjcSelf!(NSString, "descriptionInStringsFileFormat");
320 }
321
322 NSString descriptionWithLocale (Object locale)
323 {
324 return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale);
325 }
326
327 NSString descriptionWithLocale (Object locale, NSUInteger level)
328 {
329 return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level);
330 }
331
332 bool isEqualToDictionary (NSDictionary otherDictionary)
333 {
334 return invokeObjcSelf!(bool, "isEqualToDictionary:", NSDictionary)(otherDictionary);
335 }
336
337 NSEnumerator objectEnumerator ()
338 {
339 return invokeObjcSelf!(NSEnumerator, "objectEnumerator");
340 }
341
342 NSArray objectsForKeys (NSArray keys, Object marker)
343 {
344 return invokeObjcSelf!(NSArray, "objectsForKeys:notFoundMarker:", NSArray, Object)(keys, marker);
345 }
346
347 bool writeToFile (NSString path, bool useAuxiliaryFile)
348 {
349 return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile);
350 }
351
352 bool writeToURL (NSURL url, bool atomically)
353 {
354 return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically);
355 }
356
357 NSArray keysSortedByValueUsingSelector (SEL comparator)
358 {
359 return invokeObjcSelf!(NSArray, "keysSortedByValueUsingSelector:", SEL)(comparator);
360 }
361
362 void getObjects (id* objects, id* keys)
363 {
364 return invokeObjcSelf!(void, "getObjects:andKeys:", id*, id*)(objects, keys);
365 }
366 }
367