424 lines
16 KiB
C++
424 lines
16 KiB
C++
/*
|
|
* Tencent is pleased to support the open source community by making Puerts available.
|
|
* Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
|
|
* Puerts is licensed under the BSD 3-Clause License, except for the third-party components listed in the file 'LICENSE' which may
|
|
* be subject to their corresponding license terms. This file is subject to the terms and conditions defined in file 'LICENSE',
|
|
* which is part of this source code package.
|
|
*/
|
|
|
|
// gen by puerts gen tools
|
|
|
|
#include "GenHeaders.h"
|
|
#include "CoreMinimal.h"
|
|
#include "DataTransfer.h"
|
|
#include "JSClassRegister.h"
|
|
|
|
static void* _FGuidNew_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 0)
|
|
{
|
|
if (true)
|
|
{
|
|
FGuid* Obj = new FGuid();
|
|
|
|
// UE_LOG(LogTemp, Warning, TEXT("_FGuidNew_:%p"), Obj);
|
|
return Obj;
|
|
}
|
|
}
|
|
if (Info.Length() == 4)
|
|
{
|
|
if (Info[0]->IsNumber() && Info[1]->IsNumber() && Info[2]->IsNumber() && Info[3]->IsNumber())
|
|
{
|
|
uint32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
|
|
uint32 Arg1 = Info[1]->ToInteger(Context).ToLocalChecked()->Value();
|
|
uint32 Arg2 = Info[2]->ToInteger(Context).ToLocalChecked()->Value();
|
|
uint32 Arg3 = Info[3]->ToInteger(Context).ToLocalChecked()->Value();
|
|
FGuid* Obj = new FGuid(Arg0, Arg1, Arg2, Arg3);
|
|
|
|
// UE_LOG(LogTemp, Warning, TEXT("_FGuidNew_:%p"), Obj);
|
|
return Obj;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
return nullptr;
|
|
}
|
|
|
|
static void _FGuidDelete_(void* Ptr, void* ClassData, void* EnvData)
|
|
{
|
|
FGuid* Self = static_cast<FGuid*>(Ptr);
|
|
// UE_LOG(LogTemp, Warning, TEXT("_FGuidDelete_:%p"), Self);
|
|
delete Self;
|
|
}
|
|
static void FGuidM_set_Item(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 1)
|
|
{
|
|
if (Info[0]->IsNumber())
|
|
{
|
|
int32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(
|
|
Isolate, "[FGuid::M_set_Item] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
Self->operator[](Arg0);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidM_get_Item(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 1)
|
|
{
|
|
if (Info[0]->IsNumber())
|
|
{
|
|
int32 Arg0 = Info[0]->ToInteger(Context).ToLocalChecked()->Value();
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(
|
|
Isolate, "[FGuid::M_get_Item] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto MethodResult = Self->operator[](Arg0);
|
|
auto V8Result = v8::Integer::New(Isolate, MethodResult);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidM_Invalidate(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 0)
|
|
{
|
|
if (true)
|
|
{
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(
|
|
Isolate, "[FGuid::M_Invalidate] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
Self->Invalidate();
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidM_IsValid(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 0)
|
|
{
|
|
if (true)
|
|
{
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::M_IsValid] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto MethodResult = Self->IsValid();
|
|
auto V8Result = v8::Boolean::New(Isolate, MethodResult);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidM_ToString(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 0)
|
|
{
|
|
if (true)
|
|
{
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(
|
|
Isolate, "[FGuid::M_ToString] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto MethodResult = Self->ToString();
|
|
auto V8Result =
|
|
v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
if (Info.Length() == 1)
|
|
{
|
|
if (Info[0]->IsNumber())
|
|
{
|
|
EGuidFormats Arg0 = EGuidFormats(Info[0]->ToInt32(Context).ToLocalChecked()->Value());
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(
|
|
Isolate, "[FGuid::M_ToString] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto MethodResult = Self->ToString(Arg0);
|
|
auto V8Result =
|
|
v8::String::NewFromUtf8(Isolate, TCHAR_TO_UTF8(*MethodResult), v8::NewStringType::kNormal).ToLocalChecked();
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidS_NewGuid(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 0)
|
|
{
|
|
if (true)
|
|
{
|
|
auto MethodResult = FGuid::NewGuid();
|
|
void* Ptr = new FGuid(MethodResult);
|
|
|
|
auto V8Result = PUERTS_NAMESPACE::DataTransfer::FindOrAddStruct<FGuid>(Isolate, Context, Ptr, false);
|
|
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidS_Parse(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 2)
|
|
{
|
|
if (Info[0]->IsString() && Info[1]->IsObject() && PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->IsObject() &&
|
|
|
|
PUERTS_NAMESPACE::DataTransfer::IsInstanceOf<FGuid>(
|
|
Isolate, PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->ToObject(Context).ToLocalChecked()))
|
|
{
|
|
const FString Arg0 = UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Info[0])));
|
|
FGuid* Arg1 = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(
|
|
PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[1])->ToObject(Context).ToLocalChecked());
|
|
auto MethodResult = FGuid::Parse(Arg0, *Arg1);
|
|
auto V8Result = v8::Boolean::New(Isolate, MethodResult);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void FGuidS_ParseExact(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
if (Info.Length() == 3)
|
|
{
|
|
if (Info[0]->IsString() && Info[1]->IsNumber() && Info[2]->IsObject() &&
|
|
PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[2])->IsObject() &&
|
|
|
|
PUERTS_NAMESPACE::DataTransfer::IsInstanceOf<FGuid>(
|
|
Isolate, PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[2])->ToObject(Context).ToLocalChecked()))
|
|
{
|
|
const FString Arg0 = UTF8_TO_TCHAR(*(v8::String::Utf8Value(Isolate, Info[0])));
|
|
EGuidFormats Arg1 = EGuidFormats(Info[1]->ToInt32(Context).ToLocalChecked()->Value());
|
|
FGuid* Arg2 = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(
|
|
PUERTS_NAMESPACE::DataTransfer::UnRef(Isolate, Info[2])->ToObject(Context).ToLocalChecked());
|
|
auto MethodResult = FGuid::ParseExact(Arg0, Arg1, *Arg2);
|
|
auto V8Result = v8::Boolean::New(Isolate, MethodResult);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
|
|
return;
|
|
}
|
|
}
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "Invalid argument!");
|
|
}
|
|
|
|
static void _FGuidAGet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::A] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
|
|
auto V8Result = v8::Integer::New(Isolate, Self->A);
|
|
PUERTS_NAMESPACE::DataTransfer::LinkOuter<FGuid, uint32>(Context, Info.Holder(), V8Result);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
}
|
|
static void _FGuidASet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::A] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto Value = Info[0];
|
|
|
|
Self->A = Value->ToInteger(Context).ToLocalChecked()->Value();
|
|
}
|
|
static void _FGuidBGet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::B] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
|
|
auto V8Result = v8::Integer::New(Isolate, Self->B);
|
|
PUERTS_NAMESPACE::DataTransfer::LinkOuter<FGuid, uint32>(Context, Info.Holder(), V8Result);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
}
|
|
static void _FGuidBSet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::B] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto Value = Info[0];
|
|
|
|
Self->B = Value->ToInteger(Context).ToLocalChecked()->Value();
|
|
}
|
|
static void _FGuidCGet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::C] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
|
|
auto V8Result = v8::Integer::New(Isolate, Self->C);
|
|
PUERTS_NAMESPACE::DataTransfer::LinkOuter<FGuid, uint32>(Context, Info.Holder(), V8Result);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
}
|
|
static void _FGuidCSet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::C] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto Value = Info[0];
|
|
|
|
Self->C = Value->ToInteger(Context).ToLocalChecked()->Value();
|
|
}
|
|
static void _FGuidDGet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::D] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
|
|
auto V8Result = v8::Integer::New(Isolate, Self->D);
|
|
PUERTS_NAMESPACE::DataTransfer::LinkOuter<FGuid, uint32>(Context, Info.Holder(), V8Result);
|
|
Info.GetReturnValue().Set(V8Result);
|
|
}
|
|
static void _FGuidDSet_(const v8::FunctionCallbackInfo<v8::Value>& Info)
|
|
{
|
|
v8::Isolate* Isolate = Info.GetIsolate();
|
|
v8::Local<v8::Context> Context = Isolate->GetCurrentContext();
|
|
|
|
auto Self = PUERTS_NAMESPACE::DataTransfer::GetPointerFast<FGuid>(Info.Holder());
|
|
if (!Self)
|
|
{
|
|
PUERTS_NAMESPACE::DataTransfer::ThrowException(Isolate, "[FGuid::D] Attempt to access a NULL self pointer");
|
|
return;
|
|
}
|
|
auto Value = Info[0];
|
|
|
|
Self->D = Value->ToInteger(Context).ToLocalChecked()->Value();
|
|
}
|
|
|
|
struct AutoRegisterForFGuid
|
|
{
|
|
AutoRegisterForFGuid()
|
|
{
|
|
PUERTS_NAMESPACE::JSClassDefinition Def = JSClassEmptyDefinition;
|
|
|
|
static PUERTS_NAMESPACE::JSPropertyInfo Properties[] = {{"A", _FGuidAGet_, _FGuidASet_}, {"B", _FGuidBGet_, _FGuidBSet_},
|
|
{"C", _FGuidCGet_, _FGuidCSet_}, {"D", _FGuidDGet_, _FGuidDSet_}, {0, 0, 0}};
|
|
|
|
static PUERTS_NAMESPACE::JSFunctionInfo Methods[] = {{"set_Item", FGuidM_set_Item}, {"get_Item", FGuidM_get_Item},
|
|
{"Invalidate", FGuidM_Invalidate}, {"IsValid", FGuidM_IsValid}, {"ToString", FGuidM_ToString}, {0, 0}};
|
|
|
|
static PUERTS_NAMESPACE::JSFunctionInfo Functions[] = {
|
|
{"NewGuid", FGuidS_NewGuid}, {"Parse", FGuidS_Parse}, {"ParseExact", FGuidS_ParseExact}, {0, 0}};
|
|
|
|
Def.UETypeName = "Guid";
|
|
|
|
Def.SetInitialize(_FGuidNew_);
|
|
Def.Finalize = _FGuidDelete_;
|
|
Def.Properties = Properties;
|
|
Def.Methods = Methods;
|
|
Def.Functions = Functions;
|
|
|
|
PUERTS_NAMESPACE::RegisterJSClass(Def);
|
|
}
|
|
};
|
|
|
|
AutoRegisterForFGuid _AutoRegisterForFGuid_; |