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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
1 /**
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
3 * Authors: Jacob Carlborg
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
4 * Version: Initial created: Aug 3, 2009
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
6 */
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
7 module dstep.foundation.NSClassDescription;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
8
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
9 import dstep.foundation.NSArray;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
10 import dstep.foundation.NSDictionary;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
11 import dstep.foundation.NSException;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
12 import dstep.foundation.NSObject;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
13 import dstep.foundation.NSString;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
18
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
19 import bindings = dstep.foundation.NSClassDescription_bindings;
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
64
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
65 class NSClassDescription : NSObject
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
78
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
79 static void registerClassDescription (NSClassDescription description, Class aClass)
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
82 }
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
83
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
84 static void invalidateClassDescriptionCache ()
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
87 }
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
88
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
89 static NSClassDescription classDescriptionForClass (Class aClass)
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
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
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
93
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
94 NSArray attributeKeys ()
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
95 {
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
96 return invokeObjcSelf!(NSArray, "attributeKeys");
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
97 }
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
98
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
99 NSArray toOneRelationshipKeys ()
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
100 {
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
101 return invokeObjcSelf!(NSArray, "toOneRelationshipKeys");
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
102 }
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
103
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
104 NSArray toManyRelationshipKeys ()
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
105 {
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
106 return invokeObjcSelf!(NSArray, "toManyRelationshipKeys");
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
107 }
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
108
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
109 NSString inverseForRelationshipKey (NSString relationshipKey)
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
110 {
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
111 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey);
89f3c3ef1fd2 Added the Foundation framework
Jacob Carlborg <doob@me.com>
parents:
diff changeset
112 }
16
19885b43130e Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents: 15
diff changeset
113 }