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.NSScriptCoercionHandler;
|
|
8
|
|
9 import dstep.foundation.NSObject;
|
|
10 import dstep.objc.bridge.Bridge;
|
|
11 import dstep.objc.objc : id;
|
|
12
|
|
13 class NSScriptCoercionHandler : NSObject
|
|
14 {
|
|
15 mixin ObjcWrap;
|
|
16
|
|
17 static NSScriptCoercionHandler sharedCoercionHandler ()
|
|
18 {
|
|
19 return invokeObjcSelfClass!(NSScriptCoercionHandler, "sharedCoercionHandler"return result is this.objcObject ? this : (result !is null ? new NSScriptCoercionHandler(result) : null); }
|
|
20
|
|
21 Object coerceValue (Object value, Class toClass)
|
|
22 {
|
|
23 return invokeObjcSelf!(Object, "coerceValue:toClass:", Object, Class)(value, toClass);
|
|
24 }
|
|
25
|
|
26 void registerCoercer (Object coercer, SEL selector, Class fromClass, Class toClass)
|
|
27 {
|
|
28 return invokeObjcSelf!(void, "registerCoercer:selector:toConvertFromClass:toClass:", Object, SEL, Class, Class)(coercer, selector, fromClass, toClass);
|
|
29 }
|
|
30 }
|
|
31
|