Mercurial > projects > dstep
annotate dstep/foundation/NSIndexPath.d @ 15:7ff919f595d5
Added the Foundation framework, again
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:31:48 +0200 |
parents | 89f3c3ef1fd2 |
children | 19885b43130e |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSIndexPath; | |
8 | |
9 import dstep.foundation.NSObject; | |
10 import dstep.objc.bridge.Bridge; | |
11 import dstep.objc.objc : id; | |
12 | |
13 class NSIndexPath : NSObject, INSCopying, INSCoding | |
14 { | |
15 mixin ObjcWrap; | |
16 | |
17 static Object indexPathWithIndex (NSUInteger index) | |
18 { | |
19 return invokeObjcSelfClass!(Object, "indexPathWithIndex:", NSUInteger)(index); | |
20 } | |
21 | |
22 static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) | |
23 { | |
24 return invokeObjcSelfClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); | |
25 } | |
26 | |
27 Object initWithIndex (NSUInteger index) | |
28 { | |
29 return invokeObjcSelf!(Object, "initWithIndex:", NSUInteger)(index); | |
30 } | |
31 | |
32 this (NSUInteger index) | |
33 { | |
34 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
35 id result = Bridge.invokeObjcMethod!(id, "initWithIndex:", NSUInteger)(objcObject, index); | |
36 | |
37 if (result) | |
38 objcObject = ret; | |
39 | |
40 dObject = this; | |
41 } | |
42 | |
43 Object initWithIndexes (NSUInteger* indexes, NSUInteger length) | |
44 { | |
45 return invokeObjcSelf!(Object, "initWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); | |
46 } | |
47 | |
48 this (NSUInteger* indexes, NSUInteger length) | |
49 { | |
50 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
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 | |
59 NSIndexPath indexPathByAddingIndex (NSUInteger index) | |
60 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
61 id result = invokeObjcSelf!(id, "indexPathByAddingIndex:", NSUInteger)(index); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
62 return result is this.objcObject ? this : (result !is null ? new NSIndexPath(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
63 } |
14 | 64 |
65 NSIndexPath indexPathByRemovingLastIndex () | |
66 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
67 id result = invokeObjcSelf!(id, "indexPathByRemovingLastIndex"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
68 return result is this.objcObject ? this : (result !is null ? new NSIndexPath(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
69 } |
14 | 70 |
71 NSUInteger indexAtPosition (NSUInteger position) | |
72 { | |
73 return invokeObjcSelf!(NSUInteger, "indexAtPosition:", NSUInteger)(position); | |
74 } | |
75 | |
76 NSUInteger length () | |
77 { | |
78 return invokeObjcSelf!(NSUInteger, "length"); | |
79 } | |
80 | |
81 void getIndexes (NSUInteger* indexes) | |
82 { | |
83 return invokeObjcSelf!(void, "getIndexes:", NSUInteger*)(indexes); | |
84 } | |
85 | |
86 int compare (NSIndexPath otherObject) | |
87 { | |
88 return invokeObjcSelf!(int, "compare:", NSIndexPath)(otherObject); | |
89 } | |
90 | |
91 Object copyWithZone (NSZone* zone) | |
92 { | |
93 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
94 } | |
95 | |
96 void encodeWithCoder (NSCoder aCoder) | |
97 { | |
98 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
99 } | |
100 | |
101 Object initWithCoder (NSCoder aDecoder) | |
102 { | |
103 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | |
104 } | |
105 | |
106 this (NSCoder aDecoder) | |
107 { | |
108 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
109 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder); | |
110 | |
111 if (result) | |
112 objcObject = ret; | |
113 | |
114 dObject = this; | |
115 } | |
116 } | |
117 |