Mercurial > projects > dstep
comparison dstep/foundation/NSObjCRuntime.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 19885b43130e |
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.NSObjCRuntime; | |
8 | |
9 import dstep.AvailabilityMacros; | |
10 import dstep.foundation.NSString; | |
11 import dstep.foundation.Protocol; | |
12 import dstep.limits; | |
13 import dstep.objc.bridge.Bridge; | |
14 import dstep.objc.objc : id; | |
15 import dstep.objc.objc; | |
16 import dstep.stdarg; | |
17 import dstep.stdint; | |
18 | |
19 import bindings = dstep.foundation.NSObjCRuntime_bindings; | |
20 | |
21 alias int NSInteger; | |
22 alias uint NSUInteger; | |
23 alias NSInteger NSComparisonResult; | |
24 | |
25 extern (C) | |
26 { | |
27 extern | |
28 { | |
29 double NSFoundationVersionNumber; | |
30 } | |
31 } | |
32 | |
33 enum _NSComparisonResult | |
34 { | |
35 NSOrderedAscending = -1, | |
36 NSOrderedSame, | |
37 NSOrderedDescending | |
38 } | |
39 | |
40 enum | |
41 { | |
42 NSNotFound = 2147483647L | |
43 } | |
44 | |
45 NSString NSStringFromSelector (SEL aSelector) | |
46 { | |
47 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromSelector, SEL)(aSelector); | |
48 } | |
49 | |
50 SEL NSSelectorFromString (NSString aSelectorName) | |
51 { | |
52 return Bridge.invokeObjcFunction!(SEL, bindings.NSSelectorFromString, NSString)(aSelectorName); | |
53 } | |
54 | |
55 NSString NSStringFromClass (Class aClass) | |
56 { | |
57 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromClass, Class)(aClass); | |
58 } | |
59 | |
60 Class NSClassFromString (NSString aClassName) | |
61 { | |
62 return Bridge.invokeObjcFunction!(Class, bindings.NSClassFromString, NSString)(aClassName); | |
63 } | |
64 | |
65 NSString NSStringFromProtocol (Protocol proto) | |
66 { | |
67 return Bridge.invokeObjcFunction!(NSString, bindings.NSStringFromProtocol, Protocol)(proto); | |
68 } | |
69 | |
70 Protocol NSProtocolFromString (NSString namestr) | |
71 { | |
72 return Bridge.invokeObjcFunction!(Protocol, bindings.NSProtocolFromString, NSString)(namestr); | |
73 } | |
74 | |
75 void NSLog (NSString format, ...) | |
76 { | |
77 return Bridge.invokeObjcFunction!(void, bindings.NSLog, NSString)(format); | |
78 } | |
79 | |
80 void NSLogv (NSString format, char* args) | |
81 { | |
82 return Bridge.invokeObjcFunction!(void, bindings.NSLogv, NSString, char*)(format, args); | |
83 } | |
84 | |
85 extern (C) | |
86 { | |
87 char* NSGetSizeAndAlignment (char* typePtr, NSUInteger* sizep, NSUInteger* alignp); | |
88 } |