Mercurial > projects > dstep
comparison 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 |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
10 import dstep.foundation.NSDictionary; | 10 import dstep.foundation.NSDictionary; |
11 import dstep.foundation.NSException; | 11 import dstep.foundation.NSException; |
12 import dstep.foundation.NSObject; | 12 import dstep.foundation.NSObject; |
13 import dstep.foundation.NSString; | 13 import dstep.foundation.NSString; |
14 import dstep.objc.bridge.Bridge; | 14 import dstep.objc.bridge.Bridge; |
15 import dstep.objc.objc : id; | 15 import dstep.objc.objc; |
16 | |
17 | |
16 | 18 |
17 import bindings = dstep.foundation.NSClassDescription_bindings; | 19 import bindings = dstep.foundation.NSClassDescription_bindings; |
18 | 20 |
19 NSString NSClassDescriptionNeededForClassNotification; | 21 private NSString NSClassDescriptionNeededForClassNotification_; |
20 | 22 |
21 static this () | 23 NSString NSClassDescriptionNeededForClassNotification () |
22 { | 24 { |
23 NSClassDescriptionNeededForClassNotification = new NSString(bindings.NSClassDescriptionNeededForClassNotification); | 25 if (NSClassDescriptionNeededForClassNotification_) |
26 return NSClassDescriptionNeededForClassNotification_; | |
27 | |
28 return NSClassDescriptionNeededForClassNotification_ = new NSString(bindings.NSClassDescriptionNeededForClassNotification); | |
24 } | 29 } |
30 | |
31 const TNSClassDescriptionPrimitives = ` | |
32 | |
33 NSClassDescription classDescription () | |
34 { | |
35 return invokeObjcSelf!(NSClassDescription, "classDescription"); | |
36 } | |
37 | |
38 NSArray attributeKeys () | |
39 { | |
40 return invokeObjcSelf!(NSArray, "attributeKeys"); | |
41 } | |
42 | |
43 NSArray toOneRelationshipKeys () | |
44 { | |
45 return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); | |
46 } | |
47 | |
48 NSArray toManyRelationshipKeys () | |
49 { | |
50 return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); | |
51 } | |
52 | |
53 NSString inverseForRelationshipKey (NSString relationshipKey) | |
54 { | |
55 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); | |
56 } | |
57 | |
58 //mixin ObjcBindMethod!(classDescription, "classDescription"); | |
59 //mixin ObjcBindMethod!(attributeKeys, "attributeKeys"); | |
60 //mixin ObjcBindMethod!(toOneRelationshipKeys, "toOneRelationshipKeys"); | |
61 //mixin ObjcBindMethod!(toManyRelationshipKeys, "toManyRelationshipKeys"); | |
62 //mixin ObjcBindMethod!(inverseForRelationshipKey, "inverseForRelationshipKey:"); | |
63 `; | |
25 | 64 |
26 class NSClassDescription : NSObject | 65 class NSClassDescription : NSObject |
27 { | 66 { |
28 mixin ObjcWrap; | 67 mixin (ObjcWrap); |
68 | |
69 this () | |
70 { | |
71 super(typeof(this).alloc.init.objcObject); | |
72 } | |
73 | |
74 typeof(this) init () | |
75 { | |
76 return invokeObjcSelf!(typeof(this), "init"); | |
77 } | |
29 | 78 |
30 static void registerClassDescription (NSClassDescription description, Class aClass) | 79 static void registerClassDescription (NSClassDescription description, Class aClass) |
31 { | 80 { |
32 return invokeObjcSelfClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); | 81 return invokeObjcSuperClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); |
33 } | 82 } |
34 | 83 |
35 static void invalidateClassDescriptionCache () | 84 static void invalidateClassDescriptionCache () |
36 { | 85 { |
37 return invokeObjcSelfClass!(void, "invalidateClassDescriptionCache"); | 86 return invokeObjcSuperClass!(void, "invalidateClassDescriptionCache"); |
38 } | 87 } |
39 | 88 |
40 static NSClassDescription classDescriptionForClass (Class aClass) | 89 static NSClassDescription classDescriptionForClass (Class aClass) |
41 { | 90 { |
42 return invokeObjcSelfClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClass); | 91 return invokeObjcSuperClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClass); |
43 } | 92 } |
44 | 93 |
45 NSArray attributeKeys () | 94 NSArray attributeKeys () |
46 { | 95 { |
47 return invokeObjcSelf!(NSArray, "attributeKeys"); | 96 return invokeObjcSelf!(NSArray, "attributeKeys"); |
60 NSString inverseForRelationshipKey (NSString relationshipKey) | 109 NSString inverseForRelationshipKey (NSString relationshipKey) |
61 { | 110 { |
62 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); | 111 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); |
63 } | 112 } |
64 } | 113 } |
65 | |
66 template TNSClassDescriptionPrimitives () | |
67 { | |
68 NSClassDescription classDescription (); | |
69 NSArray attributeKeys (); | |
70 NSArray toOneRelationshipKeys (); | |
71 NSArray toManyRelationshipKeys (); | |
72 NSString inverseForRelationshipKey (NSString relationshipKey); | |
73 } | |
74 |