X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/849b0beafc5d722cd9abf4050430600d149cc342..b101f7547000aaa1354792aabc459de7cc9e91de:/JavaScript.hpp?ds=sidebyside diff --git a/JavaScript.hpp b/JavaScript.hpp index 47a9618..64dcbac 100644 --- a/JavaScript.hpp +++ b/JavaScript.hpp @@ -39,6 +39,7 @@ #include "Pooling.hpp" #include "String.hpp" +#include "Utility.hpp" extern JSStringRef Array_s; extern JSStringRef constructor_s; @@ -69,7 +70,7 @@ const char *CYExecute(JSContextRef context, CYPool &pool, CYUTF8String code); void CYCancel(); #endif -void CYSetArgs(int argc, const char *argv[]); +void CYSetArgs(const char *argv0, const char *script, int argc, const char *argv[]); bool CYCastBool(JSContextRef context, JSValueRef value); double CYCastDouble(JSContextRef context, JSValueRef value); @@ -114,6 +115,13 @@ JSObjectRef CYCastJSObject(JSContextRef context, JSValueRef value); JSValueRef CYJSUndefined(JSContextRef context); JSValueRef CYJSNull(JSContextRef context); +void *CYCastPointerEx_(JSContextRef context, JSObjectRef value); + +template +_finline Type_ CYCastPointerEx(JSContextRef context, JSObjectRef value) { + return reinterpret_cast(CYCastPointerEx_(context, value)); +} + void *CYCastPointer_(JSContextRef context, JSValueRef value, bool *guess = NULL); template @@ -194,15 +202,9 @@ class CYJSString { { } - template - CYJSString(Arg0_ arg0) : - string_(CYCopyJSString(arg0)) - { - } - - template - CYJSString(Arg0_ arg0, Arg1_ arg1) : - string_(CYCopyJSString(arg0, arg1)) + template + CYJSString(Args_ &&... args) : + string_(CYCopyJSString(cy::Forward(args)...)) { }