本文整理汇总了C++中CFXJSE_Value::DirectGetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CFXJSE_Value::DirectGetValue方法的具体用法?C++ CFXJSE_Value::DirectGetValue怎么用?C++ CFXJSE_Value::DirectGetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFXJSE_Value
的用法示例。
在下文中一共展示了CFXJSE_Value::DirectGetValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FXJSE_DynPropGetterAdapter_MethodCallback
static void FXJSE_DynPropGetterAdapter_MethodCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> hCallBackInfo = info.Data().As<v8::Object>();
FXJSE_CLASS* lpClass = static_cast<FXJSE_CLASS*>(
hCallBackInfo->GetAlignedPointerFromInternalField(0));
v8::Local<v8::String> hPropName =
hCallBackInfo->GetInternalField(1).As<v8::String>();
ASSERT(lpClass && !hPropName.IsEmpty());
v8::String::Utf8Value szPropName(hPropName);
CFX_ByteStringC szFxPropName = *szPropName;
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(info.This());
CFXJSE_Value* lpRetValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_ArgumentsImpl impl = {&info, lpRetValue};
lpClass->dynMethodCall(reinterpret_cast<FXJSE_HOBJECT>(lpThisValue),
szFxPropName,
reinterpret_cast<CFXJSE_Arguments&>(impl));
if (!lpRetValue->DirectGetValue().IsEmpty()) {
info.GetReturnValue().Set(lpRetValue->DirectGetValue());
}
delete lpRetValue;
lpRetValue = nullptr;
delete lpThisValue;
lpThisValue = nullptr;
}
示例2: szFxPropName
static void FXJSE_V8_GenericNamedPropertyGetterCallback(
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> thisObject = info.This();
const FXJSE_CLASS* lpClass =
static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value());
v8::String::Utf8Value szPropName(property);
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(thisObject);
CFXJSE_Value* lpNewValue = CFXJSE_Value::Create(info.GetIsolate());
FXJSE_DynPropGetterAdapter(
lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
reinterpret_cast<FXJSE_HVALUE>(lpNewValue));
info.GetReturnValue().Set(lpNewValue->DirectGetValue());
delete lpThisValue;
lpThisValue = nullptr;
}
示例3: ASSERT
static void FXJSE_V8ProxyCallback_getOwnPropertyDescriptor_getter(
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Local<v8::Object> hCallBackInfo = info.Data().As<v8::Object>();
FXJSE_CLASS* lpClass = static_cast<FXJSE_CLASS*>(
hCallBackInfo->GetAlignedPointerFromInternalField(0));
v8::Local<v8::String> hPropName =
hCallBackInfo->GetInternalField(1).As<v8::String>();
ASSERT(lpClass && !hPropName.IsEmpty());
v8::String::Utf8Value szPropName(hPropName);
CFX_ByteStringC szFxPropName = *szPropName;
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_Value* lpNewValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(info.This());
FXJSE_DynPropGetterAdapter(
lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
reinterpret_cast<FXJSE_HVALUE>(lpNewValue));
info.GetReturnValue().Set(lpNewValue->DirectGetValue());
delete lpThisValue;
lpThisValue = nullptr;
delete lpNewValue;
lpNewValue = nullptr;
}
示例4: Call
FX_BOOL CFXJSE_Value::Call(CFXJSE_Value* lpReceiver,
CFXJSE_Value* lpRetValue,
uint32_t nArgCount,
FXJSE_HVALUE* lpArgs) {
CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate);
v8::Local<v8::Value> hFunctionValue =
v8::Local<v8::Value>::New(m_pIsolate, DirectGetValue());
v8::Local<v8::Object> hFunctionObject =
!hFunctionValue.IsEmpty() && hFunctionValue->IsObject()
? hFunctionValue.As<v8::Object>()
: v8::Local<v8::Object>();
v8::TryCatch trycatch;
if (hFunctionObject.IsEmpty() || !hFunctionObject->IsCallable()) {
if (lpRetValue) {
lpRetValue->ForceSetValue(FXJSE_CreateReturnValue(m_pIsolate, trycatch));
}
return FALSE;
}
v8::Local<v8::Value> hReturnValue;
v8::Local<v8::Value>* lpLocalArgs = NULL;
if (nArgCount) {
lpLocalArgs = FX_Alloc(v8::Local<v8::Value>, nArgCount);
for (uint32_t i = 0; i < nArgCount; i++) {
new (lpLocalArgs + i) v8::Local<v8::Value>;
CFXJSE_Value* lpArg = (CFXJSE_Value*)lpArgs[i];
if (lpArg) {
lpLocalArgs[i] =
v8::Local<v8::Value>::New(m_pIsolate, lpArg->DirectGetValue());
}
if (lpLocalArgs[i].IsEmpty()) {
lpLocalArgs[i] = v8::Undefined(m_pIsolate);
}
}
}
FX_BOOL bRetValue = TRUE;
if (lpReceiver == FXJSE_INVALID_PTR) {
hReturnValue = hFunctionObject->CallAsConstructor(nArgCount, lpLocalArgs);
} else {
v8::Local<v8::Value> hReceiver;
if (lpReceiver) {
hReceiver =
v8::Local<v8::Value>::New(m_pIsolate, lpReceiver->DirectGetValue());
}
if (hReceiver.IsEmpty() || !hReceiver->IsObject()) {
hReceiver = v8::Object::New(m_pIsolate);
}
hReturnValue =
hFunctionObject->CallAsFunction(hReceiver, nArgCount, lpLocalArgs);
}
if (trycatch.HasCaught()) {
hReturnValue = FXJSE_CreateReturnValue(m_pIsolate, trycatch);
bRetValue = FALSE;
}
if (lpRetValue) {
lpRetValue->ForceSetValue(hReturnValue);
}
if (lpLocalArgs) {
for (uint32_t i = 0; i < nArgCount; i++) {
lpLocalArgs[i].~Local();
}
FX_Free(lpLocalArgs);
}
return bRetValue;
}