comparison dstep/foundation/NSIndexPath.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
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.NSIndexPath; 7 module dstep.foundation.NSIndexPath;
8 8
9 import dstep.foundation.NSCoder;
10 import dstep.foundation.NSObjCRuntime;
9 import dstep.foundation.NSObject; 11 import dstep.foundation.NSObject;
12 import dstep.foundation.NSZone;
10 import dstep.objc.bridge.Bridge; 13 import dstep.objc.bridge.Bridge;
11 import dstep.objc.objc : id; 14 import dstep.objc.objc;
12 15
13 class NSIndexPath : NSObject, INSCopying, INSCoding 16 class NSIndexPath : NSObject, INSCopying, INSCoding
14 { 17 {
15 mixin ObjcWrap; 18 mixin (ObjcWrap);
16 19
20 this ()
21 {
22 super(typeof(this).alloc.init.objcObject);
23 }
24
25 typeof(this) init ()
26 {
27 return invokeObjcSelf!(typeof(this), "init");
28 }
29
17 static Object indexPathWithIndex (NSUInteger index) 30 static Object indexPathWithIndex (NSUInteger index)
18 { 31 {
19 return invokeObjcSelfClass!(Object, "indexPathWithIndex:", NSUInteger)(index); 32 return invokeObjcSuperClass!(Object, "indexPathWithIndex:", NSUInteger)(index);
20 } 33 }
21 34
22 static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) 35 static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length)
23 { 36 {
24 return invokeObjcSelfClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); 37 return invokeObjcSuperClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length);
25 } 38 }
26 39
27 Object initWithIndex (NSUInteger index) 40 Object initWithIndex (NSUInteger index)
28 { 41 {
29 return invokeObjcSelf!(Object, "initWithIndex:", NSUInteger)(index); 42 return invokeObjcSelf!(Object, "initWithIndex:", NSUInteger)(index);
30 } 43 }
31 44
32 this (NSUInteger index) 45 this (NSUInteger index)
33 { 46 {
34 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 47 typeof(this).alloc.initWithIndex(index);
35 id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, index);
36
37 if (result)
38 objcObject = ret;
39
40 dObject = this;
41 } 48 }
42 49
43 Object initWithIndexes (NSUInteger* indexes, NSUInteger length) 50 Object initWithIndexes (NSUInteger* indexes, NSUInteger length)
44 { 51 {
45 return invokeObjcSelf!(Object, "initWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); 52 return invokeObjcSelf!(Object, "initWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length);
46 } 53 }
47 54
48 this (NSUInteger* indexes, NSUInteger length) 55 this (NSUInteger* indexes, NSUInteger length)
49 { 56 {
50 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 57 typeof(this).alloc.initWithIndexes(indexes, length);
51 id result = Bridge.invokeObjcMethod!(id, "initWithIndexes:length:", NSUInteger*, NSUInteger)(objcObject, indexes, length);
52
53 if (result)
54 objcObject = ret;
55
56 dObject = this;
57 } 58 }
58 59
59 NSIndexPath indexPathByAddingIndex (NSUInteger index) 60 NSIndexPath indexPathByAddingIndex (NSUInteger index)
60 { 61 {
61 id result = invokeObjcSelf!(id, "indexPathByAddingIndex:", NSUInteger)(index); 62 id result = invokeObjcSelf!(id, "indexPathByAddingIndex:", NSUInteger)(index);
103 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); 104 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
104 } 105 }
105 106
106 this (NSCoder aDecoder) 107 this (NSCoder aDecoder)
107 { 108 {
108 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 109 typeof(this).alloc.initWithCoder(aDecoder);
109 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
110
111 if (result)
112 objcObject = ret;
113
114 dObject = this;
115 } 110 }
116 } 111 }
117 112