Mercurial > projects > dstep
annotate dstep/foundation/NSSortDescriptor.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 |
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.NSSortDescriptor; | |
8 | |
9 import dstep.foundation.NSArray; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
10 import dstep.foundation.NSCoder; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
11 import dstep.foundation.NSObject; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
12 import dstep.foundation.NSString; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
13 import dstep.foundation.NSZone; |
14 | 14 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 import dstep.objc.objc; |
14 | 16 |
17 class NSSortDescriptor : NSObject, INSCoding, INSCopying | |
18 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
19 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 } |
14 | 30 |
31 Object initWithKey (NSString key, bool ascending) | |
32 { | |
33 return invokeObjcSelf!(Object, "initWithKey:ascending:", NSString, bool)(key, ascending); | |
34 } | |
35 | |
36 this (NSString key, bool ascending) | |
37 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
38 typeof(this).alloc.initWithKey(key, ascending); |
14 | 39 } |
40 | |
41 Object initWithKey (NSString key, bool ascending, SEL selector) | |
42 { | |
43 return invokeObjcSelf!(Object, "initWithKey:ascending:selector:", NSString, bool, SEL)(key, ascending, selector); | |
44 } | |
45 | |
46 this (NSString key, bool ascending, SEL selector) | |
47 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 typeof(this).alloc.initWithKey(key, ascending, selector); |
14 | 49 } |
50 | |
51 NSString key () | |
52 { | |
53 return invokeObjcSelf!(NSString, "key"); | |
54 } | |
55 | |
56 bool ascending () | |
57 { | |
58 return invokeObjcSelf!(bool, "ascending"); | |
59 } | |
60 | |
61 SEL selector () | |
62 { | |
63 return invokeObjcSelf!(SEL, "selector"); | |
64 } | |
65 | |
66 int compareObject (Object object1, Object object2) | |
67 { | |
68 return invokeObjcSelf!(int, "compareObject:toObject:", Object, Object)(object1, object2); | |
69 } | |
70 | |
71 Object reversedSortDescriptor () | |
72 { | |
73 return invokeObjcSelf!(Object, "reversedSortDescriptor"); | |
74 } | |
75 | |
76 void encodeWithCoder (NSCoder aCoder) | |
77 { | |
78 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
79 } | |
80 | |
81 Object initWithCoder (NSCoder aDecoder) | |
82 { | |
83 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | |
84 } | |
85 | |
86 this (NSCoder aDecoder) | |
87 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
88 typeof(this).alloc.initWithCoder(aDecoder); |
14 | 89 } |
90 | |
91 Object copyWithZone (NSZone* zone) | |
92 { | |
93 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
94 } | |
95 } | |
96 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
97 const TNSSortDescriptorSorting = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
98 |
14 | 99 NSArray sortedArrayUsingDescriptors (NSArray sortDescriptors) |
100 { | |
101 return invokeObjcSelf!(NSArray, "sortedArrayUsingDescriptors:", NSArray)(sortDescriptors); | |
102 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
103 `; |
14 | 104 |