Mercurial > projects > dstep
comparison dstep/foundation/NSArray.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 |
---|---|
4 * Version: Initial created: Aug 3, 2009 | 4 * Version: Initial created: Aug 3, 2009 |
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.NSArray; | 7 module dstep.foundation.NSArray; |
8 | 8 |
9 import dstep.foundation.NSCoder; | |
9 import dstep.foundation.NSData; | 10 import dstep.foundation.NSData; |
10 import dstep.foundation.NSEnumerator; | 11 import dstep.foundation.NSEnumerator; |
11 import dstep.foundation.NSIndexSet; | 12 import dstep.foundation.NSIndexSet; |
13 import dstep.foundation.NSObjCRuntime; | |
12 import dstep.foundation.NSObject; | 14 import dstep.foundation.NSObject; |
15 import dstep.foundation.NSPathUtilities; | |
13 import dstep.foundation.NSRange; | 16 import dstep.foundation.NSRange; |
17 import dstep.foundation.NSSortDescriptor; | |
14 import dstep.foundation.NSString; | 18 import dstep.foundation.NSString; |
15 import dstep.foundation.NSURL; | 19 import dstep.foundation.NSURL; |
20 import dstep.foundation.NSZone; | |
16 import dstep.objc.bridge.Bridge; | 21 import dstep.objc.bridge.Bridge; |
17 import dstep.objc.objc : id; | 22 import dstep.objc.objc; |
23 | |
24 alias extern (C) NSInteger function (id, id, void*) CompareFunc; | |
25 | |
26 const TNSArrayCreation = ` | |
27 | |
28 static Object array () | |
29 { | |
30 return invokeObjcSuperClass!(Object, "array"); | |
31 } | |
32 | |
33 static Object arrayWithObject (Object anObject) | |
34 { | |
35 return invokeObjcSuperClass!(Object, "arrayWithObject:", Object)(anObject); | |
36 } | |
37 | |
38 static Object arrayWithObjects (id* objects, NSUInteger cnt) | |
39 { | |
40 return invokeObjcSuperClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); | |
41 } | |
42 | |
43 static Object arrayWithObjects (Object arrayWithObjects, ...) | |
44 { | |
45 return invokeObjcSuperClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); | |
46 } | |
47 | |
48 static Object arrayWithArray (NSArray array) | |
49 { | |
50 return invokeObjcSuperClass!(Object, "arrayWithArray:", NSArray)(array); | |
51 } | |
52 | |
53 Object initWithObjects (id* objects, NSUInteger cnt) | |
54 { | |
55 return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); | |
56 } | |
57 | |
58 this (id* objects, NSUInteger cnt) | |
59 { | |
60 typeof(this).alloc.initWithObjects(objects, cnt); | |
61 } | |
62 | |
63 Object initWithObjects (Object initWithObjects, ...) | |
64 { | |
65 return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); | |
66 } | |
67 | |
68 this (Object initWithObjects, ...) | |
69 { | |
70 typeof(this).alloc.initWithObjects(initWithObjects); | |
71 } | |
72 | |
73 Object initWithArray (NSArray array) | |
74 { | |
75 return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); | |
76 } | |
77 | |
78 this (NSArray array) | |
79 { | |
80 typeof(this).alloc.initWithArray(array); | |
81 } | |
82 | |
83 Object initWithArray (NSArray array, bool flag) | |
84 { | |
85 return invokeObjcSelf!(Object, "initWithArray:copyItems:", NSArray, bool)(array, flag); | |
86 } | |
87 | |
88 this (NSArray array, bool flag) | |
89 { | |
90 typeof(this).alloc.initWithArray(array, flag); | |
91 } | |
92 | |
93 static Object arrayWithContentsOfFile (NSString path) | |
94 { | |
95 return invokeObjcSuperClass!(Object, "arrayWithContentsOfFile:", NSString)(path); | |
96 } | |
97 | |
98 static Object arrayWithContentsOfURL (NSURL url) | |
99 { | |
100 return invokeObjcSuperClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); | |
101 } | |
102 | |
103 Object initWithContentsOfFile (NSString path) | |
104 { | |
105 return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); | |
106 } | |
107 | |
108 this (NSString path) | |
109 { | |
110 typeof(this).alloc.initWithContentsOfFile(path); | |
111 } | |
112 | |
113 Object initWithContentsOfURL (NSURL url) | |
114 { | |
115 return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); | |
116 } | |
117 | |
118 this (NSURL url) | |
119 { | |
120 typeof(this).alloc.initWithContentsOfURL(url); | |
121 } | |
122 `; | |
123 | |
124 const TNSExtendedArray = ` | |
125 | |
126 NSArray arrayByAddingObject (Object anObject) | |
127 { | |
128 return invokeObjcSelf!(NSArray, "arrayByAddingObject:", Object)(anObject); | |
129 } | |
130 | |
131 NSArray arrayByAddingObjectsFromArray (NSArray otherArray) | |
132 { | |
133 return invokeObjcSelf!(NSArray, "arrayByAddingObjectsFromArray:", NSArray)(otherArray); | |
134 } | |
135 | |
136 NSString componentsJoinedByString (NSString separator) | |
137 { | |
138 return invokeObjcSelf!(NSString, "componentsJoinedByString:", NSString)(separator); | |
139 } | |
140 | |
141 bool containsObject (Object anObject) | |
142 { | |
143 return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); | |
144 } | |
145 | |
146 NSString description () | |
147 { | |
148 return invokeObjcSelf!(NSString, "description"); | |
149 } | |
150 | |
151 NSString descriptionWithLocale (Object locale) | |
152 { | |
153 return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); | |
154 } | |
155 | |
156 NSString descriptionWithLocale (Object locale, NSUInteger level) | |
157 { | |
158 return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); | |
159 } | |
160 | |
161 Object firstObjectCommonWithArray (NSArray otherArray) | |
162 { | |
163 return invokeObjcSelf!(Object, "firstObjectCommonWithArray:", NSArray)(otherArray); | |
164 } | |
165 | |
166 void getObjects (id* objects) | |
167 { | |
168 return invokeObjcSelf!(void, "getObjects:", id*)(objects); | |
169 } | |
170 | |
171 void getObjects (id* objects, NSRange range) | |
172 { | |
173 return invokeObjcSelf!(void, "getObjects:range:", id*, NSRange)(objects, range); | |
174 } | |
175 | |
176 NSUInteger indexOfObject (Object anObject) | |
177 { | |
178 return invokeObjcSelf!(NSUInteger, "indexOfObject:", Object)(anObject); | |
179 } | |
180 | |
181 NSUInteger indexOfObject (Object anObject, NSRange range) | |
182 { | |
183 return invokeObjcSelf!(NSUInteger, "indexOfObject:inRange:", Object, NSRange)(anObject, range); | |
184 } | |
185 | |
186 NSUInteger indexOfObjectIdenticalTo (Object anObject) | |
187 { | |
188 return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:", Object)(anObject); | |
189 } | |
190 | |
191 NSUInteger indexOfObjectIdenticalTo (Object anObject, NSRange range) | |
192 { | |
193 return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); | |
194 } | |
195 | |
196 bool isEqualToArray (NSArray otherArray) | |
197 { | |
198 return invokeObjcSelf!(bool, "isEqualToArray:", NSArray)(otherArray); | |
199 } | |
200 | |
201 Object lastObject () | |
202 { | |
203 return invokeObjcSelf!(Object, "lastObject"); | |
204 } | |
205 | |
206 NSEnumerator objectEnumerator () | |
207 { | |
208 return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); | |
209 } | |
210 | |
211 NSEnumerator reverseObjectEnumerator () | |
212 { | |
213 return invokeObjcSelf!(NSEnumerator, "reverseObjectEnumerator"); | |
214 } | |
215 | |
216 NSData sortedArrayHint () | |
217 { | |
218 return invokeObjcSelf!(NSData, "sortedArrayHint"); | |
219 } | |
220 | |
221 NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context) | |
222 { | |
223 return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", CompareFunc, void*)(comparator, context); | |
224 } | |
225 | |
226 NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context, NSData hint) | |
227 { | |
228 return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", CompareFunc, void*, NSData)(comparator, context, hint); | |
229 } | |
230 | |
231 NSArray sortedArrayUsingSelector (SEL comparator) | |
232 { | |
233 return invokeObjcSelf!(NSArray, "sortedArrayUsingSelector:", SEL)(comparator); | |
234 } | |
235 | |
236 NSArray subarrayWithRange (NSRange range) | |
237 { | |
238 return invokeObjcSelf!(NSArray, "subarrayWithRange:", NSRange)(range); | |
239 } | |
240 | |
241 bool writeToFile (NSString path, bool useAuxiliaryFile) | |
242 { | |
243 return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); | |
244 } | |
245 | |
246 bool writeToURL (NSURL url, bool atomically) | |
247 { | |
248 return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); | |
249 } | |
250 | |
251 void makeObjectsPerformSelector (SEL aSelector) | |
252 { | |
253 return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); | |
254 } | |
255 | |
256 void makeObjectsPerformSelector (SEL aSelector, Object argument) | |
257 { | |
258 return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); | |
259 } | |
260 | |
261 NSArray objectsAtIndexes (NSIndexSet indexes) | |
262 { | |
263 return invokeObjcSelf!(NSArray, "objectsAtIndexes:", NSIndexSet)(indexes); | |
264 } | |
265 `; | |
266 | |
267 const TNSExtendedMutableArray = ` | |
268 | |
269 void addObjectsFromArray (NSArray otherArray) | |
270 { | |
271 return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(otherArray); | |
272 } | |
273 | |
274 void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) | |
275 { | |
276 return invokeObjcSelf!(void, "exchangeObjectAtIndex:withObjectAtIndex:", NSUInteger, NSUInteger)(idx1, idx2); | |
277 } | |
278 | |
279 void removeAllObjects () | |
280 { | |
281 return invokeObjcSelf!(void, "removeAllObjects"); | |
282 } | |
283 | |
284 void removeObject (Object anObject, NSRange range) | |
285 { | |
286 return invokeObjcSelf!(void, "removeObject:inRange:", Object, NSRange)(anObject, range); | |
287 } | |
288 | |
289 void removeObject (Object anObject) | |
290 { | |
291 return invokeObjcSelf!(void, "removeObject:", Object)(anObject); | |
292 } | |
293 | |
294 void removeObjectIdenticalTo (Object anObject, NSRange range) | |
295 { | |
296 return invokeObjcSelf!(void, "removeObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); | |
297 } | |
298 | |
299 void removeObjectIdenticalTo (Object anObject) | |
300 { | |
301 return invokeObjcSelf!(void, "removeObjectIdenticalTo:", Object)(anObject); | |
302 } | |
303 | |
304 void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) | |
305 { | |
306 return invokeObjcSelf!(void, "removeObjectsFromIndices:numIndices:", NSUInteger*, NSUInteger)(indices, cnt); | |
307 } | |
308 | |
309 void removeObjectsInArray (NSArray otherArray) | |
310 { | |
311 return invokeObjcSelf!(void, "removeObjectsInArray:", NSArray)(otherArray); | |
312 } | |
313 | |
314 void removeObjectsInRange (NSRange range) | |
315 { | |
316 return invokeObjcSelf!(void, "removeObjectsInRange:", NSRange)(range); | |
317 } | |
318 | |
319 void replaceObjectsInRange (NSRange range, NSArray otherArray, NSRange otherRange) | |
320 { | |
321 return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:range:", NSRange, NSArray, NSRange)(range, otherArray, otherRange); | |
322 } | |
323 | |
324 void replaceObjectsInRange (NSRange range, NSArray otherArray) | |
325 { | |
326 return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:", NSRange, NSArray)(range, otherArray); | |
327 } | |
328 | |
329 void setArray (NSArray otherArray) | |
330 { | |
331 return invokeObjcSelf!(void, "setArray:", NSArray)(otherArray); | |
332 } | |
333 | |
334 void sortUsingFunction (CompareFunc compare, void* context) | |
335 { | |
336 return invokeObjcSelf!(void, "sortUsingFunction:context:", CompareFunc, void*)(compare, context); | |
337 } | |
338 | |
339 void sortUsingSelector (SEL comparator) | |
340 { | |
341 return invokeObjcSelf!(void, "sortUsingSelector:", SEL)(comparator); | |
342 } | |
343 | |
344 void insertObjects (NSArray objects, NSIndexSet indexes) | |
345 { | |
346 return invokeObjcSelf!(void, "insertObjects:atIndexes:", NSArray, NSIndexSet)(objects, indexes); | |
347 } | |
348 | |
349 void removeObjectsAtIndexes (NSIndexSet indexes) | |
350 { | |
351 return invokeObjcSelf!(void, "removeObjectsAtIndexes:", NSIndexSet)(indexes); | |
352 } | |
353 | |
354 void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) | |
355 { | |
356 return invokeObjcSelf!(void, "replaceObjectsAtIndexes:withObjects:", NSIndexSet, NSArray)(indexes, objects); | |
357 } | |
358 `; | |
359 | |
360 const TNSMutableArrayCreation = ` | |
361 | |
362 static Object arrayWithCapacity (NSUInteger numItems) | |
363 { | |
364 return invokeObjcSuperClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); | |
365 } | |
366 | |
367 Object initWithCapacity (NSUInteger numItems) | |
368 { | |
369 return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); | |
370 } | |
371 | |
372 this (NSUInteger numItems) | |
373 { | |
374 typeof(this).alloc.initWithCapacity(numItems); | |
375 } | |
376 `; | |
18 | 377 |
19 class NSMutableArray : NSArray | 378 class NSMutableArray : NSArray |
20 { | 379 { |
21 mixin ObjcWrap; | 380 mixin (ObjcWrap); |
22 mixin TNSExtendedMutableArray; | 381 |
23 mixin TNSMutableArrayCreation; | 382 this () |
383 { | |
384 super(typeof(this).alloc.init.objcObject); | |
385 } | |
386 | |
387 typeof(this) init () | |
388 { | |
389 return invokeObjcSelf!(typeof(this), "init"); | |
390 } | |
24 | 391 |
25 void addObject (Object anObject) | 392 void addObject (Object anObject) |
26 { | 393 { |
27 return invokeObjcSelf!(void, "addObject:", Object)(anObject); | 394 return invokeObjcSelf!(void, "addObject:", Object)(anObject); |
28 } | 395 } |
43 } | 410 } |
44 | 411 |
45 void replaceObjectAtIndex (NSUInteger index, Object anObject) | 412 void replaceObjectAtIndex (NSUInteger index, Object anObject) |
46 { | 413 { |
47 return invokeObjcSelf!(void, "replaceObjectAtIndex:withObject:", NSUInteger, Object)(index, anObject); | 414 return invokeObjcSelf!(void, "replaceObjectAtIndex:withObject:", NSUInteger, Object)(index, anObject); |
415 } | |
416 | |
417 // NSExtendedMutableArray | |
418 void addObjectsFromArray (NSArray otherArray) | |
419 { | |
420 return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(otherArray); | |
421 } | |
422 | |
423 void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) | |
424 { | |
425 return invokeObjcSelf!(void, "exchangeObjectAtIndex:withObjectAtIndex:", NSUInteger, NSUInteger)(idx1, idx2); | |
426 } | |
427 | |
428 void removeAllObjects () | |
429 { | |
430 return invokeObjcSelf!(void, "removeAllObjects"); | |
431 } | |
432 | |
433 void removeObject (Object anObject, NSRange range) | |
434 { | |
435 return invokeObjcSelf!(void, "removeObject:inRange:", Object, NSRange)(anObject, range); | |
436 } | |
437 | |
438 void removeObject (Object anObject) | |
439 { | |
440 return invokeObjcSelf!(void, "removeObject:", Object)(anObject); | |
441 } | |
442 | |
443 void removeObjectIdenticalTo (Object anObject, NSRange range) | |
444 { | |
445 return invokeObjcSelf!(void, "removeObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); | |
446 } | |
447 | |
448 void removeObjectIdenticalTo (Object anObject) | |
449 { | |
450 return invokeObjcSelf!(void, "removeObjectIdenticalTo:", Object)(anObject); | |
451 } | |
452 | |
453 void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) | |
454 { | |
455 return invokeObjcSelf!(void, "removeObjectsFromIndices:numIndices:", NSUInteger*, NSUInteger)(indices, cnt); | |
456 } | |
457 | |
458 void removeObjectsInArray (NSArray otherArray) | |
459 { | |
460 return invokeObjcSelf!(void, "removeObjectsInArray:", NSArray)(otherArray); | |
461 } | |
462 | |
463 void removeObjectsInRange (NSRange range) | |
464 { | |
465 return invokeObjcSelf!(void, "removeObjectsInRange:", NSRange)(range); | |
466 } | |
467 | |
468 void replaceObjectsInRange (NSRange range, NSArray otherArray, NSRange otherRange) | |
469 { | |
470 return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:range:", NSRange, NSArray, NSRange)(range, otherArray, otherRange); | |
471 } | |
472 | |
473 void replaceObjectsInRange (NSRange range, NSArray otherArray) | |
474 { | |
475 return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:", NSRange, NSArray)(range, otherArray); | |
476 } | |
477 | |
478 void setArray (NSArray otherArray) | |
479 { | |
480 return invokeObjcSelf!(void, "setArray:", NSArray)(otherArray); | |
481 } | |
482 | |
483 void sortUsingFunction (CompareFunc compare, void* context) | |
484 { | |
485 return invokeObjcSelf!(void, "sortUsingFunction:context:", CompareFunc, void*)(compare, context); | |
486 } | |
487 | |
488 void sortUsingSelector (SEL comparator) | |
489 { | |
490 return invokeObjcSelf!(void, "sortUsingSelector:", SEL)(comparator); | |
491 } | |
492 | |
493 void insertObjects (NSArray objects, NSIndexSet indexes) | |
494 { | |
495 return invokeObjcSelf!(void, "insertObjects:atIndexes:", NSArray, NSIndexSet)(objects, indexes); | |
496 } | |
497 | |
498 void removeObjectsAtIndexes (NSIndexSet indexes) | |
499 { | |
500 return invokeObjcSelf!(void, "removeObjectsAtIndexes:", NSIndexSet)(indexes); | |
501 } | |
502 | |
503 void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) | |
504 { | |
505 return invokeObjcSelf!(void, "replaceObjectsAtIndexes:withObjects:", NSIndexSet, NSArray)(indexes, objects); | |
506 } | |
507 | |
508 | |
509 // NSMutableArrayCreation | |
510 static Object arrayWithCapacity (NSUInteger numItems) | |
511 { | |
512 return invokeObjcSuperClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); | |
513 } | |
514 | |
515 Object initWithCapacity (NSUInteger numItems) | |
516 { | |
517 return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); | |
518 } | |
519 | |
520 this (NSUInteger numItems) | |
521 { | |
522 typeof(this).alloc.initWithCapacity(numItems); | |
48 } | 523 } |
49 } | 524 } |
50 | 525 |
51 class NSArray : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration | 526 class NSArray : NSObject, INSCopying, INSMutableCopying, INSCoding, INSFastEnumeration |
52 { | 527 { |
53 mixin ObjcWrap; | 528 mixin (ObjcWrap); |
54 mixin TNSArrayCreation; | 529 |
55 mixin TNSExtendedArray; | 530 this () |
56 mixin TNSSortDescriptorSorting; | 531 { |
57 mixin TNSArrayPathExtensions; | 532 super(typeof(this).alloc.init.objcObject); |
533 } | |
534 | |
535 typeof(this) init () | |
536 { | |
537 return invokeObjcSelf!(typeof(this), "init"); | |
538 } | |
58 | 539 |
59 NSUInteger count () | 540 NSUInteger count () |
60 { | 541 { |
61 return invokeObjcSelf!(NSUInteger, "count"); | 542 return invokeObjcSelf!(NSUInteger, "count"); |
62 } | 543 } |
86 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | 567 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); |
87 } | 568 } |
88 | 569 |
89 this (NSCoder aDecoder) | 570 this (NSCoder aDecoder) |
90 { | 571 { |
91 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 572 typeof(this).alloc.initWithCoder(aDecoder); |
92 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); | |
93 | |
94 if (result) | |
95 objcObject = ret; | |
96 | |
97 dObject = this; | |
98 } | 573 } |
99 | 574 |
100 NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) | 575 NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) |
101 { | 576 { |
102 return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); | 577 return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); |
103 } | 578 } |
579 | |
580 // NSArrayCreation | |
581 static Object array () | |
582 { | |
583 return invokeObjcSuperClass!(Object, "array"); | |
584 } | |
585 | |
586 static Object arrayWithObject (Object anObject) | |
587 { | |
588 return invokeObjcSuperClass!(Object, "arrayWithObject:", Object)(anObject); | |
589 } | |
590 | |
591 static Object arrayWithObjects (id* objects, NSUInteger cnt) | |
592 { | |
593 return invokeObjcSuperClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); | |
594 } | |
595 | |
596 static Object arrayWithObjects (Object arrayWithObjects, ...) | |
597 { | |
598 return invokeObjcSuperClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); | |
599 } | |
600 | |
601 static Object arrayWithArray (NSArray array) | |
602 { | |
603 return invokeObjcSuperClass!(Object, "arrayWithArray:", NSArray)(array); | |
604 } | |
605 | |
606 Object initWithObjects (id* objects, NSUInteger cnt) | |
607 { | |
608 return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); | |
609 } | |
610 | |
611 this (id* objects, NSUInteger cnt) | |
612 { | |
613 typeof(this).alloc.initWithObjects(objects, cnt); | |
614 } | |
615 | |
616 Object initWithObjects (Object initWithObjects, ...) | |
617 { | |
618 return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); | |
619 } | |
620 | |
621 this (Object initWithObjects, ...) | |
622 { | |
623 typeof(this).alloc.initWithObjects(initWithObjects); | |
624 } | |
625 | |
626 Object initWithArray (NSArray array) | |
627 { | |
628 return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); | |
629 } | |
630 | |
631 this (NSArray array) | |
632 { | |
633 typeof(this).alloc.initWithArray(array); | |
634 } | |
635 | |
636 Object initWithArray (NSArray array, bool flag) | |
637 { | |
638 return invokeObjcSelf!(Object, "initWithArray:copyItems:", NSArray, bool)(array, flag); | |
639 } | |
640 | |
641 this (NSArray array, bool flag) | |
642 { | |
643 typeof(this).alloc.initWithArray(array, flag); | |
644 } | |
645 | |
646 static Object arrayWithContentsOfFile (NSString path) | |
647 { | |
648 return invokeObjcSuperClass!(Object, "arrayWithContentsOfFile:", NSString)(path); | |
649 } | |
650 | |
651 static Object arrayWithContentsOfURL (NSURL url) | |
652 { | |
653 return invokeObjcSuperClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); | |
654 } | |
655 | |
656 Object initWithContentsOfFile (NSString path) | |
657 { | |
658 return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); | |
659 } | |
660 | |
661 this (NSString path) | |
662 { | |
663 typeof(this).alloc.initWithContentsOfFile(path); | |
664 } | |
665 | |
666 Object initWithContentsOfURL (NSURL url) | |
667 { | |
668 return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); | |
669 } | |
670 | |
671 this (NSURL url) | |
672 { | |
673 typeof(this).alloc.initWithContentsOfURL(url); | |
674 } | |
675 | |
676 // NSExtendedArray | |
677 NSArray arrayByAddingObject (Object anObject) | |
678 { | |
679 return invokeObjcSelf!(NSArray, "arrayByAddingObject:", Object)(anObject); | |
680 } | |
681 | |
682 NSArray arrayByAddingObjectsFromArray (NSArray otherArray) | |
683 { | |
684 return invokeObjcSelf!(NSArray, "arrayByAddingObjectsFromArray:", NSArray)(otherArray); | |
685 } | |
686 | |
687 NSString componentsJoinedByString (NSString separator) | |
688 { | |
689 return invokeObjcSelf!(NSString, "componentsJoinedByString:", NSString)(separator); | |
690 } | |
691 | |
692 bool containsObject (Object anObject) | |
693 { | |
694 return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); | |
695 } | |
696 | |
697 NSString description () | |
698 { | |
699 return invokeObjcSelf!(NSString, "description"); | |
700 } | |
701 | |
702 NSString descriptionWithLocale (Object locale) | |
703 { | |
704 return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); | |
705 } | |
706 | |
707 NSString descriptionWithLocale (Object locale, NSUInteger level) | |
708 { | |
709 return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); | |
710 } | |
711 | |
712 Object firstObjectCommonWithArray (NSArray otherArray) | |
713 { | |
714 return invokeObjcSelf!(Object, "firstObjectCommonWithArray:", NSArray)(otherArray); | |
715 } | |
716 | |
717 void getObjects (id* objects) | |
718 { | |
719 return invokeObjcSelf!(void, "getObjects:", id*)(objects); | |
720 } | |
721 | |
722 void getObjects (id* objects, NSRange range) | |
723 { | |
724 return invokeObjcSelf!(void, "getObjects:range:", id*, NSRange)(objects, range); | |
725 } | |
726 | |
727 NSUInteger indexOfObject (Object anObject) | |
728 { | |
729 return invokeObjcSelf!(NSUInteger, "indexOfObject:", Object)(anObject); | |
730 } | |
731 | |
732 NSUInteger indexOfObject (Object anObject, NSRange range) | |
733 { | |
734 return invokeObjcSelf!(NSUInteger, "indexOfObject:inRange:", Object, NSRange)(anObject, range); | |
735 } | |
736 | |
737 NSUInteger indexOfObjectIdenticalTo (Object anObject) | |
738 { | |
739 return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:", Object)(anObject); | |
740 } | |
741 | |
742 NSUInteger indexOfObjectIdenticalTo (Object anObject, NSRange range) | |
743 { | |
744 return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); | |
745 } | |
746 | |
747 bool isEqualToArray (NSArray otherArray) | |
748 { | |
749 return invokeObjcSelf!(bool, "isEqualToArray:", NSArray)(otherArray); | |
750 } | |
751 | |
752 Object lastObject () | |
753 { | |
754 return invokeObjcSelf!(Object, "lastObject"); | |
755 } | |
756 | |
757 NSEnumerator objectEnumerator () | |
758 { | |
759 return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); | |
760 } | |
761 | |
762 NSEnumerator reverseObjectEnumerator () | |
763 { | |
764 return invokeObjcSelf!(NSEnumerator, "reverseObjectEnumerator"); | |
765 } | |
766 | |
767 NSData sortedArrayHint () | |
768 { | |
769 return invokeObjcSelf!(NSData, "sortedArrayHint"); | |
770 } | |
771 | |
772 NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context) | |
773 { | |
774 return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", CompareFunc, void*)(comparator, context); | |
775 } | |
776 | |
777 NSArray sortedArrayUsingFunction (CompareFunc comparator, void* context, NSData hint) | |
778 { | |
779 return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", CompareFunc, void*, NSData)(comparator, context, hint); | |
780 } | |
781 | |
782 NSArray sortedArrayUsingSelector (SEL comparator) | |
783 { | |
784 return invokeObjcSelf!(NSArray, "sortedArrayUsingSelector:", SEL)(comparator); | |
785 } | |
786 | |
787 NSArray subarrayWithRange (NSRange range) | |
788 { | |
789 return invokeObjcSelf!(NSArray, "subarrayWithRange:", NSRange)(range); | |
790 } | |
791 | |
792 bool writeToFile (NSString path, bool useAuxiliaryFile) | |
793 { | |
794 return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); | |
795 } | |
796 | |
797 bool writeToURL (NSURL url, bool atomically) | |
798 { | |
799 return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); | |
800 } | |
801 | |
802 void makeObjectsPerformSelector (SEL aSelector) | |
803 { | |
804 return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); | |
805 } | |
806 | |
807 void makeObjectsPerformSelector (SEL aSelector, Object argument) | |
808 { | |
809 return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); | |
810 } | |
811 | |
812 NSArray objectsAtIndexes (NSIndexSet indexes) | |
813 { | |
814 return invokeObjcSelf!(NSArray, "objectsAtIndexes:", NSIndexSet)(indexes); | |
815 } | |
816 | |
817 // NSSortDescriptorSorting | |
818 NSArray sortedArrayUsingDescriptors (NSArray sortDescriptors) | |
819 { | |
820 return invokeObjcSelf!(NSArray, "sortedArrayUsingDescriptors:", NSArray)(sortDescriptors); | |
821 } | |
822 | |
823 // NSArrayPathExtensions | |
824 NSArray pathsMatchingExtensions (NSArray filterTypes) | |
825 { | |
826 return invokeObjcSelf!(NSArray, "pathsMatchingExtensions:", NSArray)(filterTypes); | |
827 } | |
104 } | 828 } |
105 | |
106 template TNSArrayCreation () | |
107 { | |
108 static Object array () | |
109 { | |
110 return invokeObjcSelfClass!(Object, "array"); | |
111 } | |
112 | |
113 static Object arrayWithObject (Object anObject) | |
114 { | |
115 return invokeObjcSelfClass!(Object, "arrayWithObject:", Object)(anObject); | |
116 } | |
117 | |
118 static Object arrayWithObjects (id* objects, NSUInteger cnt) | |
119 { | |
120 return invokeObjcSelfClass!(Object, "arrayWithObjects:count:", id*, NSUInteger)(objects, cnt); | |
121 } | |
122 | |
123 static Object arrayWithObjects (Object arrayWithObjects, ...) | |
124 { | |
125 return invokeObjcSelfClass!(Object, "arrayWithObjects:", Object)(arrayWithObjects); | |
126 } | |
127 | |
128 static Object arrayWithArray (NSArray array) | |
129 { | |
130 return invokeObjcSelfClass!(Object, "arrayWithArray:", NSArray)(array); | |
131 } | |
132 | |
133 Object initWithObjects (id* objects, NSUInteger cnt) | |
134 { | |
135 return invokeObjcSelf!(Object, "initWithObjects:count:", id*, NSUInteger)(objects, cnt); | |
136 } | |
137 | |
138 this (id* objects, NSUInteger cnt) | |
139 { | |
140 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
141 id result = Bridge.invokeObjcMethod!(id, "initWithObjects:count:", id*, NSUInteger)(objcObject, objects, cnt); | |
142 | |
143 if (result) | |
144 objcObject = ret; | |
145 | |
146 dObject = this; | |
147 } | |
148 | |
149 Object initWithObjects (Object initWithObjects, ...) | |
150 { | |
151 return invokeObjcSelf!(Object, "initWithObjects:", Object)(initWithObjects); | |
152 } | |
153 | |
154 this (Object initWithObjects, ...) | |
155 { | |
156 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
157 id result = Bridge.invokeObjcMethod!(id, "initWithObjects:", Object)(objcObject, initWithObjects); | |
158 | |
159 if (result) | |
160 objcObject = ret; | |
161 | |
162 dObject = this; | |
163 } | |
164 | |
165 Object initWithArray (NSArray array) | |
166 { | |
167 return invokeObjcSelf!(Object, "initWithArray:", NSArray)(array); | |
168 } | |
169 | |
170 this (NSArray array) | |
171 { | |
172 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
173 id result = Bridge.invokeObjcMethod!(id, "initWithArray:", NSArray)(objcObject, array); | |
174 | |
175 if (result) | |
176 objcObject = ret; | |
177 | |
178 dObject = this; | |
179 } | |
180 | |
181 Object initWithArray (NSArray array, bool flag) | |
182 { | |
183 return invokeObjcSelf!(Object, "initWithArray:copyItems:", NSArray, bool)(array, flag); | |
184 } | |
185 | |
186 this (NSArray array, bool flag) | |
187 { | |
188 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
189 id result = Bridge.invokeObjcMethod!(id, "initWithArray:copyItems:", NSArray, bool)(objcObject, array, flag); | |
190 | |
191 if (result) | |
192 objcObject = ret; | |
193 | |
194 dObject = this; | |
195 } | |
196 | |
197 static Object arrayWithContentsOfFile (NSString path) | |
198 { | |
199 return invokeObjcSelfClass!(Object, "arrayWithContentsOfFile:", NSString)(path); | |
200 } | |
201 | |
202 static Object arrayWithContentsOfURL (NSURL url) | |
203 { | |
204 return invokeObjcSelfClass!(Object, "arrayWithContentsOfURL:", NSURL)(url); | |
205 } | |
206 | |
207 Object initWithContentsOfFile (NSString path) | |
208 { | |
209 return invokeObjcSelf!(Object, "initWithContentsOfFile:", NSString)(path); | |
210 } | |
211 | |
212 this (NSString path) | |
213 { | |
214 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
215 id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfFile:", NSString)(objcObject, path); | |
216 | |
217 if (result) | |
218 objcObject = ret; | |
219 | |
220 dObject = this; | |
221 } | |
222 | |
223 Object initWithContentsOfURL (NSURL url) | |
224 { | |
225 return invokeObjcSelf!(Object, "initWithContentsOfURL:", NSURL)(url); | |
226 } | |
227 | |
228 this (NSURL url) | |
229 { | |
230 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
231 id result = Bridge.invokeObjcMethod!(id, "initWithContentsOfURL:", NSURL)(objcObject, url); | |
232 | |
233 if (result) | |
234 objcObject = ret; | |
235 | |
236 dObject = this; | |
237 } | |
238 } | |
239 | |
240 template TNSExtendedArray () | |
241 { | |
242 NSArray arrayByAddingObject (Object anObject) | |
243 { | |
244 return invokeObjcSelf!(NSArray, "arrayByAddingObject:", Object)(anObject); | |
245 } | |
246 | |
247 NSArray arrayByAddingObjectsFromArray (NSArray otherArray) | |
248 { | |
249 return invokeObjcSelf!(NSArray, "arrayByAddingObjectsFromArray:", NSArray)(otherArray); | |
250 } | |
251 | |
252 NSString componentsJoinedByString (NSString separator) | |
253 { | |
254 return invokeObjcSelf!(NSString, "componentsJoinedByString:", NSString)(separator); | |
255 } | |
256 | |
257 bool containsObject (Object anObject) | |
258 { | |
259 return invokeObjcSelf!(bool, "containsObject:", Object)(anObject); | |
260 } | |
261 | |
262 NSString description () | |
263 { | |
264 return invokeObjcSelf!(NSString, "description"); | |
265 } | |
266 | |
267 NSString descriptionWithLocale (Object locale) | |
268 { | |
269 return invokeObjcSelf!(NSString, "descriptionWithLocale:", Object)(locale); | |
270 } | |
271 | |
272 NSString descriptionWithLocale (Object locale, NSUInteger level) | |
273 { | |
274 return invokeObjcSelf!(NSString, "descriptionWithLocale:indent:", Object, NSUInteger)(locale, level); | |
275 } | |
276 | |
277 Object firstObjectCommonWithArray (NSArray otherArray) | |
278 { | |
279 return invokeObjcSelf!(Object, "firstObjectCommonWithArray:", NSArray)(otherArray); | |
280 } | |
281 | |
282 void getObjects (id* objects) | |
283 { | |
284 return invokeObjcSelf!(void, "getObjects:", id*)(objects); | |
285 } | |
286 | |
287 void getObjects (id* objects, NSRange range) | |
288 { | |
289 return invokeObjcSelf!(void, "getObjects:range:", id*, NSRange)(objects, range); | |
290 } | |
291 | |
292 NSUInteger indexOfObject (Object anObject) | |
293 { | |
294 return invokeObjcSelf!(NSUInteger, "indexOfObject:", Object)(anObject); | |
295 } | |
296 | |
297 NSUInteger indexOfObject (Object anObject, NSRange range) | |
298 { | |
299 return invokeObjcSelf!(NSUInteger, "indexOfObject:inRange:", Object, NSRange)(anObject, range); | |
300 } | |
301 | |
302 NSUInteger indexOfObjectIdenticalTo (Object anObject) | |
303 { | |
304 return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:", Object)(anObject); | |
305 } | |
306 | |
307 NSUInteger indexOfObjectIdenticalTo (Object anObject, NSRange range) | |
308 { | |
309 return invokeObjcSelf!(NSUInteger, "indexOfObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); | |
310 } | |
311 | |
312 bool isEqualToArray (NSArray otherArray) | |
313 { | |
314 return invokeObjcSelf!(bool, "isEqualToArray:", NSArray)(otherArray); | |
315 } | |
316 | |
317 Object lastObject () | |
318 { | |
319 return invokeObjcSelf!(Object, "lastObject"); | |
320 } | |
321 | |
322 NSEnumerator objectEnumerator () | |
323 { | |
324 return invokeObjcSelf!(NSEnumerator, "objectEnumerator"); | |
325 } | |
326 | |
327 NSEnumerator reverseObjectEnumerator () | |
328 { | |
329 return invokeObjcSelf!(NSEnumerator, "reverseObjectEnumerator"); | |
330 } | |
331 | |
332 NSData sortedArrayHint () | |
333 { | |
334 return invokeObjcSelf!(NSData, "sortedArrayHint"); | |
335 } | |
336 | |
337 NSArray sortedArrayUsingFunction (NSInteger *id, id, void* comparator, void* context) | |
338 { | |
339 return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:", NSInteger *id, id, void*, void*)(comparator, context); | |
340 } | |
341 | |
342 NSArray sortedArrayUsingFunction (NSInteger *id, id, void* comparator, void* context, NSData hint) | |
343 { | |
344 return invokeObjcSelf!(NSArray, "sortedArrayUsingFunction:context:hint:", NSInteger *id, id, void*, void*, NSData)(comparator, context, hint); | |
345 } | |
346 | |
347 NSArray sortedArrayUsingSelector (SEL comparator) | |
348 { | |
349 return invokeObjcSelf!(NSArray, "sortedArrayUsingSelector:", SEL)(comparator); | |
350 } | |
351 | |
352 NSArray subarrayWithRange (NSRange range) | |
353 { | |
354 return invokeObjcSelf!(NSArray, "subarrayWithRange:", NSRange)(range); | |
355 } | |
356 | |
357 bool writeToFile (NSString path, bool useAuxiliaryFile) | |
358 { | |
359 return invokeObjcSelf!(bool, "writeToFile:atomically:", NSString, bool)(path, useAuxiliaryFile); | |
360 } | |
361 | |
362 bool writeToURL (NSURL url, bool atomically) | |
363 { | |
364 return invokeObjcSelf!(bool, "writeToURL:atomically:", NSURL, bool)(url, atomically); | |
365 } | |
366 | |
367 void makeObjectsPerformSelector (SEL aSelector) | |
368 { | |
369 return invokeObjcSelf!(void, "makeObjectsPerformSelector:", SEL)(aSelector); | |
370 } | |
371 | |
372 void makeObjectsPerformSelector (SEL aSelector, Object argument) | |
373 { | |
374 return invokeObjcSelf!(void, "makeObjectsPerformSelector:withObject:", SEL, Object)(aSelector, argument); | |
375 } | |
376 | |
377 NSArray objectsAtIndexes (NSIndexSet indexes) | |
378 { | |
379 return invokeObjcSelf!(NSArray, "objectsAtIndexes:", NSIndexSet)(indexes); | |
380 } | |
381 } | |
382 | |
383 template TNSExtendedMutableArray () | |
384 { | |
385 void addObjectsFromArray (NSArray otherArray) | |
386 { | |
387 return invokeObjcSelf!(void, "addObjectsFromArray:", NSArray)(otherArray); | |
388 } | |
389 | |
390 void exchangeObjectAtIndex (NSUInteger idx1, NSUInteger idx2) | |
391 { | |
392 return invokeObjcSelf!(void, "exchangeObjectAtIndex:withObjectAtIndex:", NSUInteger, NSUInteger)(idx1, idx2); | |
393 } | |
394 | |
395 void removeAllObjects () | |
396 { | |
397 return invokeObjcSelf!(void, "removeAllObjects"); | |
398 } | |
399 | |
400 void removeObject (Object anObject, NSRange range) | |
401 { | |
402 return invokeObjcSelf!(void, "removeObject:inRange:", Object, NSRange)(anObject, range); | |
403 } | |
404 | |
405 void removeObject (Object anObject) | |
406 { | |
407 return invokeObjcSelf!(void, "removeObject:", Object)(anObject); | |
408 } | |
409 | |
410 void removeObjectIdenticalTo (Object anObject, NSRange range) | |
411 { | |
412 return invokeObjcSelf!(void, "removeObjectIdenticalTo:inRange:", Object, NSRange)(anObject, range); | |
413 } | |
414 | |
415 void removeObjectIdenticalTo (Object anObject) | |
416 { | |
417 return invokeObjcSelf!(void, "removeObjectIdenticalTo:", Object)(anObject); | |
418 } | |
419 | |
420 void removeObjectsFromIndices (NSUInteger* indices, NSUInteger cnt) | |
421 { | |
422 return invokeObjcSelf!(void, "removeObjectsFromIndices:numIndices:", NSUInteger*, NSUInteger)(indices, cnt); | |
423 } | |
424 | |
425 void removeObjectsInArray (NSArray otherArray) | |
426 { | |
427 return invokeObjcSelf!(void, "removeObjectsInArray:", NSArray)(otherArray); | |
428 } | |
429 | |
430 void removeObjectsInRange (NSRange range) | |
431 { | |
432 return invokeObjcSelf!(void, "removeObjectsInRange:", NSRange)(range); | |
433 } | |
434 | |
435 void replaceObjectsInRange (NSRange range, NSArray otherArray, NSRange otherRange) | |
436 { | |
437 return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:range:", NSRange, NSArray, NSRange)(range, otherArray, otherRange); | |
438 } | |
439 | |
440 void replaceObjectsInRange (NSRange range, NSArray otherArray) | |
441 { | |
442 return invokeObjcSelf!(void, "replaceObjectsInRange:withObjectsFromArray:", NSRange, NSArray)(range, otherArray); | |
443 } | |
444 | |
445 void setArray (NSArray otherArray) | |
446 { | |
447 return invokeObjcSelf!(void, "setArray:", NSArray)(otherArray); | |
448 } | |
449 | |
450 void sortUsingFunction (NSInteger *id, id, void* compare, void* context) | |
451 { | |
452 return invokeObjcSelf!(void, "sortUsingFunction:context:", NSInteger *id, id, void*, void*)(compare, context); | |
453 } | |
454 | |
455 void sortUsingSelector (SEL comparator) | |
456 { | |
457 return invokeObjcSelf!(void, "sortUsingSelector:", SEL)(comparator); | |
458 } | |
459 | |
460 void insertObjects (NSArray objects, NSIndexSet indexes) | |
461 { | |
462 return invokeObjcSelf!(void, "insertObjects:atIndexes:", NSArray, NSIndexSet)(objects, indexes); | |
463 } | |
464 | |
465 void removeObjectsAtIndexes (NSIndexSet indexes) | |
466 { | |
467 return invokeObjcSelf!(void, "removeObjectsAtIndexes:", NSIndexSet)(indexes); | |
468 } | |
469 | |
470 void replaceObjectsAtIndexes (NSIndexSet indexes, NSArray objects) | |
471 { | |
472 return invokeObjcSelf!(void, "replaceObjectsAtIndexes:withObjects:", NSIndexSet, NSArray)(indexes, objects); | |
473 } | |
474 } | |
475 | |
476 template TNSMutableArrayCreation () | |
477 { | |
478 static Object arrayWithCapacity (NSUInteger numItems) | |
479 { | |
480 return invokeObjcSelfClass!(Object, "arrayWithCapacity:", NSUInteger)(numItems); | |
481 } | |
482 | |
483 Object initWithCapacity (NSUInteger numItems) | |
484 { | |
485 return invokeObjcSelf!(Object, "initWithCapacity:", NSUInteger)(numItems); | |
486 } | |
487 | |
488 this (NSUInteger numItems) | |
489 { | |
490 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
491 id result = Bridge.invokeObjcMethod!(id, "initWithCapacity:", NSUInteger)(objcObject, numItems); | |
492 | |
493 if (result) | |
494 objcObject = ret; | |
495 | |
496 dObject = this; | |
497 } | |
498 } | |
499 |