Mercurial > projects > dstep
comparison dstep/foundation/NSScriptKeyValueCoding.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 |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
7 module dstep.foundation.NSScriptKeyValueCoding; | 7 module dstep.foundation.NSScriptKeyValueCoding; |
8 | 8 |
9 import dstep.foundation.NSObject; | 9 import dstep.foundation.NSObject; |
10 import dstep.foundation.NSString; | 10 import dstep.foundation.NSString; |
11 import dstep.objc.bridge.Bridge; | 11 import dstep.objc.bridge.Bridge; |
12 import dstep.objc.objc : id; | 12 import dstep.objc.objc; |
13 | |
14 | |
13 | 15 |
14 import bindings = dstep.foundation.NSScriptKeyValueCoding_bindings; | 16 import bindings = dstep.foundation.NSScriptKeyValueCoding_bindings; |
15 | 17 |
16 NSString NSOperationNotSupportedForKeyException; | 18 private NSString NSOperationNotSupportedForKeyException_; |
17 | 19 |
18 static this () | 20 NSString NSOperationNotSupportedForKeyException () |
19 { | 21 { |
20 NSOperationNotSupportedForKeyException = new NSString(bindings.NSOperationNotSupportedForKeyException); | 22 if (NSOperationNotSupportedForKeyException_) |
23 return NSOperationNotSupportedForKeyException_; | |
24 | |
25 return NSOperationNotSupportedForKeyException_ = new NSString(bindings.NSOperationNotSupportedForKeyException); | |
21 } | 26 } |
22 | 27 |
23 template TNSScriptKeyValueCoding () | 28 const TNSScriptKeyValueCoding = ` |
24 { | |
25 Object valueAtIndex (NSUInteger index, NSString key); | |
26 Object valueWithName (NSString name, NSString key); | |
27 Object valueWithUniqueID (Object uniqueID, NSString key); | |
28 void insertValue (Object value, NSUInteger index, NSString key); | |
29 void removeValueAtIndex (NSUInteger index, NSString key); | |
30 void replaceValueAtIndex (NSUInteger index, NSString key, Object value); | |
31 void insertValue (Object value, NSString key); | |
32 Object coerceValue (Object value, NSString key); | |
33 } | |
34 | 29 |
30 Object valueAtIndex (NSUInteger index, NSString key) | |
31 { | |
32 return invokeObjcSelf!(Object, "valueAtIndex:inPropertyWithKey:", NSUInteger, NSString)(index, key); | |
33 } | |
34 | |
35 Object valueWithName (NSString name, NSString key) | |
36 { | |
37 return invokeObjcSelf!(Object, "valueWithName:inPropertyWithKey:", NSString, NSString)(name, key); | |
38 } | |
39 | |
40 Object valueWithUniqueID (Object uniqueID, NSString key) | |
41 { | |
42 return invokeObjcSelf!(Object, "valueWithUniqueID:inPropertyWithKey:", Object, NSString)(uniqueID, key); | |
43 } | |
44 | |
45 void insertValue (Object value, NSUInteger index, NSString key) | |
46 { | |
47 return invokeObjcSelf!(void, "insertValue:atIndex:inPropertyWithKey:", Object, NSUInteger, NSString)(value, index, key); | |
48 } | |
49 | |
50 void removeValueAtIndex (NSUInteger index, NSString key) | |
51 { | |
52 return invokeObjcSelf!(void, "removeValueAtIndex:fromPropertyWithKey:", NSUInteger, NSString)(index, key); | |
53 } | |
54 | |
55 void replaceValueAtIndex (NSUInteger index, NSString key, Object value) | |
56 { | |
57 return invokeObjcSelf!(void, "replaceValueAtIndex:inPropertyWithKey:withValue:", NSUInteger, NSString, Object)(index, key, value); | |
58 } | |
59 | |
60 void insertValue (Object value, NSString key) | |
61 { | |
62 return invokeObjcSelf!(void, "insertValue:inPropertyWithKey:", Object, NSString)(value, key); | |
63 } | |
64 | |
65 Object coerceValue (Object value, NSString key) | |
66 { | |
67 return invokeObjcSelf!(Object, "coerceValue:forKey:", Object, NSString)(value, key); | |
68 } | |
69 | |
70 //mixin ObjcBindMethod!(valueAtIndex, "valueAtIndex:inPropertyWithKey:"); | |
71 //mixin ObjcBindMethod!(valueWithName, "valueWithName:inPropertyWithKey:"); | |
72 //mixin ObjcBindMethod!(valueWithUniqueID, "valueWithUniqueID:inPropertyWithKey:"); | |
73 //mixin ObjcBindMethod!(insertValue, "insertValue:atIndex:inPropertyWithKey:"); | |
74 //mixin ObjcBindMethod!(removeValueAtIndex, "removeValueAtIndex:fromPropertyWithKey:"); | |
75 //mixin ObjcBindMethod!(replaceValueAtIndex, "replaceValueAtIndex:inPropertyWithKey:withValue:"); | |
76 //mixin ObjcBindMethod!(insertValue, "insertValue:inPropertyWithKey:"); | |
77 //mixin ObjcBindMethod!(coerceValue, "coerceValue:forKey:"); | |
78 `; |