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 {
|
|
61 id result = invokeObjcSelf!(id, "indexPathByAddingIndex:", NSUInteger)(indexreturn result is this.objcObject ? this : (result !is null ? new NSIndexPath(result) : null); }
|
|
62
|
|
63 NSIndexPath indexPathByRemovingLastIndex ()
|
|
64 {
|
|
65 id result = invokeObjcSelf!(id, "indexPathByRemovingLastIndex"return result is this.objcObject ? this : (result !is null ? new NSIndexPath(result) : null); }
|
|
66
|
|
67 NSUInteger indexAtPosition (NSUInteger position)
|
|
68 {
|
|
69 return invokeObjcSelf!(NSUInteger, "indexAtPosition:", NSUInteger)(position);
|
|
70 }
|
|
71
|
|
72 NSUInteger length ()
|
|
73 {
|
|
74 return invokeObjcSelf!(NSUInteger, "length");
|
|
75 }
|
|
76
|
|
77 void getIndexes (NSUInteger* indexes)
|
|
78 {
|
|
79 return invokeObjcSelf!(void, "getIndexes:", NSUInteger*)(indexes);
|
|
80 }
|
|
81
|
|
82 int compare (NSIndexPath otherObject)
|
|
83 {
|
|
84 return invokeObjcSelf!(int, "compare:", NSIndexPath)(otherObject);
|
|
85 }
|
|
86
|
|
87 Object copyWithZone (NSZone* zone)
|
|
88 {
|
|
89 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone);
|
|
90 }
|
|
91
|
|
92 void encodeWithCoder (NSCoder aCoder)
|
|
93 {
|
|
94 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
|
|
95 }
|
|
96
|
|
97 Object initWithCoder (NSCoder aDecoder)
|
|
98 {
|
|
99 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
|
|
100 }
|
|
101
|
|
102 this (NSCoder aDecoder)
|
|
103 {
|
|
104 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
|
|
105 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
|
|
106
|
|
107 if (result)
|
|
108 objcObject = ret;
|
|
109
|
|
110 dObject = this;
|
|
111 }
|
|
112 }
|
|
113
|