Mercurial > projects > dstep
comparison dstep/foundation/NSClassDescription.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 7ff919f595d5 |
comparison
equal
deleted
inserted
replaced
13:4f583f7e242e | 14:89f3c3ef1fd2 |
---|---|
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; | |
15 import dstep.objc.objc : id; | |
16 | |
17 import bindings = dstep.foundation.NSClassDescription_bindings; | |
18 | |
19 NSString NSClassDescriptionNeededForClassNotification; | |
20 | |
21 static this () | |
22 { | |
23 NSClassDescriptionNeededForClassNotification = new NSString(bindings.NSClassDescriptionNeededForClassNotification); | |
24 } | |
25 | |
26 class NSClassDescription : NSObject | |
27 { | |
28 mixin ObjcWrap; | |
29 | |
30 static void registerClassDescription (NSClassDescription description, Class aClass) | |
31 { | |
32 return invokeObjcSelfClass!(void, "registerClassDescription:forClass:", NSClassDescription, Class)(description, aClass); | |
33 } | |
34 | |
35 static void invalidateClassDescriptionCache () | |
36 { | |
37 return invokeObjcSelfClass!(void, "invalidateClassDescriptionCache"); | |
38 } | |
39 | |
40 static NSClassDescription classDescriptionForClass (Class aClass) | |
41 { | |
42 return invokeObjcSelfClass!(NSClassDescription, "classDescriptionForClass:", Class)(aClassreturn result is this.objcObject ? this : (result !is null ? new NSClassDescription(result) : null); } | |
43 | |
44 NSArray attributeKeys () | |
45 { | |
46 return invokeObjcSelf!(NSArray, "attributeKeys"); | |
47 } | |
48 | |
49 NSArray toOneRelationshipKeys () | |
50 { | |
51 return invokeObjcSelf!(NSArray, "toOneRelationshipKeys"); | |
52 } | |
53 | |
54 NSArray toManyRelationshipKeys () | |
55 { | |
56 return invokeObjcSelf!(NSArray, "toManyRelationshipKeys"); | |
57 } | |
58 | |
59 NSString inverseForRelationshipKey (NSString relationshipKey) | |
60 { | |
61 return invokeObjcSelf!(NSString, "inverseForRelationshipKey:", NSString)(relationshipKey); | |
62 } | |
63 } | |
64 | |
65 template TNSClassDescriptionPrimitives () | |
66 { | |
67 NSClassDescription classDescription (); | |
68 NSArray attributeKeys (); | |
69 NSArray toOneRelationshipKeys (); | |
70 NSArray toManyRelationshipKeys (); | |
71 NSString inverseForRelationshipKey (NSString relationshipKey); | |
72 } | |
73 |