Mercurial > projects > dstep
annotate dstep/foundation/NSClassDescription.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 |
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.NSClassDescription; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSDictionary; | |
11 import dstep.foundation.NSException; | |
12 import dstep.foundation.NSObject; | |
13 import dstep.foundation.NSString; | |
14 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
15 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
16 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
17 |
14 | 18 |
19 import bindings = dstep.foundation.NSClassDescription_bindings; | |
20 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
21 private NSString NSClassDescriptionNeededForClassNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
22 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
23 NSString NSClassDescriptionNeededForClassNotification () |
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 if (NSClassDescriptionNeededForClassNotification_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
26 return NSClassDescriptionNeededForClassNotification_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
27 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
28 return NSClassDescriptionNeededForClassNotification_ = new NSString(bindings.NSClassDescriptionNeededForClassNotification); |
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 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
31 const TNSClassDescriptionPrimitives = ` |
14 | 32 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
33 NSClassDescription classDescription () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
34 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
35 return invokeObjcSelf!(NSClassDescription, "classDescription"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
36 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
37 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
38 NSArray attributeKeys () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
39 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
40 return invokeObjcSelf!(NSArray, "attributeKeys"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
41 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
42 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
43 NSArray toOneRelationshipKeys () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
44 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
45 return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
46 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
47 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
48 NSArray toManyRelationshipKeys () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
49 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
50 return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
51 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
52 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
53 NSString inverseForRelationshipKey (NSString relationshipKey) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
54 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
55 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
56 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
57 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
58 //mixin ObjcBindMethod!(classDescription, "classDescription"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
59 //mixin ObjcBindMethod!(attributeKeys, "attributeKeys"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
60 //mixin ObjcBindMethod!(toOneRelationshipKeys, "toOneRelationshipKeys"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
61 //mixin ObjcBindMethod!(toManyRelationshipKeys, "toManyRelationshipKeys"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
62 //mixin ObjcBindMethod!(inverseForRelationshipKey, "inverseForRelationshipKey:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
63 `; |
14 | 64 |
65 class NSClassDescription : NSObject | |
66 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
67 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
68 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
69 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
70 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
71 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
72 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
73 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
74 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
75 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
76 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
77 } |
14 | 78 |
79 static void registerClassDescription (NSClassDescription description, Class aClass) | |
80 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
81 return invokeObjcSuperClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); |
14 | 82 } |
83 | |
84 static void invalidateClassDescriptionCache () | |
85 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
86 return invokeObjcSuperClass!(void, "invalidateClassDescriptionCache"); |
14 | 87 } |
88 | |
89 static NSClassDescription classDescriptionForClass (Class aClass) | |
90 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
91 return invokeObjcSuperClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClass); |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
92 } |
14 | 93 |
94 NSArray attributeKeys () | |
95 { | |
96 return invokeObjcSelf!(NSArray, "attributeKeys"); | |
97 } | |
98 | |
99 NSArray toOneRelationshipKeys () | |
100 { | |
101 return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); | |
102 } | |
103 | |
104 NSArray toManyRelationshipKeys () | |
105 { | |
106 return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); | |
107 } | |
108 | |
109 NSString inverseForRelationshipKey (NSString relationshipKey) | |
110 { | |
111 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); | |
112 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
15
diff
changeset
|
113 } |