20 template<
class Function,
class... T>
29 template<
class ReturnType,
class InitialArg,
class...
Args>
33 template<
class DefaultArgsTuple = std::tuple<>, std::
size_t... ArgIndexes>
35 const v8::FunctionCallbackInfo<v8::Value> & info,
36 InitialArg initial_arg,
37 std::index_sequence<ArgIndexes...>,
38 DefaultArgsTuple
const & default_args_tuple = DefaultArgsTuple()) {
42 constexpr
int user_parameter_count =
sizeof...(Args);
43 constexpr
int default_arg_count = std::tuple_size<DefaultArgsTuple>::value;
46 constexpr
int default_parameter_position = default_arg_count - user_parameter_count - 1;
48 std::vector<std::unique_ptr<StuffBase>> stuff;
49 info.GetReturnValue().
51 run_function(
function, info, std::forward<InitialArg>(initial_arg),
54 Args>().
template operator()<ArgIndexes - default_arg_count>(info, i, stuff, default_args_tuple))...)));
59 template<
class InitialArg,
class...
Args>
62 template<
int default_arg_position,
class DefaultArgsTuple = std::tuple<>, std::
size_t... ArgIndexes>
64 const v8::FunctionCallbackInfo<v8::Value> & info,
65 InitialArg initial_arg,
66 std::index_sequence<ArgIndexes...>,
67 DefaultArgsTuple
const & default_args_tuple = DefaultArgsTuple()) {
70 constexpr
auto default_arg_count = std::tuple_size<DefaultArgsTuple>::value;
72 std::vector<std::unique_ptr<StuffBase>> stuff;
73 run_function(
function, info, std::forward<InitialArg>(initial_arg),
74 std::forward<Args>(
ParameterBuilder<Args>().
template operator()<ArgIndexes - default_arg_count - 1>(info, i, stuff,
75 default_args_tuple))...);
84 template<
class ReturnType,
class...
Args>
88 template<
class... Ts,
class DefaultArgsTuple = std::tuple<>, std::size_t... ArgIndexes>
90 const v8::FunctionCallbackInfo<v8::Value> & info,
91 std::index_sequence<ArgIndexes...>,
92 DefaultArgsTuple && default_args_tuple = DefaultArgsTuple(),
93 bool return_most_derived =
false) {
97 constexpr
int user_parameter_count =
sizeof...(Args);
98 constexpr
int default_arg_count = std::tuple_size<std::remove_reference_t<DefaultArgsTuple>>::value;
106 constexpr
int minimum_user_parameters_required = user_parameter_count - default_arg_count;
110 std::vector<std::unique_ptr<StuffBase>> stuff;
112 info.GetReturnValue().Set(
v8toolkit::CastToJS<std::remove_reference_t<ReturnType>>()(info.GetIsolate(),
115 <(((
int)ArgIndexes) - minimum_user_parameters_required), DefaultArgsTuple> (info, i,
125 template<
class...
Args>
128 template<
class DefaultArgsTuple = std::tuple<>, std::
size_t... ArgIndexes>
130 const v8::FunctionCallbackInfo<v8::Value> & info,
131 std::index_sequence<ArgIndexes...>,
132 DefaultArgsTuple && default_args_tuple = DefaultArgsTuple()) {
136 constexpr
int user_parameter_count =
sizeof...(Args);
137 constexpr
int default_arg_count = std::tuple_size<DefaultArgsTuple>::value;
145 constexpr
int minimum_user_parameters_required = user_parameter_count - default_arg_count;
147 std::vector<std::unique_ptr<StuffBase>> stuff;
150 template operator()<(((
int)ArgIndexes) - minimum_user_parameters_required), DefaultArgsTuple>(info, i, stuff,
std::move(default_args_tuple)))...);
162 template<
class DefaultArgsTuple = std::tuple<>, std::
size_t... ArgIndexes>
164 const v8::FunctionCallbackInfo<v8::Value> & info,
165 std::index_sequence<ArgIndexes...>,
166 DefaultArgsTuple
const & default_args_tuple = DefaultArgsTuple()) {
167 static_assert(std::is_same<DefaultArgsTuple, std::tuple<>>::value,
168 "function taking a v8::FunctionCallbackInfo object cannot have default parameters");
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
const T & move(const T &t)