本文整理汇总了C++中CFXJSE_Value::ForceSetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CFXJSE_Value::ForceSetValue方法的具体用法?C++ CFXJSE_Value::ForceSetValue怎么用?C++ CFXJSE_Value::ForceSetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFXJSE_Value
的用法示例。
在下文中一共展示了CFXJSE_Value::ForceSetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scope
static void FXJSE_V8ProxyCallback_defineProperty(
const v8::FunctionCallbackInfo<v8::Value>& info) {
const FXJSE_CLASS* lpClass =
static_cast<FXJSE_CLASS*>(info.Data().As<v8::External>()->Value());
if (!lpClass) {
return;
}
v8::Isolate* pIsolate = info.GetIsolate();
v8::HandleScope scope(pIsolate);
v8::Local<v8::String> hPropName = info[0]->ToString();
v8::Local<v8::Object> hPropDescriptor = info[1]->ToObject();
v8::String::Utf8Value szPropName(hPropName);
if (!hPropDescriptor->Has(v8::String::NewFromUtf8(pIsolate, "value"))) {
return;
}
v8::Local<v8::Value> hPropValue =
hPropDescriptor->Get(v8::String::NewFromUtf8(pIsolate, "value"));
CFX_ByteStringC szFxPropName(*szPropName, szPropName.length());
CFXJSE_Value* lpThisValue = CFXJSE_Value::Create(info.GetIsolate());
CFXJSE_Value* lpPropValue = CFXJSE_Value::Create(info.GetIsolate());
lpThisValue->ForceSetValue(info.This());
lpPropValue->ForceSetValue(hPropValue);
FXJSE_DynPropSetterAdapter(
lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
reinterpret_cast<FXJSE_HVALUE>(lpPropValue));
delete lpThisValue;
lpThisValue = nullptr;
delete lpPropValue;
lpPropValue = nullptr;
}
示例2: FXJSE_DynPropGetterAdapter
static void FXJSE_DynPropGetterAdapter(const FXJSE_CLASS* lpClass,
FXJSE_HOBJECT hObject,
const CFX_ByteStringC& szPropName,
FXJSE_HVALUE hValue) {
ASSERT(lpClass);
int32_t nPropType =
lpClass->dynPropTypeGetter == nullptr
? FXJSE_ClassPropType_Property
: lpClass->dynPropTypeGetter(hObject, szPropName, FALSE);
if (nPropType == FXJSE_ClassPropType_Property) {
if (lpClass->dynPropGetter) {
lpClass->dynPropGetter(hObject, szPropName, hValue);
}
} else if (nPropType == FXJSE_ClassPropType_Method) {
if (lpClass->dynMethodCall && hValue) {
CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue);
v8::Isolate* pIsolate = lpValue->GetIsolate();
v8::HandleScope hscope(pIsolate);
v8::Local<v8::ObjectTemplate> hCallBackInfoTemplate =
v8::ObjectTemplate::New();
hCallBackInfoTemplate->SetInternalFieldCount(2);
v8::Local<v8::Object> hCallBackInfo =
hCallBackInfoTemplate->NewInstance();
hCallBackInfo->SetAlignedPointerInInternalField(
0, const_cast<FXJSE_CLASS*>(lpClass));
hCallBackInfo->SetInternalField(
1, v8::String::NewFromUtf8(
pIsolate, reinterpret_cast<const char*>(szPropName.GetPtr()),
v8::String::kNormalString, szPropName.GetLength()));
lpValue->ForceSetValue(v8::Function::New(
lpValue->GetIsolate(), FXJSE_DynPropGetterAdapter_MethodCallback,
hCallBackInfo));
}
}
}
示例3: 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;
}
示例4: szFxPropName
static void FXJSE_V8_GenericNamedPropertySetterCallback(
v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
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());
lpNewValue->ForceSetValue(value);
FXJSE_DynPropSetterAdapter(
lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
reinterpret_cast<FXJSE_HVALUE>(lpNewValue));
info.GetReturnValue().Set(value);
delete lpThisValue;
lpThisValue = nullptr;
}
示例5: ASSERT
static void FXJSE_V8ProxyCallback_getOwnPropertyDescriptor_setter(
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());
lpNewValue->ForceSetValue(info[0]);
FXJSE_DynPropSetterAdapter(
lpClass, reinterpret_cast<FXJSE_HOBJECT>(lpThisValue), szFxPropName,
reinterpret_cast<FXJSE_HVALUE>(lpNewValue));
delete lpThisValue;
lpThisValue = nullptr;
delete lpNewValue;
lpNewValue = nullptr;
}