Mercurial > projects > dstep
comparison dstep/foundation/NSRange.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 |
---|---|
8 | 8 |
9 import dstep.foundation.NSObjCRuntime; | 9 import dstep.foundation.NSObjCRuntime; |
10 import dstep.foundation.NSString; | 10 import dstep.foundation.NSString; |
11 import dstep.foundation.NSValue; | 11 import dstep.foundation.NSValue; |
12 import dstep.objc.bridge.Bridge; | 12 import dstep.objc.bridge.Bridge; |
13 import dstep.objc.objc : id; | 13 import dstep.objc.objc; |
14 import bindings = dstep.foundation.NSRange_bindings; | |
14 | 15 |
15 alias NSRange* NSRangePointer; | 16 alias NSRange* NSRangePointer; |
16 | 17 |
17 struct NSRange | 18 struct NSRange |
18 { | 19 { |
19 NSUInteger location; | 20 NSUInteger location; |
20 NSUInteger length; | 21 NSUInteger length; |
21 } | 22 } |
22 | 23 |
23 template TNSValueRangeExtensions () | 24 const TNSValueRangeExtensions = ` |
24 { | 25 |
25 static NSValue valueWithRange (NSRange range) | 26 static NSValue valueWithRange (NSRange range) |
26 { | 27 { |
27 return invokeObjcSelfClass!(NSValue, "valueWithRange:", NSRange)(range); | 28 return invokeObjcSuperClass!(NSValue, "valueWithRange:", NSRange)(range); |
28 } | 29 } |
29 | 30 |
30 NSRange rangeValue () | 31 NSRange rangeValue () |
31 { | 32 { |
32 return invokeObjcSelf!(NSRange, "rangeValue"); | 33 return invokeObjcSelf!(NSRange, "rangeValue"); |
33 } | 34 } |
34 } | 35 `; |
35 | 36 |
36 NSString NSStringFromRange (NSRange range) | 37 NSString NSStringFromRange (NSRange range) |
37 { | 38 { |
38 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromRange, NSRange)(range); | 39 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromRange, NSRange)(range); |
39 } | 40 } |