Mercurial > projects > dstep
annotate 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 |
rev | line source |
---|---|
14 | 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.NSRange; | |
8 | |
9 import dstep.foundation.NSObjCRuntime; | |
10 import dstep.foundation.NSString; | |
11 import dstep.foundation.NSValue; | |
12 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
13 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
14 import bindings = dstep.foundation.NSRange_bindings; |
14 | 15 |
16 alias NSRange* NSRangePointer; | |
17 | |
18 struct NSRange | |
19 { | |
20 NSUInteger location; | |
21 NSUInteger length; | |
22 } | |
23 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 const TNSValueRangeExtensions = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 |
14 | 26 static NSValue valueWithRange (NSRange range) |
27 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 return invokeObjcSuperClass!(NSValue, "valueWithRange:", NSRange)(range); |
14 | 29 } |
30 | |
31 NSRange rangeValue () | |
32 { | |
33 return invokeObjcSelf!(NSRange, "rangeValue"); | |
34 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
35 `; |
14 | 36 |
37 NSString NSStringFromRange (NSRange range) | |
38 { | |
39 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromRange, NSRange)(range); | |
40 } | |
41 | |
42 NSRange NSRangeFromString (NSString aString) | |
43 { | |
44 return Bridge.invokeObjcFunction!(NSRange, bindings.NSRangeFromString, NSString)(aString); | |
45 } | |
46 | |
47 extern (C) | |
48 { | |
49 NSRange NSUnionRange (NSRange range1, NSRange range2); | |
50 NSRange NSIntersectionRange (NSRange range1, NSRange range2); | |
51 } |