|
| template<auto callable, GetterFor< callable > thisGetter = nullptr> |
| static bool | ToJSNative (JSContext *cx, unsigned argc, JS::Value *vp) |
| | The meat of this file. More...
|
| |
| template<typename R , typename ... Args> |
| static bool | Call (const Request &rq, JS::HandleValue val, const char *name, R &ret, const Args &... args) |
| | Call a JS function name, property of object val, with the arguments args. More...
|
| |
| template<typename ... Args> |
| static bool | Call (const Request &rq, JS::HandleValue val, const char *name, JS::MutableHandleValue ret, const Args &... args) |
| |
| template<typename ... Args> |
| static bool | CallVoid (const Request &rq, JS::HandleValue val, const char *name, const Args &... args) |
| | Call a JS function name, property of object val, with the arguments args. More...
|
| |
| template<typename Callback > |
| static JS::Value | RunGenerator (const Request &rq, JS::HandleValue val, const char *name, JS::HandleValue arg, Callback yieldCallback) |
| | Call a JS function name, property of object val, with the argument args. More...
|
| |
| template<auto callable, GetterFor< callable > thisGetter = nullptr> |
| static JSFunctionSpec | Wrap (const char *name, const std::uint16_t flags=JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT) |
| | Return a function spec from a C++ function. More...
|
| |
| template<auto callable, GetterFor< callable > thisGetter = nullptr> |
| static JSFunction * | Create (const Request &rq, const char *name, const std::uint16_t flags=JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT) |
| | Return a JSFunction from a C++ function. More...
|
| |
| template<auto callable, GetterFor< callable > thisGetter = nullptr> |
| static void | Register (const Request &rq, const char *name, const std::uint16_t flags=JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT) |
| | Register a function on the native scope (usually 'Engine'). More...
|
| |
| template<auto callable, GetterFor< callable > thisGetter = nullptr> |
| static void | Register (JSContext *cx, JS::HandleObject scope, const char *name, const std::uint16_t flags=JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT) |
| | Register a function on. More...
|
| |
| template<typename Callable > |
| static StatefulCallback< Callable > | Register (const Request &rq, std::string name, const unsigned flags, Callable callable) |
| |
| template<typename Callable > |
| static StatefulCallback< Callable > | Register (const Request &rq, std::string name, Callable callable) |
| |
|
| template<size_t idx, typename T > |
| static T | DoConvertFromJS (const Request &rq, JS::CallArgs &args, bool &wentOk) |
| | DoConvertFromJS takes a type, a JS argument, and converts. More...
|
| |
| template<typename... T, size_t... idx> |
| static std::tuple< T... > | DoConvertFromJS (std::index_sequence< idx... >, const Request &rq, JS::CallArgs &args, bool &wentOk) |
| | Wrapper: calls DoConvertFromJS for each element in T. More...
|
| |
| template<typename ... Types> |
| static std::tuple< Types... > | ConvertFromJS (const Request &rq, JS::CallArgs &args, bool &wentOk, std::tuple< Types... > *) |
| | ConvertFromJS is a wrapper around DoConvertFromJS, and handles specific cases for the first argument (Request, ...). More...
|
| |
| template<typename ... Types> |
| static std::tuple< const Request &, Types... > | ConvertFromJS (const Request &rq, JS::CallArgs &args, bool &wentOk, std::tuple< const Request &, Types... > *) |
| |
| template<typename ... Types> |
| static std::tuple< const Interface &, Types... > | ConvertFromJS (const Request &rq, JS::CallArgs &args, bool &wentOk, std::tuple< const Interface &, Types... > *) |
| |
| template<auto callable, typename T , typename tuple > |
| static args_info< callable >::return_type | call (T *object, tuple &args) |
| | Wrap std::apply for the case where we have an object method or a regular function. More...
|
| |
| template<typename... Types, size_t... idx> |
| static void | ToJSValVector (std::index_sequence< idx... >, const Request &rq, JS::MutableHandleValueVector argv, const Types &... params) |
| | Converts any number of arguments to a JS::MutableHandleValueVector. More...
|
| |
| template<typename R , typename ... Args> |
| static bool | Call_ (const Request &rq, JS::HandleValue val, const char *name, R &ret, const Args &... args) |
| | Wrapper around calling a JS function from C++. More...
|
| |
template<typename R , typename ... Args>
| static bool Script::Function::Call_ |
( |
const Request & |
rq, |
|
|
JS::HandleValue |
val, |
|
|
const char * |
name, |
|
|
R & |
ret, |
|
|
const Args &... |
args |
|
) |
| |
|
inlinestaticprivate |
Wrapper around calling a JS function from C++.
Arguments are const& to avoid lvalue/rvalue issues, and so can't be used as out-parameters. In particular, the problem is that Rooted are deduced as Rooted, not Handle, and so can't be copied. This could be worked around with more templates, but it doesn't seem particularly worth doing.
template<typename ... Types>
| static std::tuple< Types... > Script::Function::ConvertFromJS |
( |
const Request & |
rq, |
|
|
JS::CallArgs & |
args, |
|
|
bool & |
wentOk, |
|
|
std::tuple< Types... > * |
|
|
) |
| |
|
inlinestaticprivate |
ConvertFromJS is a wrapper around DoConvertFromJS, and handles specific cases for the first argument (Request, ...).
Trick: to unpack the types of the tuple as a parameter pack, we deduce them from the function signature. To do that, we want the tuple in the arguments, but we don't want to actually have to default-instantiate, so we'll pass a nullptr that's static_cast to what we want.