从master分支拉取puerts,并拉取v8制品,修改puerts插件部分UE5_5以下兼容的宏代码。保证puerts编译通过。包括
CSharpParamDefaultValueMetas.cs和ubtplugin.csproj和declarationGenerator.cpp和PropertyTranslator.cpp对UserDefinedStruct.h的引用
This commit is contained in:
@@ -181,6 +181,24 @@ struct TScriptStructTraits<FPlane>
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct TScriptStructTraits<FMatrix>
|
||||
{
|
||||
static UScriptStruct* Get()
|
||||
{
|
||||
return GetScriptStructInCoreUObject(TEXT("Matrix"));
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct TScriptStructTraits<FIntVector4>
|
||||
{
|
||||
static UScriptStruct* Get()
|
||||
{
|
||||
return GetScriptStructInCoreUObject(TEXT("IntVector4"));
|
||||
}
|
||||
};
|
||||
|
||||
template <class...>
|
||||
using ToVoid = void;
|
||||
|
||||
|
||||
@@ -49,6 +49,30 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define __DefCDataConverter_pesapi_impl(CLS) \
|
||||
namespace PUERTS_NAMESPACE \
|
||||
{ \
|
||||
namespace pesapi_impl \
|
||||
{ \
|
||||
template <> \
|
||||
struct Converter<CLS> \
|
||||
{ \
|
||||
static pesapi_value toScript(pesapi_env env, CLS value) \
|
||||
{ \
|
||||
return pesapi_native_object_to_value(env, DynamicTypeId<CLS>::get(&value), new CLS(value), true); \
|
||||
} \
|
||||
static CLS toCpp(pesapi_env env, pesapi_value value) \
|
||||
{ \
|
||||
return *static_cast<CLS*>(pesapi_get_native_object_ptr(env, value)); \
|
||||
} \
|
||||
static bool accept(pesapi_env env, pesapi_value value) \
|
||||
{ \
|
||||
return pesapi_is_instance_of(env, StaticTypeId<CLS>::get(), value); \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace PUERTS_NAMESPACE
|
||||
{
|
||||
namespace pesapi_impl
|
||||
|
||||
@@ -31,18 +31,25 @@
|
||||
&(::PUERTS_NAMESPACE::PropertyWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::getter), \
|
||||
&(::PUERTS_NAMESPACE::PropertyWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::setter), \
|
||||
::PUERTS_NAMESPACE::PropertyWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::info()
|
||||
#define MakePropertyByGetterSetter(Getter, Setter) \
|
||||
&(::PUERTS_NAMESPACE::PropertyGetterWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(Getter), Getter>::getter), \
|
||||
&(::PUERTS_NAMESPACE::PropertySetterWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(Setter), \
|
||||
Setter>::setter), \
|
||||
::PUERTS_NAMESPACE::PropertyGetterSetterInfo<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(Getter), \
|
||||
decltype(Setter)>::info()
|
||||
#define MakeReadonlyProperty(M) \
|
||||
&(::PUERTS_NAMESPACE::PropertyWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::getter), nullptr, \
|
||||
::PUERTS_NAMESPACE::PropertyWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::info()
|
||||
#define MakeVariable(M) MakeProperty(M)
|
||||
#define MakeVariableByGetterSetter(M) MakePropertyByGetterSetter(M)
|
||||
#define MakeReadonlyVariable(M) MakeReadonlyProperty(M)
|
||||
#define MakeFunction(M, ...) \
|
||||
[](::PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API::CallbackInfoType info) \
|
||||
{ \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::callWithDefaultValues( \
|
||||
info, ##__VA_ARGS__); \
|
||||
}, \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::info( \
|
||||
#define MakeFunction(M, ...) \
|
||||
[](::PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API::CallbackInfoType info) \
|
||||
{ \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M, \
|
||||
false>::callWithDefaultValues(info, ##__VA_ARGS__); \
|
||||
}, \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M, false>::info( \
|
||||
PUERTS_NAMESPACE::Count(__VA_ARGS__))
|
||||
#define MakeExtension(M, ...) \
|
||||
[](::PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API::CallbackInfoType info) \
|
||||
@@ -52,13 +59,13 @@
|
||||
}, \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::extensionInfo( \
|
||||
PUERTS_NAMESPACE::Count(__VA_ARGS__))
|
||||
#define SelectFunction(SIGNATURE, M, ...) \
|
||||
[](::PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API::CallbackInfoType info) \
|
||||
{ \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M>::callWithDefaultValues( \
|
||||
info, ##__VA_ARGS__); \
|
||||
}, \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M>::info( \
|
||||
#define SelectFunction(SIGNATURE, M, ...) \
|
||||
[](::PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API::CallbackInfoType info) \
|
||||
{ \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M, \
|
||||
false>::callWithDefaultValues(info, ##__VA_ARGS__); \
|
||||
}, \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M, false>::info( \
|
||||
PUERTS_NAMESPACE::Count(__VA_ARGS__))
|
||||
#define SelectFunction_PtrRet(SIGNATURE, M, ...) \
|
||||
[](::PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API::CallbackInfoType info) \
|
||||
@@ -68,10 +75,11 @@
|
||||
}, \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M, true>::info( \
|
||||
PUERTS_NAMESPACE::Count(__VA_ARGS__))
|
||||
#define MakeCheckFunction(M) \
|
||||
&(::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::checkedCall), \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M>::info()
|
||||
#define MakeOverload(SIGNATURE, M) PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M>
|
||||
#define MakeCheckFunction(M) \
|
||||
&(::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M, false>::checkedCall), \
|
||||
::PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, decltype(M), M, false>::info()
|
||||
#define MakeOverload(SIGNATURE, M) \
|
||||
PUERTS_NAMESPACE::FuncCallWrapper<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, SIGNATURE, M, false>
|
||||
#define CombineOverloads(...) \
|
||||
&::PUERTS_NAMESPACE::OverloadsCombiner<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, __VA_ARGS__>::call, \
|
||||
::PUERTS_NAMESPACE::OverloadsCombiner<PUERTS_NAMESPACE::PUERTS_BINDING_IMPL::API, __VA_ARGS__>::length, \
|
||||
@@ -111,6 +119,9 @@
|
||||
#define __DefCDataPointerConverter_HELPER2(CLS, Suffix) __DefCDataPointerConverter_HELPER1(CLS, Suffix)
|
||||
#define __DefObjectType(CLS) __DefObjectType_HELPER2(CLS, PUERTS_BINDING_IMPL)
|
||||
#define __DefCDataPointerConverter(CLS) __DefCDataPointerConverter_HELPER2(CLS, PUERTS_BINDING_IMPL)
|
||||
#define __DefCDataConverter_HELPER1(CLS, Suffix) __DefCDataConverter_##Suffix(CLS)
|
||||
#define __DefCDataConverter_HELPER2(CLS, Suffix) __DefCDataConverter_HELPER1(CLS, Suffix)
|
||||
#define __DefCDataConverter(CLS) __DefCDataConverter_HELPER2(CLS, PUERTS_BINDING_IMPL)
|
||||
#define UsingNamedCppType(CLS, NAME) __DefScriptTTypeName(NAME, CLS) __DefObjectType(CLS) __DefCDataPointerConverter(CLS)
|
||||
|
||||
#define UsingCppType(CLS) UsingNamedCppType(CLS, CLS)
|
||||
|
||||
@@ -379,6 +379,11 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
void SetArgument(typename ArgumentType<T>::type InArg)
|
||||
{
|
||||
Arg = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
}
|
||||
@@ -418,6 +423,11 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
void SetArgument(typename ArgumentType<T>::type InArg)
|
||||
{
|
||||
Arg = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
if (&Buf != &(Arg.get()))
|
||||
@@ -452,6 +462,11 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
void SetArgument(typename ArgumentType<T>::type InArg)
|
||||
{
|
||||
Arg = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
}
|
||||
@@ -476,6 +491,15 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
using BuffType = typename std::remove_const<typename std::remove_reference<T>::type>::type;
|
||||
BuffType Buf;
|
||||
|
||||
void SetArgument(BuffType InArg)
|
||||
{
|
||||
Buf = InArg;
|
||||
Arg = Buf;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
}
|
||||
@@ -501,6 +525,11 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
void SetArgument(typename ArgumentType<T>::type InArg)
|
||||
{
|
||||
Arg = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
API::UpdateRefValue(context, holder, API::template Converter<typename std::decay<T>::type>::toScript(context, Arg));
|
||||
@@ -527,6 +556,11 @@ private:
|
||||
return Arg ? Arg : &Buf;
|
||||
}
|
||||
|
||||
void SetArgument(BuffType InArg)
|
||||
{
|
||||
Buf = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
API::UpdateRefValue(context, holder, API::template Converter<BuffType>::toScript(context, Buf));
|
||||
@@ -551,6 +585,11 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
void SetArgument(T InArg)
|
||||
{
|
||||
Arg = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
}
|
||||
@@ -574,6 +613,11 @@ private:
|
||||
return Arg;
|
||||
}
|
||||
|
||||
void SetArgument(typename ArgumentType<T>::type InArg)
|
||||
{
|
||||
Arg = InArg;
|
||||
}
|
||||
|
||||
void SetRef(typename API::ContextType context, typename API::ValueType holder)
|
||||
{
|
||||
}
|
||||
@@ -615,7 +659,7 @@ private:
|
||||
{
|
||||
if (argCount <= Pos)
|
||||
{
|
||||
std::get<Pos>(cppArgHolders).Arg = defaultValue;
|
||||
std::get<Pos>(cppArgHolders).SetArgument(defaultValue);
|
||||
}
|
||||
DefaultValueSetter<0, Pos + 1, FullArgs...>::Set(cppArgHolders, argCount, rest...);
|
||||
}
|
||||
@@ -1458,6 +1502,164 @@ struct PropertyWrapper<API, Ret*, Variable>
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename TG, TG, typename Enable = void>
|
||||
struct PropertyGetterWrapper;
|
||||
|
||||
template <typename API, typename Ret, Ret (*fgetter)()>
|
||||
struct PropertyGetterWrapper<API, Ret (*)(), fgetter>
|
||||
{
|
||||
template <typename T>
|
||||
using DecayTypeConverter = typename API::template Converter<typename internal::ConverterDecay<T>::type>;
|
||||
|
||||
static void getter(typename API::CallbackInfoType info)
|
||||
{
|
||||
auto context = API::GetContext(info);
|
||||
API::SetReturn(info, DecayTypeConverter<Ret>::toScript(context, fgetter()));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename Ret, typename Ins, Ret (Ins::*func)()>
|
||||
struct PropertyGetterWrapper<API, Ret (Ins::*)(), func>
|
||||
{
|
||||
template <typename T>
|
||||
using DecayTypeConverter = typename API::template Converter<typename internal::ConverterDecay<T>::type>;
|
||||
|
||||
static void getter(typename API::CallbackInfoType info)
|
||||
{
|
||||
auto context = API::GetContext(info);
|
||||
auto self = DecayTypeConverter<Ins*>::toCpp(context, API::GetThis(info));
|
||||
if (!self)
|
||||
{
|
||||
API::ThrowException(info, "access a null object");
|
||||
return;
|
||||
}
|
||||
|
||||
API::SetReturn(info, API::template Converter<Ret>::toScript(context, (self->*func)()));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename Ret, typename Ins, Ret (Ins::*func)() const>
|
||||
struct PropertyGetterWrapper<API, Ret (Ins::*)() const, func>
|
||||
{
|
||||
template <typename T>
|
||||
using DecayTypeConverter = typename API::template Converter<typename internal::ConverterDecay<T>::type>;
|
||||
|
||||
static void getter(typename API::CallbackInfoType info)
|
||||
{
|
||||
auto context = API::GetContext(info);
|
||||
auto self = DecayTypeConverter<Ins*>::toCpp(context, API::GetThis(info));
|
||||
if (!self)
|
||||
{
|
||||
API::ThrowException(info, "access a null object");
|
||||
return;
|
||||
}
|
||||
|
||||
API::SetReturn(info, API::template Converter<Ret>::toScript(context, (self->*func)()));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API>
|
||||
struct PropertyGetterWrapper<API, decltype(nullptr), nullptr>
|
||||
{
|
||||
static void getter(typename API::CallbackInfoType info)
|
||||
{
|
||||
API::ThrowException(info, "not getter for this property!");
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename TS, TS, typename Enable = void>
|
||||
struct PropertySetterWrapper;
|
||||
|
||||
template <typename API, typename TS, void (*fsetter)(TS)>
|
||||
struct PropertySetterWrapper<API, void (*)(TS), fsetter>
|
||||
{
|
||||
template <typename T>
|
||||
using DecayTypeConverter = typename API::template Converter<typename internal::ConverterDecay<T>::type>;
|
||||
|
||||
static void setter(typename API::CallbackInfoType info)
|
||||
{
|
||||
auto context = API::GetContext(info);
|
||||
fsetter(DecayTypeConverter<TS>::toCpp(context, API::GetArg(info, 0)));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename TS, typename Ins, void (Ins::*func)(TS)>
|
||||
struct PropertySetterWrapper<API, void (Ins::*)(TS), func>
|
||||
{
|
||||
template <typename T>
|
||||
using DecayTypeConverter = typename API::template Converter<typename internal::ConverterDecay<T>::type>;
|
||||
|
||||
static void setter(typename API::CallbackInfoType info)
|
||||
{
|
||||
auto context = API::GetContext(info);
|
||||
auto self = DecayTypeConverter<Ins*>::toCpp(context, API::GetThis(info));
|
||||
if (!self)
|
||||
{
|
||||
API::ThrowException(info, "access a null object");
|
||||
return;
|
||||
}
|
||||
|
||||
(self->*func)(DecayTypeConverter<TS>::toCpp(context, API::GetArg(info, 0)));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API>
|
||||
struct PropertySetterWrapper<API, decltype(nullptr), nullptr>
|
||||
{
|
||||
static void setter(typename API::CallbackInfoType info)
|
||||
{
|
||||
API::ThrowException(info, "not setter for this property!");
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename TG, typename TS>
|
||||
struct PropertyGetterSetterInfo;
|
||||
|
||||
template <typename API, typename Ret, typename TS>
|
||||
struct PropertyGetterSetterInfo<API, Ret (*)(), TS>
|
||||
{
|
||||
static const CTypeInfo* info()
|
||||
{
|
||||
return CTypeInfoImpl<Ret, false>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename Ins, typename Ret, typename TS>
|
||||
struct PropertyGetterSetterInfo<API, Ret (Ins::*)(), TS>
|
||||
{
|
||||
static const CTypeInfo* info()
|
||||
{
|
||||
return CTypeInfoImpl<Ret, false>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename Ins, typename Ret, typename TS>
|
||||
struct PropertyGetterSetterInfo<API, Ret (Ins::*)() const, TS>
|
||||
{
|
||||
static const CTypeInfo* info()
|
||||
{
|
||||
return CTypeInfoImpl<Ret, false>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename Ret, typename TG>
|
||||
struct PropertyGetterSetterInfo<API, TG, void (*)(Ret)>
|
||||
{
|
||||
static const CTypeInfo* info()
|
||||
{
|
||||
return CTypeInfoImpl<Ret, false>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename API, typename Ins, typename Ret, typename TG>
|
||||
struct PropertyGetterSetterInfo<API, TG, void (Ins::*)(Ret)>
|
||||
{
|
||||
static const CTypeInfo* info()
|
||||
{
|
||||
return CTypeInfoImpl<Ret, false>::get();
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, typename API, typename RegisterAPI>
|
||||
class ClassDefineBuilder
|
||||
{
|
||||
|
||||
@@ -490,10 +490,10 @@ struct IsUStructHelper<T, Void_t<decltype(&TScriptStructTraits<T>::Get)>> : std:
|
||||
namespace v8_impl
|
||||
{
|
||||
template <typename T>
|
||||
struct Converter<T*,
|
||||
typename std::enable_if<!std::is_convertible<T*, const UObject*>::value && internal::IsUStructHelper<T>::value>::type>
|
||||
struct Converter<T*, typename std::enable_if<!std::is_const<T>::value && !std::is_convertible<T*, const UObject*>::value &&
|
||||
internal::IsUStructHelper<T>::value>::type>
|
||||
{
|
||||
static v8::Local<v8::Value> toScript(v8::Local<v8::Context> context, T* value)
|
||||
static v8::Local<v8::Value> toScript(v8::Local<v8::Context> context, const T* value)
|
||||
{
|
||||
return DataTransfer::FindOrAddStruct<T>(context->GetIsolate(), context, (void*) value, true);
|
||||
}
|
||||
@@ -509,10 +509,17 @@ struct Converter<T*,
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Converter<const T*,
|
||||
typename std::enable_if<!std::is_convertible<T*, const UObject*>::value && internal::IsUStructHelper<T>::value>::type>
|
||||
: Converter<T*>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Converter<T, typename std::enable_if<internal::IsUStructHelper<T>::value>::type>
|
||||
{
|
||||
static v8::Local<v8::Value> toScript(v8::Local<v8::Context> context, T value)
|
||||
static v8::Local<v8::Value> toScript(v8::Local<v8::Context> context, const T value)
|
||||
{
|
||||
return DataTransfer::FindOrAddStruct<T>(context->GetIsolate(), context, new T(value), false);
|
||||
}
|
||||
@@ -529,6 +536,16 @@ struct Converter<T, typename std::enable_if<internal::IsUStructHelper<T>::value>
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Converter<const T, typename std::enable_if<internal::IsUStructHelper<T>::value>::type> : Converter<T>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace v8_impl
|
||||
|
||||
template <typename T>
|
||||
struct ScriptTypeName<const T, typename std::enable_if<internal::IsUStructHelper<T>::value>::type> : ScriptTypeName<T>
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace PUERTS_NAMESPACE
|
||||
@@ -49,6 +49,32 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#define __DefCDataConverter_v8_impl(CLS) \
|
||||
namespace PUERTS_NAMESPACE \
|
||||
{ \
|
||||
namespace v8_impl \
|
||||
{ \
|
||||
template <> \
|
||||
struct Converter<CLS> \
|
||||
{ \
|
||||
static v8::Local<v8::Value> toScript(v8::Local<v8::Context> context, CLS value) \
|
||||
{ \
|
||||
return ::PUERTS_NAMESPACE::DataTransfer::FindOrAddCData( \
|
||||
context->GetIsolate(), context, DynamicTypeId<CLS>::get(&value), new CLS(value), false); \
|
||||
} \
|
||||
static CLS toCpp(v8::Local<v8::Context> context, const v8::Local<v8::Value>& value) \
|
||||
{ \
|
||||
return *::PUERTS_NAMESPACE::DataTransfer::GetPointerFast<CLS>(value.As<v8::Object>()); \
|
||||
} \
|
||||
static bool accept(v8::Local<v8::Context> context, const v8::Local<v8::Value>& value) \
|
||||
{ \
|
||||
return ::PUERTS_NAMESPACE::DataTransfer::IsInstanceOf( \
|
||||
context->GetIsolate(), StaticTypeId<CLS>::get(), value.As<v8::Object>()); \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
}
|
||||
|
||||
namespace PUERTS_NAMESPACE
|
||||
{
|
||||
namespace v8_impl
|
||||
|
||||
Reference in New Issue
Block a user