Mercurial > projects > dstep
annotate dstep/foundation/NSIndexPath.d @ 25:b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 06 Apr 2010 11:37:27 +0200 |
parents | 19885b43130e |
children |
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 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
9 import dstep.foundation.NSCoder; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
10 import dstep.foundation.NSObjCRuntime; |
14 | 11 import dstep.foundation.NSObject; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
12 import dstep.foundation.NSZone; |
14 | 13 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
14 import dstep.objc.objc; |
14 | 15 |
16 class NSIndexPath : NSObject, INSCopying, INSCoding | |
17 { | |
25
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
18 mixin ObjcWrap; |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
19 |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
20 this (id object) |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
21 { |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
22 super(object); |
b9de51448c6b
Added an id constructor. Changed the string mixin to a template mixin. Added support for building as a dynamic library
Jacob Carlborg <doob@me.com>
parents:
16
diff
changeset
|
23 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
24 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
25 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
26 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
27 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
28 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
29 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
30 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
31 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
32 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
33 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
34 |
14 | 35 static Object indexPathWithIndex (NSUInteger index) |
36 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
37 return invokeObjcSuperClass!(Object, "indexPathWithIndex:", NSUInteger)(index); |
14 | 38 } |
39 | |
40 static Object indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) | |
41 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
42 return invokeObjcSuperClass!(Object, "indexPathWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); |
14 | 43 } |
44 | |
45 Object initWithIndex (NSUInteger index) | |
46 { | |
47 return invokeObjcSelf!(Object, "initWithIndex:", NSUInteger)(index); | |
48 } | |
49 | |
50 this (NSUInteger index) | |
51 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
52 typeof(this).alloc.initWithIndex(index); |
14 | 53 } |
54 | |
55 Object initWithIndexes (NSUInteger* indexes, NSUInteger length) | |
56 { | |
57 return invokeObjcSelf!(Object, "initWithIndexes:length:", NSUInteger*, NSUInteger)(indexes, length); | |
58 } | |
59 | |
60 this (NSUInteger* indexes, NSUInteger length) | |
61 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
62 typeof(this).alloc.initWithIndexes(indexes, length); |
14 | 63 } |
64 | |
65 NSIndexPath indexPathByAddingIndex (NSUInteger index) | |
66 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
67 id result = invokeObjcSelf!(id, "indexPathByAddingIndex:", NSUInteger)(index); |
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 NSIndexPath indexPathByRemovingLastIndex () | |
72 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 id result = invokeObjcSelf!(id, "indexPathByRemovingLastIndex"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
74 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
|
75 } |
14 | 76 |
77 NSUInteger indexAtPosition (NSUInteger position) | |
78 { | |
79 return invokeObjcSelf!(NSUInteger, "indexAtPosition:", NSUInteger)(position); | |
80 } | |
81 | |
82 NSUInteger length () | |
83 { | |
84 return invokeObjcSelf!(NSUInteger, "length"); | |
85 } | |
86 | |
87 void getIndexes (NSUInteger* indexes) | |
88 { | |
89 return invokeObjcSelf!(void, "getIndexes:", NSUInteger*)(indexes); | |
90 } | |
91 | |
92 int compare (NSIndexPath otherObject) | |
93 { | |
94 return invokeObjcSelf!(int, "compare:", NSIndexPath)(otherObject); | |
95 } | |
96 | |
97 Object copyWithZone (NSZone* zone) | |
98 { | |
99 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
100 } | |
101 | |
102 void encodeWithCoder (NSCoder aCoder) | |
103 { | |
104 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
105 } | |
106 | |
107 Object initWithCoder (NSCoder aDecoder) | |
108 { | |
109 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | |
110 } | |
111 | |
112 this (NSCoder aDecoder) | |
113 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
114 typeof(this).alloc.initWithCoder(aDecoder); |
14 | 115 } |
116 } | |
117 |