本文整理汇总了C++中CJS_PropValue::GetJSValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CJS_PropValue::GetJSValue方法的具体用法?C++ CJS_PropValue::GetJSValue怎么用?C++ CJS_PropValue::GetJSValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CJS_PropValue
的用法示例。
在下文中一共展示了CJS_PropValue::GetJSValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PropertyHelper
bool color::PropertyHelper(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
CPWL_Color* var) {
CJS_Array array;
if (vp.IsGetting()) {
ConvertPWLColorToArray(pRuntime, *var, &array);
vp << array;
return true;
}
if (!vp.GetJSValue()->ConvertToArray(pRuntime, array))
return false;
ConvertArrayToPWLColor(pRuntime, array, var);
return true;
}
示例2: DoProperty
FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc,
const FX_WCHAR* propname,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
if (vp.IsSetting()) {
CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
switch (vp.GetJSValue()->GetType()) {
case CJS_Value::VT_number: {
double dData;
vp >> dData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER, dData,
false, "", v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_boolean: {
bool bData;
vp >> bData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::BOOLEAN, 0,
bData, "", v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_string: {
CFX_ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0,
false, sData, v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_object: {
v8::Local<v8::Object> pData;
vp >> pData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0,
false, "", pData, FALSE);
}
case CJS_Value::VT_null: {
return SetGlobalVariables(sPropName, JS_GlobalDataType::NULLOBJ, 0,
false, "", v8::Local<v8::Object>(), FALSE);
}
case CJS_Value::VT_undefined: {
DelProperty(cc, propname, sError);
return TRUE;
}
default:
break;
}
} else {
示例3: activeDocs
bool app::activeDocs(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
if (!vp.IsGetting())
return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
CJS_Document* pJSDocument = nullptr;
v8::Local<v8::Object> pObj = pRuntime->GetThisObj();
if (CFXJS_Engine::GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) {
pJSDocument = static_cast<CJS_Document*>(pRuntime->GetObjectPrivate(pObj));
}
CJS_Array aDocs;
aDocs.SetElement(pRuntime, 0, CJS_Value(pRuntime, pJSDocument));
if (aDocs.GetLength(pRuntime) > 0)
vp << aDocs;
else
vp.GetJSValue()->SetNull(pRuntime);
return true;
}