|
@@ -27,11 +27,29 @@ package cpp;
|
|
|
#if cpp extern #end
|
|
|
abstract Callable<T>(T)
|
|
|
{
|
|
|
+ inline public function new(inValue:T) this = inValue;
|
|
|
public var call(get,never):T;
|
|
|
+ inline function get_call():T return this;
|
|
|
|
|
|
- inline public function new(inValue:T) this = inValue;
|
|
|
+ #if cpp
|
|
|
+ @:from
|
|
|
+ inline static public function fromFunction<F>( func:Function<F,cpp.abi.Abi> ) : Callable<F>
|
|
|
+ return new Callable<F>(cast func);
|
|
|
+ @:to
|
|
|
+ inline public function toFunction() : Function<T,cpp.abi.Abi> return cast this;
|
|
|
|
|
|
- inline function get_call():T return this;
|
|
|
+
|
|
|
+ inline public static function getProcAddress<T,ABI:cpp.abi.Abi>(inModule:String, inFunction:String) : Function<T,ABI>
|
|
|
+ return Function.getProcAddress(inModule, inFunction);
|
|
|
+
|
|
|
+ inline public static function fromStaticFunction<T>(inStaticFunction:T) : Callable<T>
|
|
|
+ return Function.fromStaticFunction(inStaticFunction);
|
|
|
+
|
|
|
+ inline public function lt(inOther:Callable<T>):Bool return toFunction().lt(inOther.toFunction());
|
|
|
+ inline public function leq(inOther:Callable<T>):Bool return toFunction().leq(inOther.toFunction());
|
|
|
+ inline public function gt(inOther:Callable<T>):Bool return toFunction().gt(inOther.toFunction());
|
|
|
+ inline public function geq(inOther:Callable<T>):Bool return toFunction().geq(inOther.toFunction());
|
|
|
+ #end
|
|
|
}
|
|
|
|
|
|
|