diff options
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffnotify.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 1002 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 393 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 80 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 32 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 60 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp | 19 | ||||
-rw-r--r-- | xfa/fxjse/include/fxjse.h | 45 | ||||
-rw-r--r-- | xfa/fxjse/value.cpp | 177 | ||||
-rw-r--r-- | xfa/fxjse/value.h | 52 |
14 files changed, 805 insertions, 1077 deletions
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 69d61dc940..503392fe63 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -277,7 +277,7 @@ FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, GetIsolate(), name, v8::String::kNormalString, utf8Name.GetLength())); if (propvalue.IsEmpty()) { - FXJSE_Value_SetUndefined(pValue); + pValue->SetUndefined(); return FALSE; } pValue->ForceSetValue(propvalue); diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp index 9524a25b1a..c801bb45e5 100644 --- a/xfa/fxfa/app/xfa_ffnotify.cpp +++ b/xfa/fxfa/app/xfa_ffnotify.cpp @@ -206,7 +206,7 @@ FX_BOOL CXFA_FFNotify::RunScript(CXFA_Node* pScript, CXFA_Node* pFormItem) { int32_t iRet = pWidgetAcc->ExecuteScript(CXFA_Script(pScript), &EventParam, &pRetValue); if (iRet == XFA_EVENTERROR_Success && pRetValue) { - bRet = FXJSE_Value_ToBoolean(pRetValue); + bRet = pRetValue->ToBoolean(); delete pRetValue; } return bRet; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 1a579e222e..950c3f694e 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -370,7 +370,7 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, CFXJSE_Value* pRetValue, FX_BOOL bVersionFlag) { if (iRet == XFA_EVENTERROR_Success && pRetValue) { - if (FXJSE_Value_IsBoolean(pRetValue) && !FXJSE_Value_ToBoolean(pRetValue)) { + if (FXJSE_Value_IsBoolean(pRetValue) && !pRetValue->ToBoolean()) { IXFA_AppProvider* pAppProvider = GetAppProvider(); if (!pAppProvider) { return; @@ -660,7 +660,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, if (!FXJSE_Value_IsUndefined(pTmpRetValue.get())) { if (!FXJSE_Value_IsNull(pTmpRetValue.get())) { CFX_ByteString bsString; - FXJSE_Value_ToUTF8String(pTmpRetValue.get(), bsString); + pTmpRetValue->ToString(bsString); pEventParam->m_wsResult = CFX_WideString::FromUTF8(bsString.AsStringC()); } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 01c77e25b5..23ce526dff 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -517,7 +517,7 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -525,7 +525,7 @@ void CXFA_FM2JSContext::Abs(CFXJSE_Value* pThis, if (dValue < 0) dValue = -dValue; - FXJSE_Value_SetDouble(args.GetReturnValue(), dValue); + args.GetReturnValue()->SetDouble(dValue); } // static @@ -534,7 +534,7 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc < 1) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -553,18 +553,17 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, } std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argValue->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength > 2) { std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); + argValue->GetObjectPropertyByIdx(1, propertyValue.get()); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); std::unique_ptr<CFXJSE_Value> defaultPropValue( new CFXJSE_Value(pIsolate)); GetObjectDefaultValue(jsObjectValue.get(), defaultPropValue.get()); @@ -576,15 +575,13 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), - propertyStr.AsStringC(), - newPropertyValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -595,11 +592,11 @@ void CXFA_FM2JSContext::Avg(CFXJSE_Value* pThis, } } if (uCount == 0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetDouble(args.GetReturnValue(), dSum / uCount); + args.GetReturnValue()->SetDouble(dSum / uCount); } // static @@ -614,12 +611,12 @@ void CXFA_FM2JSContext::Ceil(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetFloat(args.GetReturnValue(), - FXSYS_ceil(ValueToFloat(pThis, argValue.get()))); + args.GetReturnValue()->SetFloat( + FXSYS_ceil(ValueToFloat(pThis, argValue.get()))); } // static @@ -636,9 +633,9 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(argValue.get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); + argValue->GetObjectProperty("length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength <= 2) { pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); return; @@ -648,25 +645,22 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(1, propertyValue.get()); + argValue->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (!FXJSE_Value_IsNull(newPropertyValue.get())) iCount++; } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), - propertyStr.AsStringC(), - newPropertyValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); iCount += (FXJSE_Value_IsNull(newPropertyValue.get()) ? 0 : 1); } } @@ -680,7 +674,7 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis, iCount++; } } - FXJSE_Value_SetInteger(args.GetReturnValue(), iCount); + args.GetReturnValue()->SetInteger(iCount); } // static @@ -695,12 +689,12 @@ void CXFA_FM2JSContext::Floor(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argValue = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetFloat(args.GetReturnValue(), - FXSYS_floor(ValueToFloat(pThis, argValue.get()))); + args.GetReturnValue()->SetFloat( + FXSYS_floor(ValueToFloat(pThis, argValue.get()))); } // static @@ -718,8 +712,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(argValue.get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argValue->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength <= 2) { pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); return; @@ -729,12 +723,11 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(1, propertyValue.get()); + argValue->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -745,13 +738,11 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), - propertyStr.AsStringC(), - newPropertyValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -777,11 +768,11 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis, } } if (uCount == 0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetDouble(args.GetReturnValue(), dMaxValue); + args.GetReturnValue()->SetDouble(dMaxValue); } // static @@ -799,8 +790,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(argValue.get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argValue->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength <= 2) { pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); return; @@ -810,12 +801,11 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(1, propertyValue.get()); + argValue->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -826,13 +816,11 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), - propertyStr.AsStringC(), - newPropertyValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -858,11 +846,11 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis, } } if (uCount == 0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetDouble(args.GetReturnValue(), dMinValue); + args.GetReturnValue()->SetDouble(dMinValue); } // static @@ -878,7 +866,7 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); std::unique_ptr<CFXJSE_Value> argTwo = args.GetValue(1); if (FXJSE_Value_IsNull(argOne.get()) || FXJSE_Value_IsNull(argTwo.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -896,8 +884,8 @@ void CXFA_FM2JSContext::Mod(CFXJSE_Value* pThis, return; } - FXJSE_Value_SetDouble(args.GetReturnValue(), - dDividend - dDivisor * (int32_t)(dDividend / dDivisor)); + args.GetReturnValue()->SetDouble(dDividend - + dDivisor * (int32_t)(dDividend / dDivisor)); } // static @@ -913,7 +901,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -928,7 +916,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> argTwo = args.GetValue(1); if (FXJSE_Value_IsNull(argTwo.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -945,8 +933,7 @@ void CXFA_FM2JSContext::Round(CFXJSE_Value* pThis, CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); CFX_WideString wsValue = decimalValue; - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - wsValue.UTF8Encode().AsStringC()); + args.GetReturnValue()->SetString(wsValue.UTF8Encode().AsStringC()); } // static @@ -955,7 +942,7 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if (argc == 0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -970,22 +957,21 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(argValue.get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValue.get(), "length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argValue->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength <= 2) { pContext->ThrowException(XFA_IDS_ARGUMENT_MISMATCH); return; } std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get()); + argValue->GetObjectPropertyByIdx(1, propertyValue.get()); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -995,13 +981,11 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argValue.get(), j, - jsObjectValue.get()); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), - propertyStr.AsStringC(), - newPropertyValue.get()); + argValue->GetObjectPropertyByIdx(j, jsObjectValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) continue; @@ -1024,11 +1008,11 @@ void CXFA_FM2JSContext::Sum(CFXJSE_Value* pThis, } } if (uCount == 0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetDouble(args.GetReturnValue(), dSum); + args.GetReturnValue()->SetDouble(dSum); } // static @@ -1053,8 +1037,7 @@ void CXFA_FM2JSContext::Date(CFXJSE_Value* pThis, bufferDay.Format("%02d", pTmStruct->tm_mday); CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; - FXJSE_Value_SetInteger(args.GetReturnValue(), - DateString2Num(bufferCurrent.AsStringC())); + args.GetReturnValue()->SetInteger(DateString2Num(bufferCurrent.AsStringC())); } // static @@ -1070,7 +1053,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, dateValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -1081,7 +1064,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, formatValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(formatValue.get(), formatString); @@ -1091,7 +1074,7 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, localValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(localValue.get(), localString); @@ -1100,12 +1083,12 @@ void CXFA_FM2JSContext::Date2Num(CFXJSE_Value* pThis, CFX_ByteString szIsoDateString; if (!Local2IsoDate(pThis, dateString.AsStringC(), formatString.AsStringC(), localString.AsStringC(), szIsoDateString)) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); return; } - FXJSE_Value_SetInteger(args.GetReturnValue(), - DateString2Num(szIsoDateString.AsStringC())); + args.GetReturnValue()->SetInteger( + DateString2Num(szIsoDateString.AsStringC())); } // static @@ -1123,7 +1106,7 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, if (argc > 0) { std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argStyle.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -1136,7 +1119,7 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argLocal.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(argLocal.get(), szLocal); @@ -1144,7 +1127,7 @@ void CXFA_FM2JSContext::DateFmt(CFXJSE_Value* pThis, CFX_ByteString formatStr; GetStandardDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); + args.GetReturnValue()->SetString(formatStr.AsStringC()); } // static @@ -1159,14 +1142,13 @@ void CXFA_FM2JSContext::IsoDate2Num(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } CFX_ByteString szArgString; ValueToUTF8String(argOne.get(), szArgString); - FXJSE_Value_SetInteger(args.GetReturnValue(), - DateString2Num(szArgString.AsStringC())); + args.GetReturnValue()->SetInteger(DateString2Num(szArgString.AsStringC())); } // static @@ -1182,7 +1164,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -1193,14 +1175,14 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, ValueToUTF8String(argOne.get(), szArgString); szArgString = szArgString.Mid(szArgString.Find('T', 0) + 1); if (szArgString.IsEmpty()) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); return; } CXFA_LocaleValue timeValue( XFA_VT_TIME, CFX_WideString::FromUTF8(szArgString.AsStringC()), pMgr); if (!timeValue.IsValid()) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); return; } @@ -1223,9 +1205,9 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, mins += 1440; hour = mins / 60; min = mins % 60; - int32_t iResult = - hour * 3600000 + min * 60000 + second * 1000 + milSecond + 1; - FXJSE_Value_SetInteger(args.GetReturnValue(), iResult); + + args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 + + second * 1000 + milSecond + 1); } // static @@ -1243,7 +1225,7 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, if (argc > 0) { std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argStyle.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } iStyle = (int32_t)ValueToFloat(pThis, argStyle.get()); @@ -1255,7 +1237,7 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argLocal.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(argLocal.get(), szLocal); @@ -1263,7 +1245,7 @@ void CXFA_FM2JSContext::LocalDateFmt(CFXJSE_Value* pThis, CFX_ByteString formatStr; GetLocalDateFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); + args.GetReturnValue()->SetString(formatStr.AsStringC()); } // static @@ -1281,7 +1263,7 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, if (argc > 0) { std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argStyle.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } iStyle = (int32_t)ValueToFloat(pThis, argStyle.get()); @@ -1293,7 +1275,7 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argLocal.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(argLocal.get(), szLocal); @@ -1301,7 +1283,7 @@ void CXFA_FM2JSContext::LocalTimeFmt(CFXJSE_Value* pThis, CFX_ByteString formatStr; GetLocalTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); + args.GetReturnValue()->SetString(formatStr.AsStringC()); } // static @@ -1317,12 +1299,12 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> dateValue = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, dateValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } int32_t dDate = (int32_t)ValueToFloat(pThis, dateValue.get()); if (dDate < 1) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -1330,7 +1312,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, formatValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(formatValue.get(), formatString); @@ -1340,7 +1322,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, localValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(localValue.get(), localString); @@ -1443,8 +1425,7 @@ void CXFA_FM2JSContext::Num2Date(CFXJSE_Value* pThis, CFX_ByteString szLocalDateString; IsoDate2Local(pThis, szIsoDateString.AsStringC(), formatString.AsStringC(), localString.AsStringC(), szLocalDateString); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szLocalDateString.AsStringC()); + args.GetReturnValue()->SetString(szLocalDateString.AsStringC()); } // static @@ -1460,12 +1441,12 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(timeValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } int32_t iTime = (int32_t)ValueToFloat(pThis, timeValue.get()); if (FXSYS_abs(iTime) < 1.0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -1473,7 +1454,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(formatValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(formatValue.get(), formatString); @@ -1483,7 +1464,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (FXJSE_Value_IsNull(localValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(localValue.get(), localString); @@ -1492,7 +1473,7 @@ void CXFA_FM2JSContext::Num2GMTime(CFXJSE_Value* pThis, CFX_ByteString szGMTTimeString; Num2AllTime(pThis, iTime, formatString.AsStringC(), localString.AsStringC(), TRUE, szGMTTimeString); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), szGMTTimeString.AsStringC()); + args.GetReturnValue()->SetString(szGMTTimeString.AsStringC()); } // static @@ -1508,12 +1489,12 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(timeValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } FX_FLOAT fTime = ValueToFloat(pThis, timeValue.get()); if (FXSYS_fabs(fTime) < 1.0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -1521,7 +1502,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(formatValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(formatValue.get(), formatString); @@ -1531,7 +1512,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (FXJSE_Value_IsNull(localValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(localValue.get(), localString); @@ -1540,8 +1521,7 @@ void CXFA_FM2JSContext::Num2Time(CFXJSE_Value* pThis, CFX_ByteString szLocalTimeString; Num2AllTime(pThis, (int32_t)fTime, formatString.AsStringC(), localString.AsStringC(), FALSE, szLocalTimeString); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szLocalTimeString.AsStringC()); + args.GetReturnValue()->SetString(szLocalTimeString.AsStringC()); } // static @@ -1558,9 +1538,8 @@ void CXFA_FM2JSContext::Time(CFXJSE_Value* pThis, time(&now); struct tm* pGmt = gmtime(&now); - FXJSE_Value_SetInteger( - args.GetReturnValue(), - ((pGmt->tm_hour * 3600 + pGmt->tm_min * 60 + pGmt->tm_sec) * 1000)); + args.GetReturnValue()->SetInteger( + (pGmt->tm_hour * 3600 + pGmt->tm_min * 60 + pGmt->tm_sec) * 1000); } // static @@ -1577,7 +1556,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, CFX_ByteString timeString; std::unique_ptr<CFXJSE_Value> timeValue = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, timeValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(timeValue.get(), timeString); @@ -1586,7 +1565,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> formatValue = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, formatValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(formatValue.get(), formatString); @@ -1596,7 +1575,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, if (argc > 2) { std::unique_ptr<CFXJSE_Value> localValue = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, localValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(localValue.get(), localString); @@ -1628,7 +1607,7 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, CFX_WideString::FromUTF8(timeString.AsStringC()), wsFormat, pLocale, pMgr); if (!localeValue.IsValid()) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); return; } @@ -1651,9 +1630,8 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, hour = mins / 60; min = mins % 60; } - FXJSE_Value_SetInteger( - args.GetReturnValue(), - hour * 3600000 + min * 60000 + second * 1000 + milSecond + 1); + args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 + + second * 1000 + milSecond + 1); } // static @@ -1671,7 +1649,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, if (argc > 0) { std::unique_ptr<CFXJSE_Value> argStyle = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argStyle.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } iStyle = (int32_t)ValueToFloat(pThis, argStyle.get()); @@ -1683,7 +1661,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, if (argc > 1) { std::unique_ptr<CFXJSE_Value> argLocal = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argLocal.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } ValueToUTF8String(argLocal.get(), szLocal); @@ -1691,7 +1669,7 @@ void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, CFX_ByteString formatStr; GetStandardTimeFormat(pThis, iStyle, szLocal.AsStringC(), formatStr); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); + args.GetReturnValue()->SetString(formatStr.AsStringC()); } // static @@ -2406,7 +2384,7 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2431,7 +2409,7 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, (r * nTemp * nPeriods * (nTemp / (1 + r)))) / ((nTemp - 1) * (nTemp - 1)); if (nDerivative == 0) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2442,7 +2420,7 @@ void CXFA_FM2JSContext::Apr(CFXJSE_Value* pThis, } nRet = r * nTemp / (nTemp - 1) - nPayment / nPrincipal; } - FXJSE_Value_SetDouble(args.GetReturnValue(), r * 12); + args.GetReturnValue()->SetDouble(r * 12); } // static @@ -2460,7 +2438,7 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2472,9 +2450,9 @@ void CXFA_FM2JSContext::CTerm(CFXJSE_Value* pThis, return; } - FXJSE_Value_SetFloat(args.GetReturnValue(), - FXSYS_log((FX_FLOAT)(nFutureValue / nInitAmount)) / - FXSYS_log((FX_FLOAT)(1 + nRate))); + args.GetReturnValue()->SetFloat( + FXSYS_log((FX_FLOAT)(nFutureValue / nInitAmount)) / + FXSYS_log((FX_FLOAT)(1 + nRate))); } // static @@ -2492,7 +2470,7 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2515,7 +2493,7 @@ void CXFA_FM2JSContext::FV(CFXJSE_Value* pThis, dResult = nAmount * nPeriod; } - FXJSE_Value_SetDouble(args.GetReturnValue(), dResult); + args.GetReturnValue()->SetDouble(dResult); } // static @@ -2536,7 +2514,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get()) || ValueIsNull(pThis, argFour.get()) || ValueIsNull(pThis, argFive.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2559,7 +2537,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, int32_t iEnd = std::min((int32_t)(nFirstMonth + nNumberOfMonths - 1), iNums); if (nPayment < nPrincipalAmount * nRateOfMonth) { - FXJSE_Value_SetFloat(args.GetReturnValue(), 0); + args.GetReturnValue()->SetFloat(0); return; } @@ -2572,7 +2550,7 @@ void CXFA_FM2JSContext::IPmt(CFXJSE_Value* pThis, nSum += nPrincipalAmount * nRateOfMonth; nPrincipalAmount -= nPayment - nPrincipalAmount * nRateOfMonth; } - FXJSE_Value_SetFloat(args.GetReturnValue(), nSum); + args.GetReturnValue()->SetFloat(nSum); } // static @@ -2590,7 +2568,7 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, for (int32_t i = 0; i < argc; i++) { argValues.push_back(GetSimpleValue(pThis, args, i)); if (ValueIsNull(pThis, argValues[i].get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } } @@ -2615,7 +2593,7 @@ void CXFA_FM2JSContext::NPV(CFXJSE_Value* pThis, FX_DOUBLE nNum = data[iIndex++]; nSum += nNum / nTemp; } - FXJSE_Value_SetDouble(args.GetReturnValue(), nSum); + args.GetReturnValue()->SetDouble(nSum); } // static @@ -2633,7 +2611,7 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2650,8 +2628,7 @@ void CXFA_FM2JSContext::Pmt(CFXJSE_Value* pThis, for (int32_t i = 0; i < nPeriods - 1; ++i) nSum *= nTmp; - FXJSE_Value_SetFloat(args.GetReturnValue(), - (nPrincipal * nRate * nSum) / (nSum - 1)); + args.GetReturnValue()->SetFloat((nPrincipal * nRate * nSum) / (nSum - 1)); } // static @@ -2672,7 +2649,7 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get()) || ValueIsNull(pThis, argFour.get()) || ValueIsNull(pThis, argFive.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2709,7 +2686,7 @@ void CXFA_FM2JSContext::PPmt(CFXJSE_Value* pThis, nSum += nTemp; nPrincipalAmount -= nTemp; } - FXJSE_Value_SetFloat(args.GetReturnValue(), nSum); + args.GetReturnValue()->SetFloat(nSum); } // static @@ -2727,7 +2704,7 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2744,7 +2721,7 @@ void CXFA_FM2JSContext::PV(CFXJSE_Value* pThis, nTemp *= 1 + nRate; nTemp = 1 / nTemp; - FXJSE_Value_SetDouble(args.GetReturnValue(), nAmount * ((1 - nTemp) / nRate)); + args.GetReturnValue()->SetDouble(nAmount * ((1 - nTemp) / nRate)); } // static @@ -2762,7 +2739,7 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2774,10 +2751,9 @@ void CXFA_FM2JSContext::Rate(CFXJSE_Value* pThis, return; } - FXJSE_Value_SetFloat( - args.GetReturnValue(), - (FXSYS_pow((FX_FLOAT)(nFuture / nPresent), (FX_FLOAT)(1 / nTotalNumber)) - - 1)); + args.GetReturnValue()->SetFloat( + FXSYS_pow((FX_FLOAT)(nFuture / nPresent), (FX_FLOAT)(1 / nTotalNumber)) - + 1); } // static @@ -2795,7 +2771,7 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argThree = GetSimpleValue(pThis, args, 2); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get()) || ValueIsNull(pThis, argThree.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -2807,9 +2783,9 @@ void CXFA_FM2JSContext::Term(CFXJSE_Value* pThis, return; } - FXJSE_Value_SetFloat(args.GetReturnValue(), - (FXSYS_log((FX_FLOAT)(nFuture / nMount * nRate) + 1) / - FXSYS_log((FX_FLOAT)(1 + nRate)))); + args.GetReturnValue()->SetFloat( + FXSYS_log((FX_FLOAT)(nFuture / nMount * nRate) + 1) / + FXSYS_log((FX_FLOAT)(1 + nRate))); } // static @@ -2825,13 +2801,13 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } int32_t iIndex = (int32_t)ValueToFloat(pThis, argOne.get()); if (iIndex < 1) { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); return; } @@ -2844,9 +2820,8 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argIndexValue = args.GetValue(iArgIndex); if (FXJSE_Value_IsArray(argIndexValue.get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argIndexValue.get(), "length", - lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argIndexValue->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength > 3) bStopCounterFlags = TRUE; @@ -2856,22 +2831,20 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argIndexValue.get(), 1, - propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argIndexValue.get(), - ((iLength - 1) - (iValueIndex - iIndex)), - jsObjectValue.get()); + argIndexValue->GetObjectPropertyByIdx(1, propertyValue.get()); + argIndexValue->GetObjectPropertyByIdx( + (iLength - 1) - (iValueIndex - iIndex), jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); } else { CFX_ByteString propStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propStr); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propStr.AsStringC(), - newPropertyValue.get()); + propertyValue->ToString(propStr); + jsObjectValue->GetObjectProperty(propStr.AsStringC(), + newPropertyValue.get()); } CFX_ByteString bsChoosed; ValueToUTF8String(newPropertyValue.get(), bsChoosed); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsChoosed.AsStringC()); + args.GetReturnValue()->SetString(bsChoosed.AsStringC()); bFound = TRUE; } } else { @@ -2879,14 +2852,14 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis, if (iValueIndex == iIndex) { CFX_ByteString bsChoosed; ValueToUTF8String(argIndexValue.get(), bsChoosed); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsChoosed.AsStringC()); + args.GetReturnValue()->SetString(bsChoosed.AsStringC()); bFound = TRUE; } } iArgIndex++; } if (!bFound) - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } // static @@ -2899,8 +2872,8 @@ void CXFA_FM2JSContext::Exists(CFXJSE_Value* pThis, return; } - FXJSE_Value_SetInteger(args.GetReturnValue(), - FXJSE_Value_IsObject(args.GetValue(0).get())); + args.GetReturnValue()->SetInteger( + FXJSE_Value_IsObject(args.GetValue(0).get())); } // static @@ -2915,16 +2888,15 @@ void CXFA_FM2JSContext::HasValue(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (!FXJSE_Value_IsUTF8String(argOne.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), - FXJSE_Value_IsNumber(argOne.get()) || - FXJSE_Value_IsBoolean(argOne.get())); + args.GetReturnValue()->SetInteger(FXJSE_Value_IsNumber(argOne.get()) || + FXJSE_Value_IsBoolean(argOne.get())); return; } CFX_ByteString valueStr; - FXJSE_Value_ToUTF8String(argOne.get(), valueStr); + argOne->ToString(valueStr); valueStr.TrimLeft(); - FXJSE_Value_SetInteger(args.GetReturnValue(), (!valueStr.IsEmpty())); + args.GetReturnValue()->SetInteger(!valueStr.IsEmpty()); } // static @@ -2952,7 +2924,7 @@ void CXFA_FM2JSContext::Oneof(CFXJSE_Value* pThis, delete parametersValue[i]; FX_Free(parametersValue); - FXJSE_Value_SetInteger(args.GetReturnValue(), bFlags); + args.GetReturnValue()->SetInteger(bFlags); } // static @@ -2967,7 +2939,7 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetUndefined(args.GetReturnValue()); + args.GetReturnValue()->SetUndefined(); return; } @@ -2977,9 +2949,8 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, FX_FLOAT oneNumber = ValueToFloat(pThis, argOne.get()); FX_FLOAT lowNumber = ValueToFloat(pThis, argLow.get()); FX_FLOAT heightNumber = ValueToFloat(pThis, argHigh.get()); - FXJSE_Value_SetInteger( - args.GetReturnValue(), - ((oneNumber >= lowNumber) && (oneNumber <= heightNumber))); + args.GetReturnValue()->SetInteger((oneNumber >= lowNumber) && + (oneNumber <= heightNumber)); return; } @@ -2989,9 +2960,9 @@ void CXFA_FM2JSContext::Within(CFXJSE_Value* pThis, ValueToUTF8String(argOne.get(), oneString); ValueToUTF8String(argLow.get(), lowString); ValueToUTF8String(argHigh.get(), heightString); - FXJSE_Value_SetInteger(args.GetReturnValue(), - ((oneString.Compare(lowString.AsStringC()) >= 0) && - (oneString.Compare(heightString.AsStringC()) <= 0))); + args.GetReturnValue()->SetInteger( + (oneString.Compare(lowString.AsStringC()) >= 0) && + (oneString.Compare(heightString.AsStringC()) <= 0)); } // static @@ -3004,10 +2975,9 @@ void CXFA_FM2JSContext::If(CFXJSE_Value* pThis, return; } - FXJSE_Value_Set(args.GetReturnValue(), - FXJSE_Value_ToBoolean(GetSimpleValue(pThis, args, 0).get()) - ? GetSimpleValue(pThis, args, 1).get() - : GetSimpleValue(pThis, args, 2).get()); + args.GetReturnValue()->Assign(GetSimpleValue(pThis, args, 0)->ToBoolean() + ? GetSimpleValue(pThis, args, 1).get() + : GetSimpleValue(pThis, args, 2).get()); } // static @@ -3025,7 +2995,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, CFX_ByteString utf8ScriptString; ValueToUTF8String(scriptValue.get(), utf8ScriptString); if (utf8ScriptString.IsEmpty()) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -3044,7 +3014,7 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis, FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(), returnValue.get()); - FXJSE_Value_Set(args.GetReturnValue(), returnValue.get()); + args.GetReturnValue()->Assign(returnValue.get()); FXJSE_Context_Release(pNewContext); } @@ -3073,7 +3043,7 @@ void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, if (FXJSE_Value_IsBoolean(argOne.get()) || FXJSE_Value_IsUTF8String(argOne.get()) || FXJSE_Value_IsNumber(argOne.get())) { - FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); + args.GetReturnValue()->Assign(argOne.get()); return; } @@ -3084,18 +3054,18 @@ void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, int intVal = 3; if (FXJSE_Value_IsNull(argOne.get())) { intVal = 4; - FXJSE_Value_SetNull(rgValues[2]); + rgValues[2]->SetNull(); } else if (FXJSE_Value_IsArray(argOne.get())) { #ifndef NDEBUG std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); - ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); + argOne->GetObjectProperty("length", lengthValue.get()); + ASSERT(lengthValue->ToInteger() >= 3); #endif std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, jsObjectValue.get()); + argOne->GetObjectPropertyByIdx(1, propertyValue.get()); + argOne->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (!FXJSE_Value_IsNull(propertyValue.get()) || FXJSE_Value_IsNull(jsObjectValue.get())) { for (int32_t i = 0; i < 3; i++) @@ -3105,14 +3075,14 @@ void CXFA_FM2JSContext::Ref(CFXJSE_Value* pThis, return; } - FXJSE_Value_Set(rgValues[2], jsObjectValue.get()); + rgValues[2]->Assign(jsObjectValue.get()); } else if (FXJSE_Value_IsObject(argOne.get())) { - FXJSE_Value_Set(rgValues[2], argOne.get()); + rgValues[2]->Assign(argOne.get()); } - FXJSE_Value_SetInteger(rgValues[0], intVal); - FXJSE_Value_SetNull(rgValues[1]); - FXJSE_Value_SetArray(args.GetReturnValue(), 3, rgValues); + rgValues[0]->SetInteger(intVal); + rgValues[1]->SetNull(); + args.GetReturnValue()->SetArray(3, rgValues); for (int32_t i = 0; i < 3; i++) delete rgValues[i]; @@ -3130,14 +3100,14 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(unitspanValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } CFX_ByteString unitspanString; ValueToUTF8String(unitspanValue.get(), unitspanString); if (unitspanString.IsEmpty()) { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "in"); + args.GetReturnValue()->SetString("in"); return; } @@ -3214,19 +3184,19 @@ void CXFA_FM2JSContext::UnitType(CFXJSE_Value* pThis, } switch (eParserStatus) { case VALUETYPE_ISCM: - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "cm"); + args.GetReturnValue()->SetString("cm"); break; case VALUETYPE_ISMM: - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "mm"); + args.GetReturnValue()->SetString("mm"); break; case VALUETYPE_ISPT: - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "pt"); + args.GetReturnValue()->SetString("pt"); break; case VALUETYPE_ISMP: - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "mp"); + args.GetReturnValue()->SetString("mp"); break; default: - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "in"); + args.GetReturnValue()->SetString("in"); break; } } @@ -3244,7 +3214,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> unitspanValue = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(unitspanValue.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -3252,7 +3222,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, ValueToUTF8String(unitspanValue.get(), unitspanString); const FX_CHAR* pData = unitspanString.c_str(); if (!pData) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); return; } @@ -3373,7 +3343,7 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis, else dResult = dFirstNumber / 72000; } - FXJSE_Value_SetDouble(args.GetReturnValue(), dResult); + args.GetReturnValue()->SetDouble(dResult); } // static @@ -3389,21 +3359,21 @@ void CXFA_FM2JSContext::At(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } CFX_ByteString stringTwo; ValueToUTF8String(argTwo.get(), stringTwo); if (stringTwo.IsEmpty()) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 1); + args.GetReturnValue()->SetInteger(1); return; } CFX_ByteString stringOne; ValueToUTF8String(argOne.get(), stringOne); FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC()); - FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); + args.GetReturnValue()->SetInteger(iPosition + 1); } // static @@ -3432,11 +3402,11 @@ void CXFA_FM2JSContext::Concat(CFXJSE_Value* pThis, } if (bAllNull) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); + args.GetReturnValue()->SetString(resultString.AsStringC()); } // static @@ -3453,7 +3423,7 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, if (argc == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -3461,14 +3431,14 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, ValueToUTF8String(argOne.get(), toDecodeString); CFX_ByteTextBuf resultBuf; DecodeURL(toDecodeString.AsStringC(), resultBuf); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); + args.GetReturnValue()->SetString(resultBuf.AsStringC()); return; } std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); return; } @@ -3486,7 +3456,7 @@ void CXFA_FM2JSContext::Decode(CFXJSE_Value* pThis, else DecodeURL(toDecodeString.AsStringC(), resultBuf); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); + args.GetReturnValue()->SetString(resultBuf.AsStringC()); } // static @@ -3722,19 +3692,19 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, if (argc == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString toEncodeString; ValueToUTF8String(argOne.get(), toEncodeString); CFX_ByteTextBuf resultBuf; EncodeURL(toEncodeString.AsStringC(), resultBuf); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); + args.GetReturnValue()->SetString(resultBuf.AsStringC()); } } else if (argc == 2) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, argOne.get()) || ValueIsNull(pThis, argTwo.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString toEncodeString; ValueToUTF8String(argOne.get(), toEncodeString); @@ -3748,7 +3718,7 @@ void CXFA_FM2JSContext::Encode(CFXJSE_Value* pThis, } else { EncodeURL(toEncodeString.AsStringC(), resultBuf); } - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); + args.GetReturnValue()->SetString(resultBuf.AsStringC()); } } else { ToJSContext(pThis, nullptr) @@ -4120,11 +4090,10 @@ void CXFA_FM2JSContext::Format(CFXJSE_Value* pThis, CFX_WideString wsRet; if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, XFA_VALUEPICTURE_Display)) { - FXJSE_Value_SetUTF8String( - args.GetReturnValue(), + args.GetReturnValue()->SetString( FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()).AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } else { pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Format"); @@ -4144,7 +4113,7 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, argIsNull = TRUE; } if (argIsNull) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString sourceString; ValueToUTF8String(argOne.get(), sourceString); @@ -4152,8 +4121,7 @@ void CXFA_FM2JSContext::Left(CFXJSE_Value* pThis, if (count < 0) { count = 0; } - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - sourceString.Left(count).AsStringC()); + args.GetReturnValue()->SetString(sourceString.Left(count).AsStringC()); } } else { ToJSContext(pThis, nullptr) @@ -4168,11 +4136,11 @@ void CXFA_FM2JSContext::Len(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString sourceString; ValueToUTF8String(argOne.get(), sourceString); - FXJSE_Value_SetInteger(args.GetReturnValue(), sourceString.GetLength()); + args.GetReturnValue()->SetInteger(sourceString.GetLength()); } } else { ToJSContext(pThis, nullptr) @@ -4189,7 +4157,7 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, CFX_ByteString argString; std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { ValueToUTF8String(argOne.get(), argString); CFX_WideTextBuf lowStringBuf; @@ -4212,8 +4180,7 @@ void CXFA_FM2JSContext::Lower(CFXJSE_Value* pThis, ++i; } lowStringBuf.AppendChar(0); - FXJSE_Value_SetUTF8String( - args.GetReturnValue(), + args.GetReturnValue()->SetString( FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) .AsStringC()); } @@ -4230,13 +4197,12 @@ void CXFA_FM2JSContext::Ltrim(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString sourceString; ValueToUTF8String(argOne.get(), sourceString); sourceString.TrimLeft(); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - sourceString.AsStringC()); + args.GetReturnValue()->SetString(sourceString.AsStringC()); } } else { ToJSContext(pThis, nullptr) @@ -4253,7 +4219,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argTwo = GetSimpleValue(pThis, args, 1); if (ValueIsNull(pThis, argTwo.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString szPattern; ValueToUTF8String(argOne.get(), szPattern); @@ -4275,10 +4241,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { szParsedValue = FX_UTF8Encode(localeValue.GetValue()); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szParsedValue.AsStringC()); + args.GetReturnValue()->SetString(szParsedValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } else { switch (patternType) { @@ -4295,10 +4260,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { szParsedValue = FX_UTF8Encode(localeValue.GetValue()); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szParsedValue.AsStringC()); + args.GetReturnValue()->SetString(szParsedValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } break; case XFA_VT_DATE: { @@ -4308,10 +4272,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { szParsedValue = FX_UTF8Encode(localeValue.GetValue()); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szParsedValue.AsStringC()); + args.GetReturnValue()->SetString(szParsedValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } break; case XFA_VT_TIME: { @@ -4321,10 +4284,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { szParsedValue = FX_UTF8Encode(localeValue.GetValue()); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szParsedValue.AsStringC()); + args.GetReturnValue()->SetString(szParsedValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } break; case XFA_VT_TEXT: { @@ -4334,10 +4296,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { szParsedValue = FX_UTF8Encode(localeValue.GetValue()); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szParsedValue.AsStringC()); + args.GetReturnValue()->SetString(szParsedValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } break; case XFA_VT_FLOAT: { @@ -4346,10 +4307,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { - FXJSE_Value_SetDouble(args.GetReturnValue(), - localeValue.GetDoubleNum()); + args.GetReturnValue()->SetDouble(localeValue.GetDoubleNum()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } break; default: { @@ -4359,8 +4319,7 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsTestPattern, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue.IsValid()) { - FXJSE_Value_SetDouble(args.GetReturnValue(), - localeValue.GetDoubleNum()); + args.GetReturnValue()->SetDouble(localeValue.GetDoubleNum()); } else { wsTestPattern = FX_WSTRC(L"text{") + wsPattern; wsTestPattern += FX_WSTRC(L"}"); @@ -4368,10 +4327,9 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis, pLocale, (CXFA_LocaleMgr*)pMgr); if (localeValue2.IsValid()) { szParsedValue = FX_UTF8Encode(localeValue2.GetValue()); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szParsedValue.AsStringC()); + args.GetReturnValue()->SetString(szParsedValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } } } break; @@ -4436,7 +4394,7 @@ void CXFA_FM2JSContext::Replace(CFXJSE_Value* pThis, } } resultString.AppendChar(0); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); + args.GetReturnValue()->SetString(resultString.AsStringC()); } else { ToJSContext(pThis, nullptr) ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Replace"); @@ -4456,7 +4414,7 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, argIsNull = TRUE; } if (argIsNull) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString sourceString; ValueToUTF8String(argOne.get(), sourceString); @@ -4464,8 +4422,7 @@ void CXFA_FM2JSContext::Right(CFXJSE_Value* pThis, if (count < 0) { count = 0; } - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - sourceString.Right(count).AsStringC()); + args.GetReturnValue()->SetString(sourceString.Right(count).AsStringC()); } } else { ToJSContext(pThis, nullptr) @@ -4480,13 +4437,12 @@ void CXFA_FM2JSContext::Rtrim(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString sourceString; ValueToUTF8String(argOne.get(), sourceString); sourceString.TrimRight(); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - sourceString.AsStringC()); + args.GetReturnValue()->SetString(sourceString.AsStringC()); } } else { ToJSContext(pThis, nullptr) @@ -4501,7 +4457,7 @@ void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { int32_t count = 0; count = ValueToInteger(pThis, argOne.get()); @@ -4513,7 +4469,7 @@ void CXFA_FM2JSContext::Space(CFXJSE_Value* pThis, index++; } spaceString.AppendByte(0); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), spaceString.AsStringC()); + args.GetReturnValue()->SetString(spaceString.AsStringC()); } } else { ToJSContext(pThis, nullptr) @@ -4629,9 +4585,9 @@ void CXFA_FM2JSContext::Str(CFXJSE_Value* pThis, resultBuf.AppendChar(0); } } - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); + args.GetReturnValue()->SetString(resultBuf.AsStringC()); } else { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } } else { ToJSContext(pThis, nullptr) @@ -4689,7 +4645,7 @@ void CXFA_FM2JSContext::Stuff(CFXJSE_Value* pThis, ++i; } resultString.AppendChar(0); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString.AsStringC()); + args.GetReturnValue()->SetString(resultString.AsStringC()); } else { ToJSContext(pThis, nullptr) ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Stuff"); @@ -4707,7 +4663,7 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, if (ValueIsNull(pThis, stringValue.get()) || (ValueIsNull(pThis, startValue.get())) || (ValueIsNull(pThis, endValue.get()))) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { CFX_ByteString szSourceStr; int32_t iStart = 0; @@ -4715,7 +4671,7 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, ValueToUTF8String(stringValue.get(), szSourceStr); int32_t iLength = szSourceStr.GetLength(); if (iLength == 0) { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } else { iStart = (int32_t)ValueToFloat(pThis, startValue.get()); iCount = (int32_t)ValueToFloat(pThis, endValue.get()); @@ -4729,8 +4685,8 @@ void CXFA_FM2JSContext::Substr(CFXJSE_Value* pThis, iCount = 0; } iStart -= 1; - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - szSourceStr.Mid(iStart, iCount).AsStringC()); + args.GetReturnValue()->SetString( + szSourceStr.Mid(iStart, iCount).AsStringC()); } } } else { @@ -4754,7 +4710,7 @@ void CXFA_FM2JSContext::Uuid(CFXJSE_Value* pThis, FX_GUID_CreateV4(&guid); CFX_ByteString bsUId; FX_GUID_ToString(&guid, bsUId, iNum); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); + args.GetReturnValue()->SetString(bsUId.AsStringC()); } else { ToJSContext(pThis, nullptr) ->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Uuid"); @@ -4770,7 +4726,7 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, CFX_ByteString argString; std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (ValueIsNull(pThis, argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { ValueToUTF8String(argOne.get(), argString); CFX_WideTextBuf upperStringBuf; @@ -4793,8 +4749,7 @@ void CXFA_FM2JSContext::Upper(CFXJSE_Value* pThis, ++i; } upperStringBuf.AppendChar(0); - FXJSE_Value_SetUTF8String( - args.GetReturnValue(), + args.GetReturnValue()->SetString( FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) .AsStringC()); } @@ -4840,16 +4795,16 @@ void CXFA_FM2JSContext::WordNum(CFXJSE_Value* pThis, } if (!bFlags) { if ((fNumber < 0) || (fNumber > 922337203685477550)) { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), "*"); + args.GetReturnValue()->SetString("*"); } else { CFX_ByteTextBuf resultBuf; CFX_ByteString numberString; numberString.Format("%.2f", fNumber); WordUS(numberString.AsStringC(), iIdentifier, resultBuf); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultBuf.AsStringC()); + args.GetReturnValue()->SetString(resultBuf.AsStringC()); } } else { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } } else { ToJSContext(pThis, nullptr) @@ -5078,8 +5033,7 @@ void CXFA_FM2JSContext::Get(CFXJSE_Value* pThis, int32_t size = pFile->GetSize(); uint8_t* pData = FX_Alloc(uint8_t, size); pFile->ReadBlock(pData, size); - FXJSE_Value_SetUTF8String(args.GetReturnValue(), - CFX_ByteStringC(pData, size)); + args.GetReturnValue()->SetString(CFX_ByteStringC(pData, size)); FX_Free(pData); pFile->Release(); } @@ -5133,8 +5087,7 @@ void CXFA_FM2JSContext::Post(CFXJSE_Value* pThis, CFX_WideString::FromUTF8(bsEncode.AsStringC()), CFX_WideString::FromUTF8(bsHeader.AsStringC()), decodedResponse); if (bFlags) { - FXJSE_Value_SetUTF8String( - args.GetReturnValue(), + args.GetReturnValue()->SetString( FX_UTF8Encode(decodedResponse.c_str(), decodedResponse.GetLength()) .AsStringC()); } else { @@ -5177,7 +5130,7 @@ void CXFA_FM2JSContext::Put(CFXJSE_Value* pThis, CFX_WideString::FromUTF8(bsData.AsStringC()), CFX_WideString::FromUTF8(bsEncode.AsStringC())); if (bFlags) { - FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); + args.GetReturnValue()->SetString(""); } else { pContext->ThrowException(XFA_IDS_SERVER_DENY); } @@ -5198,14 +5151,14 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, FX_BOOL bSetStatus = TRUE; if (FXJSE_Value_IsArray(lValue.get())) { std::unique_ptr<CFXJSE_Value> leftLengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(lValue.get(), "length", leftLengthValue.get()); - int32_t iLeftLength = FXJSE_Value_ToInteger(leftLengthValue.get()); + lValue->GetObjectProperty("length", leftLengthValue.get()); + int32_t iLeftLength = leftLengthValue->ToInteger(); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(lValue.get(), 1, propertyValue.get()); + lValue->GetObjectPropertyByIdx(1, propertyValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t i = 2; i < iLeftLength; i++) { - FXJSE_Value_GetObjectPropByIdx(lValue.get(), i, jsObjectValue.get()); + lValue->GetObjectPropertyByIdx(i, jsObjectValue.get()); bSetStatus = SetObjectDefaultValue(jsObjectValue.get(), rValue.get()); if (!bSetStatus) { pContext->ThrowException(XFA_IDS_NOT_DEFAUL_VALUE); @@ -5214,11 +5167,11 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); for (int32_t i = 2; i < iLeftLength; i++) { - FXJSE_Value_GetObjectPropByIdx(lValue.get(), i, jsObjectValue.get()); - FXJSE_Value_SetObjectProp(jsObjectValue.get(), - propertyStr.AsStringC(), rValue.get()); + lValue->GetObjectPropertyByIdx(i, jsObjectValue.get()); + jsObjectValue->SetObjectProperty(propertyStr.AsStringC(), + rValue.get()); } } } else if (FXJSE_Value_IsObject(lValue.get())) { @@ -5227,7 +5180,7 @@ void CXFA_FM2JSContext::assign_value_operator(CFXJSE_Value* pThis, pContext->ThrowException(XFA_IDS_NOT_DEFAUL_VALUE); } } - FXJSE_Value_Set(args.GetReturnValue(), rValue.get()); + args.GetReturnValue()->Assign(rValue.get()); } else { pContext->ThrowException(XFA_IDS_COMPILER_ERROR); } @@ -5242,11 +5195,11 @@ void CXFA_FM2JSContext::logical_or_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) && FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first || second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first || second) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5262,11 +5215,11 @@ void CXFA_FM2JSContext::logical_and_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) && FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_FLOAT first = ValueToFloat(pThis, argFirst.get()); FX_FLOAT second = ValueToFloat(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first && second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first && second) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5279,30 +5232,27 @@ void CXFA_FM2JSContext::equality_operator(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { if (args.GetLength() == 2) { if (fm_ref_equal(pThis, args)) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 1); + args.GetReturnValue()->SetInteger(1); } else { std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) || FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), - (FXJSE_Value_IsNull(argFirst.get()) && - FXJSE_Value_IsNull(argSecond.get())) - ? 1 - : 0); + args.GetReturnValue()->SetInteger((FXJSE_Value_IsNull(argFirst.get()) && + FXJSE_Value_IsNull(argSecond.get())) + ? 1 + : 0); } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && FXJSE_Value_IsUTF8String(argSecond.get())) { CFX_ByteString firstOutput; CFX_ByteString secondOutput; - FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); - FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); - FXJSE_Value_SetInteger(args.GetReturnValue(), - firstOutput == secondOutput); + argFirst->ToString(firstOutput); + argSecond->ToString(secondOutput); + args.GetReturnValue()->SetInteger(firstOutput == secondOutput); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), - (first == second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first == second) ? 1 : 0); } } } else { @@ -5316,29 +5266,27 @@ void CXFA_FM2JSContext::notequality_operator(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { if (args.GetLength() == 2) { if (fm_ref_equal(pThis, args)) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); } else { std::unique_ptr<CFXJSE_Value> argFirst = GetSimpleValue(pThis, args, 0); std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) || FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), - (FXJSE_Value_IsNull(argFirst.get()) && - FXJSE_Value_IsNull(argSecond.get())) - ? 0 - : 1); + args.GetReturnValue()->SetInteger((FXJSE_Value_IsNull(argFirst.get()) && + FXJSE_Value_IsNull(argSecond.get())) + ? 0 + : 1); } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && FXJSE_Value_IsUTF8String(argSecond.get())) { CFX_ByteString firstOutput; CFX_ByteString secondOutput; - FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); - FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); - FXJSE_Value_SetInteger(args.GetReturnValue(), - firstOutput != secondOutput); + argFirst->ToString(firstOutput); + argSecond->ToString(secondOutput); + args.GetReturnValue()->SetInteger(firstOutput != secondOutput); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), first != second); + args.GetReturnValue()->SetInteger(first != second); } } } else { @@ -5357,14 +5305,13 @@ FX_BOOL CXFA_FM2JSContext::fm_ref_equal(CFXJSE_Value* pThis, FXJSE_Value_IsArray(argSecond.get())) { std::unique_ptr<CFXJSE_Value> firstFlagValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> secondFlagValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 0, firstFlagValue.get()); - FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 0, secondFlagValue.get()); - if ((FXJSE_Value_ToInteger(firstFlagValue.get()) == 3) && - (FXJSE_Value_ToInteger(secondFlagValue.get()) == 3)) { + argFirst->GetObjectPropertyByIdx(0, firstFlagValue.get()); + argSecond->GetObjectPropertyByIdx(0, secondFlagValue.get()); + if (firstFlagValue->ToInteger() == 3 && secondFlagValue->ToInteger() == 3) { std::unique_ptr<CFXJSE_Value> firstJSObject(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> secondJSObject(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argFirst.get(), 2, firstJSObject.get()); - FXJSE_Value_GetObjectPropByIdx(argSecond.get(), 2, secondJSObject.get()); + argFirst->GetObjectPropertyByIdx(2, firstJSObject.get()); + argSecond->GetObjectPropertyByIdx(2, secondJSObject.get()); if (!FXJSE_Value_IsNull(firstJSObject.get()) && !FXJSE_Value_IsNull(secondJSObject.get())) { bRet = (firstJSObject->ToHostObject(nullptr) == @@ -5384,20 +5331,19 @@ void CXFA_FM2JSContext::less_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) || FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && FXJSE_Value_IsUTF8String(argSecond.get())) { CFX_ByteString firstOutput; CFX_ByteString secondOutput; - FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); - FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); - FXJSE_Value_SetInteger( - args.GetReturnValue(), + argFirst->ToString(firstOutput); + argSecond->ToString(secondOutput); + args.GetReturnValue()->SetInteger( firstOutput.Compare(secondOutput.AsStringC()) == -1); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first < second) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5413,24 +5359,22 @@ void CXFA_FM2JSContext::lessequal_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) || FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), - (FXJSE_Value_IsNull(argFirst.get()) && - FXJSE_Value_IsNull(argSecond.get())) - ? 1 - : 0); + args.GetReturnValue()->SetInteger((FXJSE_Value_IsNull(argFirst.get()) && + FXJSE_Value_IsNull(argSecond.get())) + ? 1 + : 0); } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && FXJSE_Value_IsUTF8String(argSecond.get())) { CFX_ByteString firstOutput; CFX_ByteString secondOutput; - FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); - FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); - FXJSE_Value_SetInteger( - args.GetReturnValue(), + argFirst->ToString(firstOutput); + argSecond->ToString(secondOutput); + args.GetReturnValue()->SetInteger( firstOutput.Compare(secondOutput.AsStringC()) != 1); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first <= second) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5446,20 +5390,19 @@ void CXFA_FM2JSContext::greater_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) || FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), 0); + args.GetReturnValue()->SetInteger(0); } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && FXJSE_Value_IsUTF8String(argSecond.get())) { CFX_ByteString firstOutput; CFX_ByteString secondOutput; - FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); - FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); - FXJSE_Value_SetInteger( - args.GetReturnValue(), + argFirst->ToString(firstOutput); + argSecond->ToString(secondOutput); + args.GetReturnValue()->SetInteger( firstOutput.Compare(secondOutput.AsStringC()) == 1); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first > second) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5475,24 +5418,22 @@ void CXFA_FM2JSContext::greaterequal_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) || FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetInteger(args.GetReturnValue(), - (FXJSE_Value_IsNull(argFirst.get()) && - FXJSE_Value_IsNull(argSecond.get())) - ? 1 - : 0); + args.GetReturnValue()->SetInteger((FXJSE_Value_IsNull(argFirst.get()) && + FXJSE_Value_IsNull(argSecond.get())) + ? 1 + : 0); } else if (FXJSE_Value_IsUTF8String(argFirst.get()) && FXJSE_Value_IsUTF8String(argSecond.get())) { CFX_ByteString firstOutput; CFX_ByteString secondOutput; - FXJSE_Value_ToUTF8String(argFirst.get(), firstOutput); - FXJSE_Value_ToUTF8String(argSecond.get(), secondOutput); - FXJSE_Value_SetInteger( - args.GetReturnValue(), + argFirst->ToString(firstOutput); + argSecond->ToString(secondOutput); + args.GetReturnValue()->SetInteger( firstOutput.Compare(secondOutput.AsStringC()) != -1); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); + args.GetReturnValue()->SetInteger((first >= second) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5508,11 +5449,11 @@ void CXFA_FM2JSContext::plus_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = args.GetValue(1); if (ValueIsNull(pThis, argFirst.get()) && ValueIsNull(pThis, argSecond.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetDouble(args.GetReturnValue(), first + second); + args.GetReturnValue()->SetDouble(first + second); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5528,11 +5469,11 @@ void CXFA_FM2JSContext::minus_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) && FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetDouble(args.GetReturnValue(), first - second); + args.GetReturnValue()->SetDouble(first - second); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5548,11 +5489,11 @@ void CXFA_FM2JSContext::multiple_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) && FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); - FXJSE_Value_SetDouble(args.GetReturnValue(), first * second); + args.GetReturnValue()->SetDouble(first * second); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5569,14 +5510,14 @@ void CXFA_FM2JSContext::divide_operator(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> argSecond = GetSimpleValue(pThis, args, 1); if (FXJSE_Value_IsNull(argFirst.get()) && FXJSE_Value_IsNull(argSecond.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_DOUBLE first = ValueToDouble(pThis, argFirst.get()); FX_DOUBLE second = ValueToDouble(pThis, argSecond.get()); if (second == 0.0) { pContext->ThrowException(XFA_IDS_DIVIDE_ZERO); } else { - FXJSE_Value_SetDouble(args.GetReturnValue(), first / second); + args.GetReturnValue()->SetDouble(first / second); } } } else { @@ -5591,10 +5532,10 @@ void CXFA_FM2JSContext::positive_operator(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { - FXJSE_Value_SetDouble(args.GetReturnValue(), - 0.0 + ValueToDouble(pThis, argOne.get())); + args.GetReturnValue()->SetDouble(0.0 + + ValueToDouble(pThis, argOne.get())); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5608,10 +5549,10 @@ void CXFA_FM2JSContext::negative_operator(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { - FXJSE_Value_SetDouble(args.GetReturnValue(), - 0.0 - ValueToDouble(pThis, argOne.get())); + args.GetReturnValue()->SetDouble(0.0 - + ValueToDouble(pThis, argOne.get())); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5625,10 +5566,10 @@ void CXFA_FM2JSContext::logical_not_operator(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = GetSimpleValue(pThis, args, 0); if (FXJSE_Value_IsNull(argOne.get())) { - FXJSE_Value_SetNull(args.GetReturnValue()); + args.GetReturnValue()->SetNull(); } else { FX_DOUBLE first = ValueToDouble(pThis, argOne.get()); - FXJSE_Value_SetInteger(args.GetReturnValue(), (first == 0.0) ? 1 : 0); + args.GetReturnValue()->SetInteger((first == 0.0) ? 1 : 0); } } else { ToJSContext(pThis, nullptr)->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -5659,9 +5600,8 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, szSomExp); if (FXJSE_Value_IsArray(argAccessor.get())) { std::unique_ptr<CFXJSE_Value> pLengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argAccessor.get(), "length", - pLengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(pLengthValue.get()); + argAccessor->GetObjectProperty("length", pLengthValue.get()); + int32_t iLength = pLengthValue->ToInteger(); int32_t iCounter = 0; CFXJSE_Value*** hResolveValues = FX_Alloc(CFXJSE_Value**, iLength - 2); int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); @@ -5671,7 +5611,7 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> hJSObjValue(new CFXJSE_Value(pIsolate)); FX_BOOL bAttribute = FALSE; for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argAccessor.get(), i, hJSObjValue.get()); + argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get()); XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(), @@ -5687,20 +5627,20 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, for (int32_t i = 0; i < (iCounter + 2); i++) rgValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_SetInteger(rgValues[0], 1); + rgValues[0]->SetInteger(1); if (bAttribute) { - FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); + rgValues[1]->SetString(szName.AsStringC()); } else { - FXJSE_Value_SetNull(rgValues[1]); + rgValues[1]->SetNull(); } int32_t iIndex = 2; for (int32_t i = 0; i < iLength - 2; i++) { for (int32_t j = 0; j < iSizes[i]; j++) { - FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); + rgValues[iIndex]->Assign(hResolveValues[i][j]); iIndex++; } } - FXJSE_Value_SetArray(args.GetReturnValue(), (iCounter + 2), rgValues); + args.GetReturnValue()->SetArray(iCounter + 2, rgValues); for (int32_t i = 0; i < (iCounter + 2); i++) delete rgValues[i]; @@ -5750,16 +5690,16 @@ void CXFA_FM2JSContext::dot_accessor(CFXJSE_Value* pThis, for (int32_t i = 0; i < (iSize + 2); i++) rgValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_SetInteger(rgValues[0], 1); + rgValues[0]->SetInteger(1); if (bAttribute) { - FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); + rgValues[1]->SetString(szName.AsStringC()); } else { - FXJSE_Value_SetNull(rgValues[1]); + rgValues[1]->SetNull(); } for (int32_t i = 0; i < iSize; i++) { - FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); + rgValues[i + 2]->Assign(hResolveValues[i]); } - FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); + args.GetReturnValue()->SetArray(iSize + 2, rgValues); for (int32_t i = 0; i < (iSize + 2); i++) delete rgValues[i]; @@ -5807,16 +5747,15 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, szSomExp); if (FXJSE_Value_IsArray(argAccessor.get())) { std::unique_ptr<CFXJSE_Value> pLengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argAccessor.get(), "length", - pLengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(pLengthValue.get()); + argAccessor->GetObjectProperty("length", pLengthValue.get()); + int32_t iLength = pLengthValue->ToInteger(); int32_t iCounter = 0; CFXJSE_Value*** hResolveValues = FX_Alloc(CFXJSE_Value**, iLength - 2); int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); std::unique_ptr<CFXJSE_Value> hJSObjValue(new CFXJSE_Value(pIsolate)); FX_BOOL bAttribute = FALSE; for (int32_t i = 2; i < iLength; i++) { - FXJSE_Value_GetObjectPropByIdx(argAccessor.get(), i, hJSObjValue.get()); + argAccessor->GetObjectPropertyByIdx(i, hJSObjValue.get()); XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = ResolveObjects(pThis, hJSObjValue.get(), szSomExp.AsStringC(), @@ -5832,20 +5771,20 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, for (int32_t i = 0; i < (iCounter + 2); i++) rgValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_SetInteger(rgValues[0], 1); + rgValues[0]->SetInteger(1); if (bAttribute) { - FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); + rgValues[1]->SetString(szName.AsStringC()); } else { - FXJSE_Value_SetNull(rgValues[1]); + rgValues[1]->SetNull(); } int32_t iIndex = 2; for (int32_t i = 0; i < iLength - 2; i++) { for (int32_t j = 0; j < iSizes[i]; j++) { - FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); + rgValues[iIndex]->Assign(hResolveValues[i][j]); iIndex++; } } - FXJSE_Value_SetArray(args.GetReturnValue(), (iCounter + 2), rgValues); + args.GetReturnValue()->SetArray(iCounter + 2, rgValues); for (int32_t i = 0; i < (iCounter + 2); i++) delete rgValues[i]; @@ -5893,16 +5832,16 @@ void CXFA_FM2JSContext::dotdot_accessor(CFXJSE_Value* pThis, for (int32_t i = 0; i < (iSize + 2); i++) rgValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_SetInteger(rgValues[0], 1); + rgValues[0]->SetInteger(1); if (bAttribute) { - FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); + rgValues[1]->SetString(szName.AsStringC()); } else { - FXJSE_Value_SetNull(rgValues[1]); + rgValues[1]->SetNull(); } for (int32_t i = 0; i < iSize; i++) { - FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); + rgValues[i + 2]->Assign(hResolveValues[i]); } - FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); + args.GetReturnValue()->SetArray(iSize + 2, rgValues); for (int32_t i = 0; i < (iSize + 2); i++) delete rgValues[i]; @@ -5946,8 +5885,7 @@ void CXFA_FM2JSContext::eval_translation(CFXJSE_Value* pThis, wsError); if (wsError.IsEmpty()) { CFX_WideString javaScript = wsJavaScriptBuf.MakeString(); - FXJSE_Value_SetUTF8String( - args.GetReturnValue(), + args.GetReturnValue()->SetString( FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()) .AsStringC()); } else { @@ -5965,10 +5903,9 @@ void CXFA_FM2JSContext::is_fm_object(CFXJSE_Value* pThis, CFXJSE_Arguments& args) { if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); - FXJSE_Value_SetBoolean(args.GetReturnValue(), - FXJSE_Value_IsObject(argOne.get())); + args.GetReturnValue()->SetBoolean(FXJSE_Value_IsObject(argOne.get())); } else { - FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); + args.GetReturnValue()->SetBoolean(FALSE); } } @@ -5979,9 +5916,9 @@ void CXFA_FM2JSContext::is_fm_array(CFXJSE_Value* pThis, if (args.GetLength() == 1) { std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0); FX_BOOL bIsArray = FXJSE_Value_IsArray(argOne.get()); - FXJSE_Value_SetBoolean(args.GetReturnValue(), bIsArray); + args.GetReturnValue()->SetBoolean(bIsArray); } else { - FXJSE_Value_SetBoolean(args.GetReturnValue(), FALSE); + args.GetReturnValue()->SetBoolean(FALSE); } } @@ -5996,20 +5933,20 @@ void CXFA_FM2JSContext::get_fm_value(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(argOne.get())) { std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, jsObjectValue.get()); + argOne->GetObjectPropertyByIdx(1, propertyValue.get()); + argOne->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { GetObjectDefaultValue(jsObjectValue.get(), args.GetReturnValue()); } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - args.GetReturnValue()); + propertyValue->ToString(propertyStr); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + args.GetReturnValue()); } } else if (FXJSE_Value_IsObject(argOne.get())) { GetObjectDefaultValue(argOne.get(), args.GetReturnValue()); } else { - FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); + args.GetReturnValue()->Assign(argOne.get()); } } else { pContext->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -6027,12 +5964,12 @@ void CXFA_FM2JSContext::get_fm_jsobj(CFXJSE_Value* pThis, CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); v8::Isolate* pIsolate = pContext->GetScriptRuntime(); std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); - ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); + argOne->GetObjectProperty("length", lengthValue.get()); + ASSERT(lengthValue->ToInteger() >= 3); #endif - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, args.GetReturnValue()); + argOne->GetObjectPropertyByIdx(2, args.GetReturnValue()); } else { - FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); + args.GetReturnValue()->Assign(argOne.get()); } } else { CXFA_FM2JSContext* pContext = ToJSContext(pThis, nullptr); @@ -6051,40 +5988,40 @@ void CXFA_FM2JSContext::fm_var_filter(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(argOne.get())) { #ifndef NDEBUG std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argOne.get(), "length", lengthValue.get()); - ASSERT(FXJSE_Value_ToInteger(lengthValue.get()) >= 3); + argOne->GetObjectProperty("length", lengthValue.get()); + ASSERT(lengthValue->ToInteger() >= 3); #endif std::unique_ptr<CFXJSE_Value> flagsValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 0, flagsValue.get()); - int32_t iFlags = FXJSE_Value_ToInteger(flagsValue.get()); + argOne->GetObjectPropertyByIdx(0, flagsValue.get()); + int32_t iFlags = flagsValue->ToInteger(); if (iFlags == 4) { CFXJSE_Value* rgValues[3]; for (int32_t i = 0; i < 3; i++) rgValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_SetInteger(rgValues[0], 3); - FXJSE_Value_SetNull(rgValues[1]); - FXJSE_Value_SetNull(rgValues[2]); - FXJSE_Value_SetArray(args.GetReturnValue(), 3, rgValues); + rgValues[0]->SetInteger(3); + rgValues[1]->SetNull(); + rgValues[2]->SetNull(); + args.GetReturnValue()->SetArray(3, rgValues); for (int32_t i = 0; i < 3; i++) delete rgValues[i]; } else if (iFlags == 3) { std::unique_ptr<CFXJSE_Value> objectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argOne.get(), 2, objectValue.get()); + argOne->GetObjectPropertyByIdx(2, objectValue.get()); if (!FXJSE_Value_IsNull(objectValue.get())) { - FXJSE_Value_Set(args.GetReturnValue(), argOne.get()); + args.GetReturnValue()->Assign(argOne.get()); } else { pContext->ThrowException(XFA_IDS_COMPILER_ERROR); } } else { std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, args, 0); - FXJSE_Value_Set(args.GetReturnValue(), simpleValue.get()); + args.GetReturnValue()->Assign(simpleValue.get()); } } else { std::unique_ptr<CFXJSE_Value> simpleValue = GetSimpleValue(pThis, args, 0); - FXJSE_Value_Set(args.GetReturnValue(), simpleValue.get()); + args.GetReturnValue()->Assign(simpleValue.get()); } } else { pContext->ThrowException(XFA_IDS_COMPILER_ERROR); @@ -6103,9 +6040,8 @@ void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, argValues.push_back(args.GetValue(i)); if (FXJSE_Value_IsArray(argValues[i].get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValues[i].get(), "length", - lengthValue.get()); - int32_t length = FXJSE_Value_ToInteger(lengthValue.get()); + argValues[i]->GetObjectProperty("length", lengthValue.get()); + int32_t length = lengthValue->ToInteger(); iLength = iLength + ((length > 2) ? (length - 2) : 0); } iLength += 1; @@ -6118,19 +6054,17 @@ void CXFA_FM2JSContext::concat_fm_object(CFXJSE_Value* pThis, for (int32_t i = 0; i < argc; i++) { if (FXJSE_Value_IsArray(argValues[i].get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argValues[i].get(), "length", - lengthValue.get()); - int32_t length = FXJSE_Value_ToInteger(lengthValue.get()); + argValues[i]->GetObjectProperty("length", lengthValue.get()); + int32_t length = lengthValue->ToInteger(); for (int32_t j = 2; j < length; j++) { - FXJSE_Value_GetObjectPropByIdx(argValues[i].get(), j, - returnValues[index]); + argValues[i]->GetObjectPropertyByIdx(j, returnValues[index]); index++; } } - FXJSE_Value_Set(returnValues[index], argValues[i].get()); + returnValues[index]->Assign(argValues[i].get()); index++; } - FXJSE_Value_SetArray(args.GetReturnValue(), iLength, returnValues); + args.GetReturnValue()->SetArray(iLength, returnValues); for (int32_t i = 0; i < (int32_t)iLength; i++) delete returnValues[i]; @@ -6147,24 +6081,24 @@ std::unique_ptr<CFXJSE_Value> CXFA_FM2JSContext::GetSimpleValue( std::unique_ptr<CFXJSE_Value> argIndex = args.GetValue(index); if (FXJSE_Value_IsArray(argIndex.get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argIndex.get(), "length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argIndex->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); std::unique_ptr<CFXJSE_Value> simpleValue(new CFXJSE_Value(pIsolate)); if (iLength > 2) { std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argIndex.get(), 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(argIndex.get(), 2, jsObjectValue.get()); + argIndex->GetObjectPropertyByIdx(1, propertyValue.get()); + argIndex->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { GetObjectDefaultValue(jsObjectValue.get(), simpleValue.get()); } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - simpleValue.get()); + propertyValue->ToString(propertyStr); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + simpleValue.get()); } } else { - FXJSE_Value_SetUndefined(simpleValue.get()); + simpleValue.get()->SetUndefined(); } return simpleValue; } else if (FXJSE_Value_IsObject(argIndex.get())) { @@ -6187,8 +6121,8 @@ FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { if (iLength > 2) { std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); + arg->GetObjectPropertyByIdx(1, propertyValue.get()); + arg->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { std::unique_ptr<CFXJSE_Value> defaultValue(new CFXJSE_Value(pIsolate)); GetObjectDefaultValue(jsObjectValue.get(), defaultValue.get()); @@ -6197,11 +6131,11 @@ FX_BOOL CXFA_FM2JSContext::ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* arg) { } } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); std::unique_ptr<CFXJSE_Value> newPropertyValue( new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - newPropertyValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); if (FXJSE_Value_IsNull(newPropertyValue.get())) { isNull = TRUE; } @@ -6226,8 +6160,8 @@ int32_t CXFA_FM2JSContext::hvalue_get_array_length(CFXJSE_Value* pThis, int32_t iLength = 0; if (FXJSE_Value_IsArray(arg)) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(arg, "length", lengthValue.get()); - iLength = FXJSE_Value_ToInteger(lengthValue.get()); + arg->GetObjectProperty("length", lengthValue.get()); + iLength = lengthValue->ToInteger(); } return iLength; } @@ -6247,8 +6181,7 @@ FX_BOOL CXFA_FM2JSContext::simpleValueCompare(CFXJSE_Value* pThis, FX_FLOAT second = ValueToFloat(pThis, secondValue); bReturn = (first == second); } else if (FXJSE_Value_IsBoolean(firstValue)) { - bReturn = (FXJSE_Value_ToBoolean(firstValue) == - FXJSE_Value_ToBoolean(secondValue)); + bReturn = (firstValue->ToBoolean() == secondValue->ToBoolean()); } else if (FXJSE_Value_IsNull(firstValue) && FXJSE_Value_IsNull(secondValue)) { bReturn = TRUE; @@ -6270,9 +6203,8 @@ void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, argsValue.push_back(args.GetValue(i + iStart)); if (FXJSE_Value_IsArray(argsValue[i].get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argsValue[i].get(), "length", - lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argsValue[i]->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); iCount += ((iLength > 2) ? (iLength - 2) : 0); } else { iCount += 1; @@ -6286,30 +6218,25 @@ void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, for (int32_t i = 0; i < argc - iStart; i++) { if (FXJSE_Value_IsArray(argsValue[i].get())) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(argsValue[i].get(), "length", - lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + argsValue[i]->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength > 2) { std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(argsValue[i].get(), 1, - propertyValue.get()); + argsValue[i]->GetObjectPropertyByIdx(1, propertyValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argsValue[i].get(), j, - jsObjectValue.get()); + argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get()); GetObjectDefaultValue(jsObjectValue.get(), resultValues[index]); index++; } } else { CFX_ByteString propertyString; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyString); + propertyValue->ToString(propertyString); for (int32_t j = 2; j < iLength; j++) { - FXJSE_Value_GetObjectPropByIdx(argsValue[i].get(), j, - jsObjectValue.get()); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), - propertyString.AsStringC(), - resultValues[index]); + argsValue[i]->GetObjectPropertyByIdx(j, jsObjectValue.get()); + jsObjectValue->GetObjectProperty(propertyString.AsStringC(), + resultValues[index]); index++; } } @@ -6318,7 +6245,7 @@ void CXFA_FM2JSContext::unfoldArgs(CFXJSE_Value* pThis, GetObjectDefaultValue(argsValue[i].get(), resultValues[index]); index++; } else { - FXJSE_Value_Set(resultValues[index], argsValue[i].get()); + resultValues[index]->Assign(argsValue[i].get()); index++; } } @@ -6329,7 +6256,7 @@ void CXFA_FM2JSContext::GetObjectDefaultValue(CFXJSE_Value* pValue, CFXJSE_Value* pDefaultValue) { CXFA_Node* pNode = ToNode(CXFA_ScriptContext::ToObject(pValue, nullptr)); if (!pNode) { - FXJSE_Value_SetNull(pDefaultValue); + pDefaultValue->SetNull(); return; } pNode->Script_Som_DefaultValue(pDefaultValue, FALSE, (XFA_ATTRIBUTE)-1); @@ -6396,8 +6323,8 @@ FX_BOOL CXFA_FM2JSContext::GetObjectByName( CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, dwFlags); if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { - FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( - resoveNodeRS.nodes.GetAt(0))); + accessorValue->Assign( + pScriptContext->GetJSValueFromMap(resoveNodeRS.nodes.GetAt(0))); bFlags = TRUE; } return bFlags; @@ -6472,8 +6399,7 @@ void CXFA_FM2JSContext::ParseResolveResult( resultValues = FX_Alloc(CFXJSE_Value*, iSize); for (int32_t i = 0; i < iSize; i++) { resultValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_Set( - resultValues[i], + resultValues[i]->Assign( pContext->GetDocument()->GetScriptContext()->GetJSValueFromMap( resoveNodeRS.nodes.GetAt(i))); } @@ -6486,14 +6412,14 @@ void CXFA_FM2JSContext::ParseResolveResult( iSize = 1; resultValues = FX_Alloc(CFXJSE_Value*, 1); resultValues[0] = new CFXJSE_Value(pIsolate); - FXJSE_Value_Set(resultValues[0], pParentValue); + resultValues[0]->Assign(pParentValue); } } else { iSize = iRet; resultValues = FX_Alloc(CFXJSE_Value*, iSize); for (int32_t i = 0; i < iSize; i++) { resultValues[i] = new CFXJSE_Value(pIsolate); - FXJSE_Value_Set(resultValues[i], objectProperties[i]); + resultValues[i]->Assign(objectProperties[i]); } } } @@ -6508,15 +6434,15 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(pValue, 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(pValue, 2, jsObjectValue.get()); + pValue->GetObjectPropertyByIdx(1, propertyValue.get()); + pValue->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - newPropertyValue.get()); + propertyValue->ToString(propertyStr); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); } iValue = ValueToInteger(pThis, newPropertyValue.get()); return iValue; @@ -6527,10 +6453,10 @@ int32_t CXFA_FM2JSContext::ValueToInteger(CFXJSE_Value* pThis, return iValue; } else if (FXJSE_Value_IsUTF8String(pValue)) { CFX_ByteString szValue; - FXJSE_Value_ToUTF8String(pValue, szValue); + pValue->ToString(szValue); iValue = FXSYS_atoi(szValue.c_str()); } else { - iValue = FXJSE_Value_ToInteger(pValue); + iValue = pValue->ToInteger(); } return iValue; } @@ -6544,15 +6470,15 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); + arg->GetObjectPropertyByIdx(1, propertyValue.get()); + arg->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - newPropertyValue.get()); + propertyValue->ToString(propertyStr); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); } fRet = ValueToFloat(pThis, newPropertyValue.get()); } else if (FXJSE_Value_IsObject(arg)) { @@ -6561,12 +6487,12 @@ FX_FLOAT CXFA_FM2JSContext::ValueToFloat(CFXJSE_Value* pThis, fRet = ValueToFloat(pThis, newPropertyValue.get()); } else if (FXJSE_Value_IsUTF8String(arg)) { CFX_ByteString bsOutput; - FXJSE_Value_ToUTF8String(arg, bsOutput); + arg->ToString(bsOutput); fRet = (FX_FLOAT)XFA_ByteStringToDouble(bsOutput.AsStringC()); } else if (FXJSE_Value_IsUndefined(arg)) { fRet = 0; } else { - fRet = FXJSE_Value_ToFloat(arg); + fRet = arg->ToFloat(); } return fRet; } @@ -6580,15 +6506,15 @@ FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(arg, 2, jsObjectValue.get()); + arg->GetObjectPropertyByIdx(1, propertyValue.get()); + arg->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) { GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get()); } else { CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - newPropertyValue.get()); + propertyValue->ToString(propertyStr); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); } dRet = ValueToDouble(pThis, newPropertyValue.get()); } else if (FXJSE_Value_IsObject(arg)) { @@ -6597,12 +6523,12 @@ FX_DOUBLE CXFA_FM2JSContext::ValueToDouble(CFXJSE_Value* pThis, dRet = ValueToDouble(pThis, newPropertyValue.get()); } else if (FXJSE_Value_IsUTF8String(arg)) { CFX_ByteString bsOutput; - FXJSE_Value_ToUTF8String(arg, bsOutput); + arg->ToString(bsOutput); dRet = XFA_ByteStringToDouble(bsOutput.AsStringC()); } else if (FXJSE_Value_IsUndefined(arg)) { dRet = 0; } else { - dRet = FXJSE_Value_ToDouble(arg); + dRet = arg->ToDouble(); } return dRet; } @@ -6618,8 +6544,8 @@ double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, if (FXJSE_Value_IsArray(src)) { std::unique_ptr<CFXJSE_Value> lengthValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(src, "length", lengthValue.get()); - int32_t iLength = FXJSE_Value_ToInteger(lengthValue.get()); + src->GetObjectProperty("length", lengthValue.get()); + int32_t iLength = lengthValue->ToInteger(); if (iLength <= 2) { *ret = false; return 0.0; @@ -6627,16 +6553,16 @@ double CXFA_FM2JSContext::ExtractDouble(CFXJSE_Value* pThis, std::unique_ptr<CFXJSE_Value> propertyValue(new CFXJSE_Value(pIsolate)); std::unique_ptr<CFXJSE_Value> jsObjectValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectPropByIdx(src, 1, propertyValue.get()); - FXJSE_Value_GetObjectPropByIdx(src, 2, jsObjectValue.get()); + src->GetObjectPropertyByIdx(1, propertyValue.get()); + src->GetObjectPropertyByIdx(2, jsObjectValue.get()); if (FXJSE_Value_IsNull(propertyValue.get())) return ValueToDouble(pThis, jsObjectValue.get()); CFX_ByteString propertyStr; - FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr); + propertyValue->ToString(propertyStr); std::unique_ptr<CFXJSE_Value> newPropertyValue(new CFXJSE_Value(pIsolate)); - FXJSE_Value_GetObjectProp(jsObjectValue.get(), propertyStr.AsStringC(), - newPropertyValue.get()); + jsObjectValue->GetObjectProperty(propertyStr.AsStringC(), + newPropertyValue.get()); return ValueToDouble(pThis, newPropertyValue.get()); } return ValueToDouble(pThis, src); @@ -6648,10 +6574,10 @@ void CXFA_FM2JSContext::ValueToUTF8String(CFXJSE_Value* arg, if (FXJSE_Value_IsNull(arg) || FXJSE_Value_IsUndefined(arg)) { szOutputString = ""; } else if (FXJSE_Value_IsBoolean(arg)) { - szOutputString = FXJSE_Value_ToBoolean(arg) ? "1" : "0"; + szOutputString = arg->ToBoolean() ? "1" : "0"; } else { szOutputString = ""; - FXJSE_Value_ToUTF8String(arg, szOutputString); + arg->ToString(szOutputString); } } @@ -6687,14 +6613,14 @@ CXFA_FM2JSContext::CXFA_FM2JSContext(v8::Isolate* pScriptIsolate, m_pFMClass(FXJSE_DefineClass(pScriptContext, &formcalc_fm2js_descriptor)), m_pValue(new CFXJSE_Value(pScriptIsolate)), m_pDocument(pDoc) { - FXJSE_Value_SetNull(m_pValue.get()); - FXJSE_Value_SetObject(m_pValue.get(), this, m_pFMClass); + m_pValue.get()->SetNull(); + m_pValue.get()->SetObject(this, m_pFMClass); } CXFA_FM2JSContext::~CXFA_FM2JSContext() {} void CXFA_FM2JSContext::GlobalPropertyGetter(CFXJSE_Value* pValue) { - FXJSE_Value_Set(pValue, m_pValue.get()); + pValue->Assign(m_pValue.get()); } void CXFA_FM2JSContext::ThrowException(int32_t iStringID, ...) { diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index cfe65ed864..d5a669340d 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -86,8 +86,7 @@ void CXFA_Object::Script_ObjectClass_ClassName(CFXJSE_Value* pValue, if (!bSetting) { CFX_WideStringC className; GetClassName(className); - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(className.c_str(), className.GetLength()).AsStringC()); } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); @@ -645,12 +644,14 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects( refNode, wsExpression.AsStringC(), resoveNodeRS, dwFlag); - if (iRet < 1) - return FXJSE_Value_SetNull(pArguments->GetReturnValue()); + if (iRet < 1) { + pArguments->GetReturnValue()->SetNull(); + return; + } if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { CXFA_Object* pNode = resoveNodeRS.nodes[0]; - FXJSE_Value_Set(pArguments->GetReturnValue(), - pScriptContext->GetJSValueFromMap(pNode)); + pArguments->GetReturnValue()->Assign( + pScriptContext->GetJSValueFromMap(pNode)); } else { const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = resoveNodeRS.pScriptAttribute; @@ -659,9 +660,9 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { new CFXJSE_Value(pScriptContext->GetRuntime())); (resoveNodeRS.nodes[0]->*(lpAttributeInfo->lpfnCallback))( pValue.get(), FALSE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); - FXJSE_Value_Set(pArguments->GetReturnValue(), pValue.get()); + pArguments->GetReturnValue()->Assign(pValue.get()); } else { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); } } } @@ -715,8 +716,7 @@ void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue, } } } - FXJSE_Value_SetObject(pValue, (CXFA_Object*)pNodeList, - pScriptContext->GetJseNormalClass()); + pValue->SetObject(pNodeList, pScriptContext->GetJseNormalClass()); } void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue, @@ -749,8 +749,7 @@ void CXFA_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue, FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); } else { CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); - FXJSE_Value_SetObject(pValue, (CXFA_Object*)pNodeList, - pScriptContext->GetJseNormalClass()); + pValue->SetObject(pNodeList, pScriptContext->GetJseNormalClass()); } } @@ -776,10 +775,10 @@ void CXFA_Node::Script_TreeClass_Parent(CFXJSE_Value* pValue, } else { CXFA_Node* pParent = GetNodeItem(XFA_NODEITEM_Parent); if (pParent) { - FXJSE_Value_Set( - pValue, m_pDocument->GetScriptContext()->GetJSValueFromMap(pParent)); + pValue->Assign( + m_pDocument->GetScriptContext()->GetJSValueFromMap(pParent)); } else { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } } } @@ -790,7 +789,7 @@ void CXFA_Node::Script_TreeClass_Index(CFXJSE_Value* pValue, if (bSetting) ThrowException(XFA_IDS_INVAlID_PROP_SET); else - FXJSE_Value_SetInteger(pValue, GetNodeSameNameIndex()); + pValue->SetInteger(GetNodeSameNameIndex()); } void CXFA_Node::Script_TreeClass_ClassIndex(CFXJSE_Value* pValue, @@ -799,7 +798,7 @@ void CXFA_Node::Script_TreeClass_ClassIndex(CFXJSE_Value* pValue, if (bSetting) ThrowException(XFA_IDS_INVAlID_PROP_SET); else - FXJSE_Value_SetInteger(pValue, GetNodeSameClassIndex()); + pValue->SetInteger(GetNodeSameClassIndex()); } void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue, @@ -810,8 +809,7 @@ void CXFA_Node::Script_TreeClass_SomExpression(CFXJSE_Value* pValue, } else { CFX_WideString wsSOMExpression; GetSOMExpression(wsSOMExpression); - FXJSE_Value_SetUTF8String(pValue, - FX_UTF8Encode(wsSOMExpression).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsSOMExpression).AsStringC()); } } @@ -860,8 +858,7 @@ void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) { } bool bClone = !!pArguments->GetInt32(0); CXFA_Node* pCloneNode = Clone(bClone); - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pCloneNode)); } @@ -877,7 +874,7 @@ void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { GetAttribute(wsExpression.AsStringC(), wsValue); CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { @@ -895,8 +892,8 @@ void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression.AsStringC()); CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); - FXJSE_Value_Set(pArguments->GetReturnValue(), - m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); + pArguments->GetReturnValue()->Assign( + m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); } void CXFA_Node::Script_NodeClass_IsPropertySpecified( @@ -934,7 +931,7 @@ void CXFA_Node::Script_NodeClass_IsPropertySpecified( } CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (pValue) - FXJSE_Value_SetBoolean(pValue, bHas); + pValue->SetBoolean(bHas); } void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { @@ -1080,7 +1077,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { if (GetPacketID() == XFA_XDPPACKET_Datasets) { pElement = GetXMLMappingNode(); if (!pElement || pElement->GetType() != FDE_XMLNODE_Element) { - FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); + pArguments->GetReturnValue()->SetString(bsXMLHeader); return; } XFA_DataExporter_DealWithDataGroupNode(this); @@ -1093,7 +1090,7 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { FX_STREAMACCESS_Text | FX_STREAMACCESS_Write | FX_STREAMACCESS_Append)); if (!pStream) { - FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), bsXMLHeader); + pArguments->GetReturnValue()->SetString(bsXMLHeader); return; } pStream->SetCodePage(FX_CODEPAGE_UTF8); @@ -1105,12 +1102,11 @@ void CXFA_Node::Script_NodeClass_SaveXML(CFXJSE_Arguments* pArguments) { // TODO(weili): Check whether we need to save pretty print XML, pdfium:501. // For now, just put it here to avoid unused variable warning. (void)bPrettyMode; - FXJSE_Value_SetUTF8String( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->SetString( CFX_ByteStringC(pMemoryStream->GetBuffer(), pMemoryStream->GetSize())); return; } - FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); + pArguments->GetReturnValue()->SetString(""); } void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { @@ -1151,7 +1147,7 @@ void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue, } else { CFX_WideString wsNameSpace; TryNamespace(wsNameSpace); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsNameSpace).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsNameSpace).AsStringC()); } } @@ -1161,8 +1157,8 @@ void CXFA_Node::Script_NodeClass_Model(CFXJSE_Value* pValue, if (bSetting) { ThrowException(XFA_IDS_INVAlID_PROP_SET); } else { - FXJSE_Value_Set(pValue, m_pDocument->GetScriptContext()->GetJSValueFromMap( - GetModelNode())); + pValue->Assign( + m_pDocument->GetScriptContext()->GetJSValueFromMap(GetModelNode())); } } @@ -1172,7 +1168,7 @@ void CXFA_Node::Script_NodeClass_IsContainer(CFXJSE_Value* pValue, if (bSetting) ThrowException(XFA_IDS_INVAlID_PROP_SET); else - FXJSE_Value_SetBoolean(pValue, IsContainerNode()); + pValue->SetBoolean(IsContainerNode()); } void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, @@ -1182,11 +1178,11 @@ void CXFA_Node::Script_NodeClass_IsNull(CFXJSE_Value* pValue, ThrowException(XFA_IDS_INVAlID_PROP_SET); } else { if (GetClassID() == XFA_ELEMENT_Subform) { - FXJSE_Value_SetBoolean(pValue, FALSE); + pValue->SetBoolean(FALSE); return; } CFX_WideString strValue; - FXJSE_Value_SetBoolean(pValue, !TryContent(strValue) || strValue.IsEmpty()); + pValue->SetBoolean(!TryContent(strValue) || strValue.IsEmpty()); } } @@ -1199,18 +1195,18 @@ void CXFA_Node::Script_NodeClass_OneOfChild(CFXJSE_Value* pValue, CXFA_NodeArray properts; int32_t iSize = GetNodeList(properts, XFA_NODEFILTER_OneOfProperty); if (iSize > 0) { - FXJSE_Value_Set( - pValue, + pValue->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(properts[0])); } } } void CXFA_Node::Script_ContainerClass_GetDelta(CFXJSE_Arguments* pArguments) {} + void CXFA_Node::Script_ContainerClass_GetDeltas(CFXJSE_Arguments* pArguments) { CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); - FXJSE_Value_SetObject(pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes, - m_pDocument->GetScriptContext()->GetJseNormalClass()); + pArguments->GetReturnValue()->SetObject( + pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass()); } void CXFA_Node::Script_ModelClass_ClearErrorList(CFXJSE_Arguments* pArguments) { } @@ -1231,9 +1227,8 @@ void CXFA_Node::Script_ModelClass_IsCompatibleNS(CFXJSE_Arguments* pArguments) { CFX_WideString wsNodeNameSpace; TryNamespace(wsNodeNameSpace); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetBoolean(pValue, wsNodeNameSpace == wsNameSpace); - } + if (pValue) + pValue->SetBoolean(wsNodeNameSpace == wsNameSpace); } void CXFA_Node::Script_ModelClass_Context(CFXJSE_Value* pValue, FX_BOOL bSetting, @@ -1245,16 +1240,16 @@ void CXFA_Node::Script_Attribute_Integer(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - SetInteger(eAttribute, FXJSE_Value_ToInteger(pValue), true); + SetInteger(eAttribute, pValue->ToInteger(), true); } else { - FXJSE_Value_SetInteger(pValue, GetInteger(eAttribute)); + pValue->SetInteger(GetInteger(eAttribute)); } } void CXFA_Node::Script_Attribute_IntegerRead(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (!bSetting) { - FXJSE_Value_SetInteger(pValue, GetInteger(eAttribute)); + pValue->SetInteger(GetInteger(eAttribute)); } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); } @@ -1263,16 +1258,16 @@ void CXFA_Node::Script_Attribute_BOOL(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - SetBoolean(eAttribute, FXJSE_Value_ToBoolean(pValue), true); + SetBoolean(eAttribute, pValue->ToBoolean(), true); } else { - FXJSE_Value_SetUTF8String(pValue, GetBoolean(eAttribute) ? "1" : "0"); + pValue->SetString(GetBoolean(eAttribute) ? "1" : "0"); } } void CXFA_Node::Script_Attribute_BOOLRead(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (!bSetting) { - FXJSE_Value_SetUTF8String(pValue, GetBoolean(eAttribute) ? "1" : "0"); + pValue->SetString(GetBoolean(eAttribute) ? "1" : "0"); } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); } @@ -1437,7 +1432,7 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { if (bSetting) { CFX_ByteString szValue; - FXJSE_Value_ToUTF8String(pValue, szValue); + pValue->ToString(szValue); CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); SetAttribute(eAttribute, wsValue.AsStringC(), true); if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { @@ -1493,8 +1488,7 @@ void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue, } else { CFX_WideString wsValue; GetAttribute(eAttribute, wsValue); - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } } @@ -1504,8 +1498,7 @@ void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, if (!bSetting) { CFX_WideString wsValue; GetAttribute(eAttribute, wsValue); - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); @@ -1514,7 +1507,7 @@ void CXFA_Node::Script_Attribute_StringRead(CFXJSE_Value* pValue, void CXFA_Node::Script_WsdlConnection_Execute(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if ((argc == 0) || (argc == 1)) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execute"); } @@ -1550,7 +1543,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, } if (bSetting) { CFX_ByteString bsMessage; - FXJSE_Value_ToUTF8String(pValue, bsMessage); + pValue->ToString(bsMessage); switch (iMessageType) { case XFA_SOM_ValidationMessage: validate.SetScriptMessageText( @@ -1589,7 +1582,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, default: break; } - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsMessage).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsMessage).AsStringC()); } } void CXFA_Node::Script_Som_ValidationMessage(CFXJSE_Value* pValue, @@ -1605,10 +1598,10 @@ void CXFA_Node::Script_Field_Length(CFXJSE_Value* pValue, } else { CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetInteger(pValue, 0); + pValue->SetInteger(0); return; } - FXJSE_Value_SetInteger(pValue, pWidgetData->CountChoiceListItems(TRUE)); + pValue->SetInteger(pWidgetData->CountChoiceListItems(TRUE)); } } void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, @@ -1627,9 +1620,9 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, } if (bSetting) { CFX_ByteString newValue; - if (!(FXJSE_Value_IsNull(pValue) || FXJSE_Value_IsUndefined(pValue))) { - FXJSE_Value_ToUTF8String(pValue, newValue); - } + if (!(FXJSE_Value_IsNull(pValue) || FXJSE_Value_IsUndefined(pValue))) + pValue->ToString(newValue); + CFX_WideString wsNewValue = CFX_WideString::FromUTF8(newValue.AsStringC()); CFX_WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = nullptr; @@ -1663,15 +1656,14 @@ void CXFA_Node::Script_Som_DefaultValue(CFXJSE_Value* pValue, CFX_WideString content = GetScriptContent(TRUE); if (content.IsEmpty() && classID != XFA_ELEMENT_Text && classID != XFA_ELEMENT_SubmitUrl) { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } else if (classID == XFA_ELEMENT_Integer) { - FXJSE_Value_SetInteger(pValue, FXSYS_wtoi(content.c_str())); + pValue->SetInteger(FXSYS_wtoi(content.c_str())); } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { CFX_Decimal decimal(content.AsStringC()); - FXJSE_Value_SetFloat(pValue, (FX_FLOAT)(double)decimal); + pValue->SetFloat((FX_FLOAT)(double)decimal); } else { - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } @@ -1685,10 +1677,9 @@ void CXFA_Node::Script_Som_DefaultValue_Read(CFXJSE_Value* pValue, } CFX_WideString content = GetScriptContent(TRUE); if (content.IsEmpty()) { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } else { - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } @@ -1697,9 +1688,9 @@ void CXFA_Node::Script_Boolean_Value(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { if (bSetting) { CFX_ByteString newValue; - if (!(FXJSE_Value_IsNull(pValue) || FXJSE_Value_IsUndefined(pValue))) { - FXJSE_Value_ToUTF8String(pValue, newValue); - } + if (!(FXJSE_Value_IsNull(pValue) || FXJSE_Value_IsUndefined(pValue))) + pValue->ToString(newValue); + int32_t iValue = FXSYS_atoi(newValue.c_str()); CFX_WideString wsNewValue(iValue == 0 ? L"0" : L"1"); CFX_WideString wsFormatValue(wsNewValue); @@ -1710,7 +1701,7 @@ void CXFA_Node::Script_Boolean_Value(CFXJSE_Value* pValue, SetScriptContent(wsNewValue, wsFormatValue, true, TRUE); } else { CFX_WideString wsValue = GetScriptContent(TRUE); - FXJSE_Value_SetBoolean(pValue, wsValue == FX_WSTRC(L"1")); + pValue->SetBoolean(wsValue == FX_WSTRC(L"1")); } } struct XFA_ExecEventParaInfo { @@ -1812,7 +1803,7 @@ void CXFA_Node::Script_Som_BorderColor(CFXJSE_Value* pValue, CFX_WideString strColor; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); strColor = CFX_WideString::FromUTF8(bsValue.AsStringC()); int32_t r = 0, g = 0, b = 0; XFA_STRING_TO_RGB(strColor, r, g, b); @@ -1827,7 +1818,7 @@ void CXFA_Node::Script_Som_BorderColor(CFXJSE_Value* pValue, int32_t a, r, g, b; ArgbDecode(color, a, r, g, b); strColor.Format(L"%d,%d,%d", r, g, b); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(strColor).AsStringC()); + pValue->SetString(FX_UTF8Encode(strColor).AsStringC()); } } void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, @@ -1842,7 +1833,7 @@ void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, CFX_WideString wsThickness; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsThickness = CFX_WideString::FromUTF8(bsValue.AsStringC()); for (int32_t i = 0; i < iSize; ++i) { CXFA_Edge edge = border.GetEdge(i); @@ -1853,7 +1844,7 @@ void CXFA_Node::Script_Som_BorderWidth(CFXJSE_Value* pValue, CXFA_Edge edge = border.GetEdge(0); CXFA_Measurement thickness = edge.GetMSThickness(); thickness.ToString(wsThickness); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsThickness).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsThickness).AsStringC()); } } void CXFA_Node::Script_Som_FillColor(CFXJSE_Value* pValue, @@ -1872,7 +1863,7 @@ void CXFA_Node::Script_Som_FillColor(CFXJSE_Value* pValue, CFX_WideString wsColor; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsColor = CFX_WideString::FromUTF8(bsValue.AsStringC()); int32_t r, g, b; XFA_STRING_TO_RGB(wsColor, r, g, b); @@ -1883,7 +1874,7 @@ void CXFA_Node::Script_Som_FillColor(CFXJSE_Value* pValue, int32_t a, r, g, b; ArgbDecode(color, a, r, g, b); wsColor.Format(L"%d,%d,%d", r, g, b); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsColor).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsColor).AsStringC()); } } void CXFA_Node::Script_Som_DataNode(CFXJSE_Value* pValue, @@ -1892,11 +1883,10 @@ void CXFA_Node::Script_Som_DataNode(CFXJSE_Value* pValue, if (!bSetting) { CXFA_Node* pDataNode = GetBindData(); if (pDataNode) { - FXJSE_Value_Set( - pValue, + pValue->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pDataNode)); } else { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); @@ -1912,7 +1902,7 @@ void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, XFA_ELEMENT uiType = pWidgetData->GetUIType(); if (uiType == XFA_ELEMENT_Text) { CFX_ByteString newValue; - FXJSE_Value_ToUTF8String(pValue, newValue); + pValue->ToString(newValue); CFX_WideString wsNewValue = CFX_WideString::FromUTF8(newValue.AsStringC()); CFX_WideString wsFormatValue(wsNewValue); @@ -1923,10 +1913,9 @@ void CXFA_Node::Script_Draw_DefaultValue(CFXJSE_Value* pValue, } else { CFX_WideString content = GetScriptContent(TRUE); if (content.IsEmpty()) { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } else { - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } @@ -1947,9 +1936,9 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, pWidgetData->m_bIsNull = FALSE; } CFX_ByteString newValue; - if (!(FXJSE_Value_IsNull(pValue) || FXJSE_Value_IsUndefined(pValue))) { - FXJSE_Value_ToUTF8String(pValue, newValue); - } + if (!(FXJSE_Value_IsNull(pValue) || FXJSE_Value_IsUndefined(pValue))) + pValue->ToString(newValue); + CFX_WideString wsNewText = CFX_WideString::FromUTF8(newValue.AsStringC()); CXFA_Node* pUIChild = pWidgetData->GetUIChild(); if (pUIChild->GetClassID() == XFA_ELEMENT_NumericEdit) { @@ -1969,7 +1958,7 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, } else { CFX_WideString content = GetScriptContent(TRUE); if (content.IsEmpty()) { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } else { CXFA_Node* pUIChild = pWidgetData->GetUIChild(); XFA_ELEMENT eUI = pUIChild->GetClassID(); @@ -1978,24 +1967,21 @@ void CXFA_Node::Script_Field_DefaultValue(CFXJSE_Value* pValue, if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { if (eUI == XFA_ELEMENT_NumericEdit && (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } else { CFX_Decimal decimal(content.AsStringC()); - FXJSE_Value_SetFloat(pValue, (FX_FLOAT)(double)decimal); + pValue->SetFloat((FX_FLOAT)(double)decimal); } } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { - FXJSE_Value_SetInteger(pValue, FXSYS_wtoi(content.c_str())); + pValue->SetInteger(FXSYS_wtoi(content.c_str())); } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { - FXJSE_Value_SetBoolean(pValue, - FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); + pValue->SetBoolean(FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { CFX_Decimal decimal(content.AsStringC()); - FXJSE_Value_SetFloat(pValue, (FX_FLOAT)(double)decimal); + pValue->SetFloat((FX_FLOAT)(double)decimal); } else { - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } @@ -2011,12 +1997,12 @@ void CXFA_Node::Script_Field_EditValue(CFXJSE_Value* pValue, CFX_WideString wsValue; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit); } else { pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } } void CXFA_Node::Script_Som_FontColor(CFXJSE_Value* pValue, @@ -2034,7 +2020,7 @@ void CXFA_Node::Script_Som_FontColor(CFXJSE_Value* pValue, CFX_WideString wsColor; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsColor = CFX_WideString::FromUTF8(bsValue.AsStringC()); int32_t r, g, b; XFA_STRING_TO_RGB(wsColor, r, g, b); @@ -2045,7 +2031,7 @@ void CXFA_Node::Script_Som_FontColor(CFXJSE_Value* pValue, int32_t a, r, g, b; ArgbDecode(color, a, r, g, b); wsColor.Format(L"%d,%d,%d", r, g, b); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsColor).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsColor).AsStringC()); } } void CXFA_Node::Script_Field_FormatMessage(CFXJSE_Value* pValue, @@ -2063,12 +2049,12 @@ void CXFA_Node::Script_Field_FormattedValue(CFXJSE_Value* pValue, CFX_WideString wsValue; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display); } else { pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } } void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, @@ -2082,7 +2068,7 @@ void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, CFX_WideString wsValue; if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); validate.SetNullTest(wsValue); } else { @@ -2092,7 +2078,7 @@ void CXFA_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, if (pInfo) { wsValue = pInfo->pName; } - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } } void CXFA_Node::Script_Som_MandatoryMessage(CFXJSE_Value* pValue, @@ -2106,7 +2092,7 @@ void CXFA_Node::Script_Field_ParentSubform(CFXJSE_Value* pValue, if (bSetting) { ThrowException(XFA_IDS_INVAlID_PROP_SET); } else { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } } void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue, @@ -2117,14 +2103,14 @@ void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue, return; } if (bSetting) { - int32_t iIndex = FXJSE_Value_ToInteger(pValue); + int32_t iIndex = pValue->ToInteger(); if (iIndex == -1) { pWidgetData->ClearAllSelections(); return; } pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE); } else { - FXJSE_Value_SetInteger(pValue, pWidgetData->GetSelectedItem()); + pValue->SetInteger(pWidgetData->GetSelectedItem()); } } void CXFA_Node::Script_Field_ClearItems(CFXJSE_Arguments* pArguments) { @@ -2142,8 +2128,8 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { CFX_WideString::FromUTF8(eventString.AsStringC()).AsStringC(), XFA_ELEMENT_Field); if (eventString == "validate") { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), - ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); + pArguments->GetReturnValue()->SetBoolean( + (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); @@ -2174,9 +2160,8 @@ void CXFA_Node::Script_Field_DeleteItem(CFXJSE_Arguments* pArguments) { int32_t iIndex = pArguments->GetInt32(0); FX_BOOL bValue = pWidgetData->DeleteItem(iIndex, TRUE, TRUE); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetBoolean(pValue, bValue); - } + if (pValue) + pValue->SetBoolean(bValue); } void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); @@ -2186,22 +2171,21 @@ void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { } int32_t iIndex = pArguments->GetInt32(0); if (iIndex < 0) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); return; } CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); return; } CFX_WideString wsValue; FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE); if (bHasItem) { - FXJSE_Value_SetUTF8String( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->SetString( FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } else { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); } } void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { @@ -2219,9 +2203,8 @@ void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { CFX_WideString wsBoundValue; pWidgetData->GetItemValue(wsValue.AsStringC(), wsBoundValue); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsBoundValue).AsStringC()); - } + if (pValue) + pValue->SetString(FX_UTF8Encode(wsBoundValue).AsStringC()); } void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); @@ -2236,9 +2219,8 @@ void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) { int32_t iIndex = pArguments->GetInt32(0); FX_BOOL bValue = pWidgetData->GetItemState(iIndex); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetBoolean(pValue, bValue); - } + if (pValue) + pValue->SetBoolean(bValue); } void CXFA_Node::Script_Field_ExecCalculate(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); @@ -2261,22 +2243,21 @@ void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) { } int32_t iIndex = pArguments->GetInt32(0); if (iIndex < 0) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); return; } CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); return; } CFX_WideString wsValue; FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE); if (bHasItem) { - FXJSE_Value_SetUTF8String( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->SetString( FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } else { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); } } void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) { @@ -2324,12 +2305,12 @@ void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate, FALSE, FALSE); - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), - ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); + pArguments->GetReturnValue()->SetBoolean( + (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); @@ -2352,7 +2333,7 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue, } if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); pWidgetData->SetSelectedMemberByValue( CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC(), true, TRUE, TRUE); @@ -2360,9 +2341,9 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue, CFX_WideString wsValue = GetScriptContent(TRUE); XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } else { - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } } } @@ -2390,7 +2371,7 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); return; } @@ -2404,11 +2385,10 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC(), true); } if (!pReturnNode) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); return; } - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode)); } @@ -2441,11 +2421,11 @@ void CXFA_Node::Script_ExclGroup_ExecValidate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), - ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); + pArguments->GetReturnValue()->SetBoolean( + (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); @@ -2489,7 +2469,7 @@ void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - int32_t iTo = FXJSE_Value_ToInteger(pValue); + int32_t iTo = pValue->ToInteger(); int32_t iFrom = Subform_and_SubformSet_InstanceIndex(); CXFA_Node* pManagerNode = nullptr; for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_PrevSibling); pNode; @@ -2517,7 +2497,7 @@ void CXFA_Node::Script_Som_InstanceIndex(CFXJSE_Value* pValue, } } } else { - FXJSE_Value_SetInteger(pValue, Subform_and_SubformSet_InstanceIndex()); + pValue->SetInteger(Subform_and_SubformSet_InstanceIndex()); } } void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, @@ -2538,11 +2518,10 @@ void CXFA_Node::Script_Subform_InstanceManager(CFXJSE_Value* pValue, } } if (pInstanceMgr) { - FXJSE_Value_Set( - pValue, + pValue->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pInstanceMgr)); } else { - FXJSE_Value_SetNull(pValue); + pValue->SetNull(); } } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); @@ -2553,15 +2532,15 @@ void CXFA_Node::Script_Subform_Locale(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { if (bSetting) { CFX_ByteString bsLocaleName; - FXJSE_Value_ToUTF8String(pValue, bsLocaleName); + pValue->ToString(bsLocaleName); SetCData(XFA_ATTRIBUTE_Locale, CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), true, TRUE); } else { CFX_WideString wsLocaleName; GetLocaleName(wsLocaleName); - FXJSE_Value_SetUTF8String( - pValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) - .AsStringC()); + pValue->SetString( + FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) + .AsStringC()); } } void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { @@ -2604,11 +2583,11 @@ void CXFA_Node::Script_Subform_ExecValidate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), - ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); + pArguments->GetReturnValue()->SetBoolean( + (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); @@ -2637,7 +2616,7 @@ int32_t CXFA_Node::Subform_and_SubformSet_InstanceIndex() { void CXFA_Node::Script_Template_FormNodes(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc == 1) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); + pArguments->GetReturnValue()->SetBoolean(TRUE); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"formNodes"); } @@ -2655,9 +2634,9 @@ void CXFA_Node::Script_Template_ExecInitialize(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); + pArguments->GetReturnValue()->SetBoolean(TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execInitialize"); @@ -2683,7 +2662,7 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { XFA_GetElementByName(strTagName.AsStringC()); CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); if (!pNewNode) { - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); } else { if (!strName.IsEmpty()) { if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, @@ -2692,16 +2671,14 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { pNewNode->CreateXMLMappingNode(); } - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); } else { ThrowException(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(), L"name"); } } else { - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); } } @@ -2711,7 +2688,7 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { } void CXFA_Node::Script_Template_Recalculate(CFXJSE_Arguments* pArguments) { if (pArguments->GetLength() == 1) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); + pArguments->GetReturnValue()->SetBoolean(TRUE); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"recalculate"); } @@ -2721,9 +2698,9 @@ void CXFA_Node::Script_Template_ExecCalculate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); + pArguments->GetReturnValue()->SetBoolean(TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execCalculate"); @@ -2734,9 +2711,9 @@ void CXFA_Node::Script_Template_ExecValidate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); + pArguments->GetReturnValue()->SetBoolean(TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); @@ -2747,9 +2724,9 @@ void CXFA_Node::Script_Manifest_Evaluate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_WidgetData* pWidgetData = GetWidgetData(); if (!pWidgetData) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), TRUE); + pArguments->GetReturnValue()->SetBoolean(TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"evaluate"); @@ -2763,7 +2740,7 @@ void CXFA_Node::Script_InstanceManager_Max(CFXJSE_Value* pValue, return; } CXFA_Occur nodeOccur(GetOccurNode()); - FXJSE_Value_SetInteger(pValue, nodeOccur.GetMax()); + pValue->SetInteger(nodeOccur.GetMax()); } void CXFA_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue, FX_BOOL bSetting, @@ -2773,7 +2750,7 @@ void CXFA_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue, return; } CXFA_Occur nodeOccur(GetOccurNode()); - FXJSE_Value_SetInteger(pValue, nodeOccur.GetMin()); + pValue->SetInteger(nodeOccur.GetMin()); } static int32_t XFA_ScriptInstanceManager_GetCount(CXFA_Node* pInstMgrNode) { ASSERT(pInstMgrNode); @@ -3052,17 +3029,17 @@ void CXFA_Node::Script_InstanceManager_Count(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (bSetting) { - int32_t iDesired = FXJSE_Value_ToInteger(pValue); + int32_t iDesired = pValue->ToInteger(); InstanceManager_SetInstances(iDesired); } else { - FXJSE_Value_SetInteger(pValue, XFA_ScriptInstanceManager_GetCount(this)); + pValue->SetInteger(XFA_ScriptInstanceManager_GetCount(this)); } } void CXFA_Node::Script_InstanceManager_MoveInstance( CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 2) { - FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetUndefined(); return; } int32_t iFrom = pArguments->GetInt32(0); @@ -3085,7 +3062,7 @@ void CXFA_Node::Script_InstanceManager_RemoveInstance( CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 1) { - FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetUndefined(); return; } int32_t iIndex = pArguments->GetInt32(0); @@ -3123,7 +3100,7 @@ void CXFA_Node::Script_InstanceManager_SetInstances( CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if (argc != 1) { - FXJSE_Value_SetUndefined(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetUndefined(); return; } int32_t iDesired = pArguments->GetInt32(0); @@ -3151,8 +3128,7 @@ void CXFA_Node::Script_InstanceManager_AddInstance( XFA_ScriptInstanceManager_CreateInstance(this, fFlags); XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iCount, iCount, FALSE); - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { @@ -3193,8 +3169,7 @@ void CXFA_Node::Script_InstanceManager_InsertInstance( XFA_ScriptInstanceManager_CreateInstance(this, bBind); XFA_ScriptInstanceManager_InsertItem(this, pNewInstance, iIndex, iCount, TRUE); - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewInstance)); CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { @@ -3296,10 +3271,10 @@ void CXFA_Node::Script_Occur_Max(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { CXFA_Occur occur(this); if (bSetting) { - int32_t iMax = FXJSE_Value_ToInteger(pValue); + int32_t iMax = pValue->ToInteger(); occur.SetMax(iMax); } else { - FXJSE_Value_SetInteger(pValue, occur.GetMax()); + pValue->SetInteger(occur.GetMax()); } } void CXFA_Node::Script_Occur_Min(CFXJSE_Value* pValue, @@ -3307,16 +3282,16 @@ void CXFA_Node::Script_Occur_Min(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { CXFA_Occur occur(this); if (bSetting) { - int32_t iMin = FXJSE_Value_ToInteger(pValue); + int32_t iMin = pValue->ToInteger(); occur.SetMin(iMin); } else { - FXJSE_Value_SetInteger(pValue, occur.GetMin()); + pValue->SetInteger(occur.GetMin()); } } void CXFA_Node::Script_Desc_Metadata(CFXJSE_Arguments* pArguments) { int32_t argc = pArguments->GetLength(); if ((argc == 0) || (argc == 1)) { - FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(), ""); + pArguments->GetReturnValue()->SetString(""); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"metadata"); } @@ -3329,9 +3304,8 @@ void CXFA_Node::Script_Form_FormNodes(CFXJSE_Arguments* pArguments) { CXFA_NodeArray formItems; CXFA_ArrayNodeList* pFormNodes = new CXFA_ArrayNodeList(m_pDocument); pFormNodes->SetArrayNodeList(formItems); - FXJSE_Value_SetObject( - pArguments->GetReturnValue(), (CXFA_Object*)pFormNodes, - m_pDocument->GetScriptContext()->GetJseNormalClass()); + pArguments->GetReturnValue()->SetObject( + pFormNodes, m_pDocument->GetScriptContext()->GetJseNormalClass()); } else { ThrowException(XFA_IDS_ARGUMENT_MISMATCH); } @@ -3400,11 +3374,11 @@ void CXFA_Node::Script_Form_ExecValidate(CFXJSE_Arguments* pArguments) { if (argc == 0) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), FALSE); + pArguments->GetReturnValue()->SetBoolean(FALSE); } else { int32_t iRet = pNotify->ExecEventByDeepFirst(this, XFA_EVENT_Validate); - FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), - ((iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE)); + pArguments->GetReturnValue()->SetBoolean( + (iRet == XFA_EVENTERROR_Error) ? FALSE : TRUE); } } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execValidate"); @@ -3415,14 +3389,13 @@ void CXFA_Node::Script_Form_Checksum(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { if (bSetting) { CFX_ByteString bsChecksum; - FXJSE_Value_ToUTF8String(pValue, bsChecksum); + pValue->ToString(bsChecksum); SetAttribute(XFA_ATTRIBUTE_Checksum, CFX_WideString::FromUTF8(bsChecksum.AsStringC()).AsStringC()); } else { CFX_WideString wsChecksum; GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(wsChecksum.c_str(), wsChecksum.GetLength()).AsStringC()); } } @@ -3437,8 +3410,7 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str(), wsAttributeValue); } - FXJSE_Value_SetUTF8String( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->SetString( FX_UTF8Encode(wsAttributeValue.c_str(), wsAttributeValue.GetLength()) .AsStringC()); } else { @@ -3456,7 +3428,7 @@ void CXFA_Node::Script_Packet_SetAttribute(CFXJSE_Arguments* pArguments) { ->SetString(CFX_WideString::FromUTF8(bsName.AsStringC()), CFX_WideString::FromUTF8(bsValue.AsStringC())); } - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setAttribute"); } @@ -3473,7 +3445,7 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { pXMLElement->RemoveAttribute(wsName.c_str()); } } - FXJSE_Value_SetNull(pArguments->GetReturnValue()); + pArguments->GetReturnValue()->SetNull(); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"removeAttribute"); } @@ -3483,7 +3455,7 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, XFA_ATTRIBUTE eAttribute) { if (bSetting) { CFX_ByteString bsNewContent; - FXJSE_Value_ToUTF8String(pValue, bsNewContent); + pValue->ToString(bsNewContent); CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); @@ -3497,8 +3469,7 @@ void CXFA_Node::Script_Packet_Content(CFXJSE_Value* pValue, CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); pXMLElement->GetTextData(wsTextData); } - FXJSE_Value_SetUTF8String( - pValue, + pValue->SetString( FX_UTF8Encode(wsTextData.c_str(), wsTextData.GetLength()).AsStringC()); } } @@ -3630,8 +3601,7 @@ void CXFA_Node::Script_Xfa_This(CFXJSE_Value* pValue, if (!bSetting) { CXFA_Object* pThis = m_pDocument->GetScriptContext()->GetThisObject(); ASSERT(pThis); - FXJSE_Value_Set(pValue, - m_pDocument->GetScriptContext()->GetJSValueFromMap(pThis)); + pValue->Assign(m_pDocument->GetScriptContext()->GetJSValueFromMap(pThis)); } } void CXFA_Node::Script_Handler_Version(CFXJSE_Value* pValue, @@ -3650,7 +3620,7 @@ void CXFA_Node::Script_Script_Stateless(CFXJSE_Value* pValue, ThrowException(XFA_IDS_INVAlID_PROP_SET); return; } - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(FX_WSTRC(L"0")).AsStringC()); + pValue->SetString(FX_UTF8Encode(FX_WSTRC(L"0")).AsStringC()); } void CXFA_Node::Script_Encrypt_Format(CFXJSE_Value* pValue, FX_BOOL bSetting, @@ -5205,8 +5175,7 @@ void CXFA_NodeList::Script_ListClass_Item(CFXJSE_Arguments* pArguments) { if (argc == 1) { int32_t iIndex = pArguments->GetInt32(0); if ((iIndex >= 0) && (iIndex + 1 <= GetLength())) { - FXJSE_Value_Set( - pArguments->GetReturnValue(), + pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(Item(iIndex))); } else { ThrowException(XFA_IDS_INDEX_OUT_OF_BOUNDS); @@ -5225,8 +5194,8 @@ void CXFA_NodeList::Script_TreelistClass_NamedItem( if (!pNode) { return; } - FXJSE_Value_Set(pArguments->GetReturnValue(), - m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); + pArguments->GetReturnValue()->Assign( + m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); } else { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"namedItem"); } @@ -5235,7 +5204,7 @@ void CXFA_NodeList::Script_ListClass_Length(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (!bSetting) { - FXJSE_Value_SetInteger(pValue, GetLength()); + pValue->SetInteger(GetLength()); } else { ThrowException(XFA_IDS_INVAlID_PROP_SET); } diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp index c7f1318cda..b494a91478 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp @@ -29,28 +29,28 @@ void Script_EventPseudoModel_StringProperty(CFXJSE_Value* pValue, FX_BOOL bSetting) { if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); } else { - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } } void Script_EventPseudoModel_InterProperty(CFXJSE_Value* pValue, int32_t& iValue, FX_BOOL bSetting) { if (bSetting) { - iValue = FXJSE_Value_ToInteger(pValue); + iValue = pValue->ToInteger(); } else { - FXJSE_Value_SetInteger(pValue, iValue); + pValue->SetInteger(iValue); } } void Script_EventPseudoModel_BooleanProperty(CFXJSE_Value* pValue, FX_BOOL& bValue, FX_BOOL bSetting) { if (bSetting) - bValue = FXJSE_Value_ToBoolean(pValue); + bValue = pValue->ToBoolean(); else - FXJSE_Value_SetBoolean(pValue, bValue); + pValue->SetBoolean(bValue); } void CScript_EventPseudoModel::Script_EventPseudoModel_Property( diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index 3adabe6a6e..990a86517f 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -38,7 +38,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( uint32_t dwFlag) { CFX_WideString wsValue; pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsValue).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( CFXJSE_Value* pValue, @@ -54,7 +54,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( } CFX_WideString wsAppType; pNotify->GetAppProvider()->GetAppType(wsAppType); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAppType).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( CFXJSE_Value* pValue, @@ -70,7 +70,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( } CFX_WideString wsAppType; pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAppType).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( CFXJSE_Value* pValue, @@ -82,12 +82,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetCalculationsEnabled( - hDoc, FXJSE_Value_ToBoolean(pValue)); + pNotify->GetDocProvider()->SetCalculationsEnabled(hDoc, + pValue->ToBoolean()); return; } - FX_BOOL bEnabled = pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc); - FXJSE_Value_SetBoolean(pValue, bEnabled); + pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc)); } void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( CFXJSE_Value* pValue, @@ -99,12 +98,10 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetCurrentPage(hDoc, - FXJSE_Value_ToInteger(pValue)); + pNotify->GetDocProvider()->SetCurrentPage(hDoc, pValue->ToInteger()); return; } - int32_t iCurrentPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); - FXJSE_Value_SetInteger(pValue, iCurrentPage); + pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc)); } void CScript_HostPseudoModel::Script_HostPseudoModel_Language( CFXJSE_Value* pValue, @@ -120,7 +117,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Language( } CFX_WideString wsLanguage; pNotify->GetAppProvider()->GetLanguage(wsLanguage); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsLanguage).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( CFXJSE_Value* pValue, @@ -135,8 +132,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( ThrowException(XFA_IDS_UNABLE_SET_NUMPAGES); return; } - int32_t iNumPages = pNotify->GetDocProvider()->CountPages(hDoc); - FXJSE_Value_SetInteger(pValue, iNumPages); + pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc)); } void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( CFXJSE_Value* pValue, @@ -152,7 +148,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( } CFX_WideString wsPlatform; pNotify->GetAppProvider()->GetPlatform(wsPlatform); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsPlatform).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_Title( CFXJSE_Value* pValue, @@ -168,14 +164,14 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { CFX_ByteString bsValue; - FXJSE_Value_ToUTF8String(pValue, bsValue); + pValue->ToString(bsValue); pNotify->GetDocProvider()->SetTitle( hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC())); return; } CFX_WideString wsTitle; pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsTitle).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( CFXJSE_Value* pValue, @@ -187,12 +183,11 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); if (bSetting) { - pNotify->GetDocProvider()->SetValidationsEnabled( - hDoc, FXJSE_Value_ToBoolean(pValue)); + pNotify->GetDocProvider()->SetValidationsEnabled(hDoc, pValue->ToBoolean()); return; } FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); - FXJSE_Value_SetBoolean(pValue, bEnabled); + pValue->SetBoolean(bEnabled); } void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( CFXJSE_Value* pValue, @@ -211,7 +206,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( } CFX_WideString wsVariation; pNotify->GetAppProvider()->GetVariation(wsVariation); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsVariation).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_Version( CFXJSE_Value* pValue, @@ -227,7 +222,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Version( } CFX_WideString wsVersion; pNotify->GetAppProvider()->GetVersion(wsVersion); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsVersion).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( CFXJSE_Value* pValue, @@ -243,7 +238,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( } CFX_WideString wsVersion; pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsVersion).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_Name( CFXJSE_Value* pValue, @@ -259,7 +254,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Name( } CFX_WideString wsAppName; pNotify->GetAppProvider()->GetAppName(wsAppName); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAppName).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( CFXJSE_Value* pValue, @@ -275,7 +270,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( } CFX_WideString wsFoxitAppName; pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsFoxitAppName).AsStringC()); + pValue->SetString(FX_UTF8Encode(wsFoxitAppName).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( CFXJSE_Arguments* pArguments) { @@ -320,7 +315,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( pNode = ToNode(pValue.get(), nullptr); } else if (FXJSE_Value_IsUTF8String(pValue.get())) { CFX_ByteString bsString; - FXJSE_Value_ToUTF8String(pValue.get(), bsString); + pValue->ToString(bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString.AsStringC()); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); @@ -387,9 +382,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( CFX_WideString wsAnswer = pNotify->GetAppProvider()->Response( wsQuestion, wsTitle, wsDefaultAnswer, bMark); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsAnswer).AsStringC()); - } + if (pValue) + pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( CFXJSE_Arguments* pArguments) { @@ -399,9 +393,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( } int32_t iCur = pNotify->GetAppProvider()->GetCurDocumentInBatch(); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iCur); - } + if (pValue) + pValue->SetInteger(iCur); } static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, int32_t nStart, @@ -517,7 +510,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( pNode = ToNode(pValue.get(), nullptr); } else if (FXJSE_Value_IsUTF8String(pValue.get())) { CFX_ByteString bsString; - FXJSE_Value_ToUTF8String(pValue.get(), bsString); + pValue->ToString(bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString.AsStringC()); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); @@ -551,8 +544,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( if (!pNode) { return; } - FXJSE_Value_Set(pArguments->GetReturnValue(), - m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); + pArguments->GetReturnValue()->Assign( + m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); } void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( CFXJSE_Arguments* pArguments) { @@ -597,9 +590,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( int32_t iValue = pNotify->GetAppProvider()->MsgBox( wsMessage, bsTitle, dwMessageType, dwButtonType); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iValue); - } + if (pValue) + pValue->SetInteger(iValue); } FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( CFXJSE_Arguments* pArguments, @@ -622,7 +614,7 @@ FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( wsValue = FX_WSTRC(L""); } else { CFX_ByteString byMessage; - FXJSE_Value_ToUTF8String(pValueArg.get(), byMessage); + pValueArg->ToString(byMessage); wsValue = CFX_WideString::FromUTF8(byMessage.AsStringC()); } return TRUE; @@ -635,9 +627,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( } int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iValue); - } + if (pValue) + pValue->SetInteger(iValue); } void CScript_HostPseudoModel::Script_HostPseudoModel_Print( CFXJSE_Arguments* pArguments) { @@ -793,7 +784,6 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( } CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetUTF8String(pValue, FX_UTF8Encode(wsDataTime).AsStringC()); - } + if (pValue) + pValue->SetString(FX_UTF8Encode(wsDataTime).AsStringC()); } diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index c124ac36a1..e682c9ad85 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -137,7 +137,7 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, int32_t iFlags = CXFA_FM2JSContext::Translate(wsScript, wsJavaScript, wsErrorInfo); if (iFlags) { - FXJSE_Value_SetUndefined(hRetValue); + hRetValue->SetUndefined(); return FALSE; } btScript = @@ -175,7 +175,7 @@ void CXFA_ScriptContext::GlobalPropertySetter(CFXJSE_Value* pObject, } if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { if (FXJSE_Value_IsUndefined(pValue)) { - FXJSE_Value_SetObjectOwnProp(pObject, szPropName, pValue); + pObject->SetObjectOwnProperty(szPropName, pValue); return; } } @@ -197,7 +197,7 @@ FX_BOOL CXFA_ScriptContext::QueryNodeByFlag(CXFA_Node* refNode, if (ResolveObjects(refNode, propname, resolveRs, dwFlag) <= 0) return false; if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { - FXJSE_Value_Set(pValue, GetJSValueFromMap(resolveRs.nodes[0])); + pValue->Assign(GetJSValueFromMap(resolveRs.nodes[0])); return true; } if (resolveRs.dwFlags == XFA_RESOVENODE_RSTYPE_Attribute) { @@ -228,7 +228,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject, CXFA_Object* pObj = lpScriptContext->GetDocument()->GetXFAObject(uHashCode); if (pObj) { - FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObj)); + pValue->Assign(lpScriptContext->GetJSValueFromMap(pObj)); return; } } @@ -267,7 +267,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, CFXJSE_Value* pReturnValue) { CXFA_Object* pOriginalObject = ToObject(pOriginalValue, nullptr); if (!pOriginalObject) { - FXJSE_Value_SetUndefined(pReturnValue); + pReturnValue->SetUndefined(); return; } CFX_WideString wsPropName = CFX_WideString::FromUTF8(szPropName); @@ -277,7 +277,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, if (wsPropName == FX_WSTRC(L"xfa")) { CFXJSE_Value* pValue = lpScriptContext->GetJSValueFromMap( lpScriptContext->GetDocument()->GetRoot()); - FXJSE_Value_Set(pReturnValue, pValue); + pReturnValue->Assign(pValue); return; } uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | @@ -304,7 +304,7 @@ void CXFA_ScriptContext::NormalPropertyGetter(CFXJSE_Value* pOriginalValue, szPropName, pReturnValue, TRUE); } if (!bRet) { - FXJSE_Value_SetUndefined(pReturnValue); + pReturnValue->SetUndefined(); } } void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue, @@ -508,16 +508,16 @@ FX_BOOL CXFA_ScriptContext::QueryVariableValue( FXJSE_Context_GetGlobalObject(pVariableContext)); std::unique_ptr<CFXJSE_Value> hVariableValue(new CFXJSE_Value(m_pIsolate)); if (!bGetter) { - FXJSE_Value_SetObjectOwnProp(pObject.get(), szPropName, pValue); + pObject->SetObjectOwnProperty(szPropName, pValue); bRes = TRUE; - } else if (FXJSE_Value_ObjectHasOwnProp(pObject.get(), szPropName, FALSE)) { - FXJSE_Value_GetObjectProp(pObject.get(), szPropName, hVariableValue.get()); + } else if (pObject->HasObjectOwnProperty(szPropName, FALSE)) { + pObject->GetObjectProperty(szPropName, hVariableValue.get()); if (FXJSE_Value_IsFunction(hVariableValue.get())) - FXJSE_Value_SetFunctionBind(pValue, hVariableValue.get(), pObject.get()); + pValue->SetFunctionBind(hVariableValue.get(), pObject.get()); else if (bGetter) - FXJSE_Value_Set(pValue, hVariableValue.get()); + pValue->Assign(hVariableValue.get()); else - FXJSE_Value_Set(hVariableValue.get(), pValue); + hVariableValue.get()->Assign(pValue); bRes = TRUE; } return bRes; @@ -547,8 +547,8 @@ void CXFA_ScriptContext::RemoveBuiltInObjs(CFXJSE_Context* pContext) const { FXJSE_Context_GetGlobalObject(pContext)); std::unique_ptr<CFXJSE_Value> hProp(new CFXJSE_Value(m_pIsolate)); for (int i = 0; i < 2; ++i) { - if (FXJSE_Value_GetObjectProp(pObject.get(), OBJ_NAME[i], hProp.get())) - FXJSE_Value_DeleteObjectProp(pObject.get(), OBJ_NAME[i]); + if (pObject->GetObjectProperty(OBJ_NAME[i], hProp.get())) + pObject.get()->DeleteObjectProperty(OBJ_NAME[i]); } } CFXJSE_Class* CXFA_ScriptContext::GetJseNormalClass() { @@ -725,7 +725,7 @@ CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { void* pValue = m_mapXFAToValue.GetValueAt(pObject); if (!pValue) { CFXJSE_Value* jsValue = new CFXJSE_Value(m_pIsolate); - FXJSE_Value_SetObject(jsValue, pObject, m_pJsClass); + jsValue->SetObject(pObject, m_pJsClass); m_mapXFAToValue.SetAt(pObject, jsValue); pValue = jsValue; } diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index 0610da2f5f..4ec6c14dfd 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -41,7 +41,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( return; } int32_t iStatus = pNotify->GetLayoutStatus(); - FXJSE_Value_SetBoolean(pValue, iStatus >= 2); + pValue->SetBoolean(iStatus >= 2); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( CFXJSE_Arguments* pArguments, @@ -100,7 +100,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( } CFXJSE_Value* pValue = pArguments->GetReturnValue(); if (!pLayoutItem) { - FXJSE_Value_SetFloat(pValue, 0); + pValue->SetFloat(0); return; } pLayoutItem->GetRect(rtRect, TRUE); @@ -121,9 +121,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); FX_FLOAT fValue = measure.ToUnit(unit); fValue = FXSYS_round(fValue * 1000) / 1000.0f; - if (pValue) { - FXJSE_Value_SetFloat(pValue, fValue); - } + if (pValue) + pValue->SetFloat(fValue); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( CFXJSE_Arguments* pArguments) { @@ -165,9 +164,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( iPageCount = iPageNum; } CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iPageCount); - } + if (pValue) + pValue->SetInteger(iPageCount); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageCount( CFXJSE_Arguments* pArguments) { @@ -194,15 +192,14 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( CFXJSE_Value* pValue = pArguments->GetReturnValue(); CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) { - FXJSE_Value_SetInteger(pValue, -1); + pValue->SetInteger(-1); return; } int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); int32_t iPageSpan = iLast - iFirst + 1; - if (pValue) { - FXJSE_Value_SetInteger(pValue, iPageSpan); - } + if (pValue) + pValue->SetInteger(iPageSpan); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( CFXJSE_Arguments* pArguments) { @@ -378,9 +375,9 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent( retArray); CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); pArrayNodeList->SetArrayNodeList(retArray); - FXJSE_Value_SetObject(pArguments->GetReturnValue(), - (CXFA_Object*)pArrayNodeList, - m_pDocument->GetScriptContext()->GetJseNormalClass()); + pArguments->GetReturnValue()->SetObject( + (CXFA_Object*)pArrayNodeList, + m_pDocument->GetScriptContext()->GetJseNormalClass()); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( CFXJSE_Arguments* pArguments) { @@ -395,9 +392,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iPageCount); - } + if (pValue) + pValue->SetInteger(iPageCount); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( CFXJSE_Arguments* pArguments) { @@ -408,9 +404,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iPageCount); - } + if (pValue) + pValue->SetInteger(iPageCount); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( CFXJSE_Arguments* pArguments) { @@ -458,9 +453,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iPageCount); - } + if (pValue) + pValue->SetInteger(iPageCount); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( CFXJSE_Arguments* pArguments) { @@ -492,9 +486,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, iPageCount); - } + if (pValue) + pValue->SetInteger(iPageCount); } void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Sheet( CFXJSE_Arguments* pArguments) { @@ -530,20 +523,19 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp( } int32_t iPage = 0; CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (!pNode && pValue) { - FXJSE_Value_SetInteger(pValue, iPage); - } + if (!pNode && pValue) + pValue->SetInteger(iPage); + CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) { - FXJSE_Value_SetInteger(pValue, -1); + pValue->SetInteger(-1); return; } iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, bAbsPage ? iPage : iPage + 1); - } + if (pValue) + pValue->SetInteger(bAbsPage ? iPage : iPage + 1); } diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 6be5bd03e6..c2101f7719 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -712,7 +712,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( new CFXJSE_Value(rnd.m_pSC->GetRuntime())); bRet = pContext->RunScript(eLangType, wsExpression.AsStringC(), pRetValue.get(), node); - if (!bRet || !FXJSE_Value_ToBoolean(pRetValue.get())) + if (!bRet || !pRetValue->ToBoolean()) findNodes.RemoveAt(i); } } diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 6273dc0b45..d8e35bfbb4 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -42,9 +42,8 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( } int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetInteger(pValue, bVerify); - } + if (pValue) + pValue->SetInteger(bVerify); } void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( CFXJSE_Arguments* pArguments) { @@ -75,9 +74,8 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( FX_BOOL bSign = pNotify->GetDocProvider()->Sign( hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC()); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetBoolean(pValue, bSign); - } + if (pValue) + pValue->SetBoolean(bSign); } void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( CFXJSE_Arguments* pArguments) { @@ -94,8 +92,8 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); if (!pList) return; - FXJSE_Value_Set(pArguments->GetReturnValue(), - m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); + pArguments->GetReturnValue()->Assign( + m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); } void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( CFXJSE_Arguments* pArguments) { @@ -119,7 +117,6 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( } FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) { - FXJSE_Value_SetBoolean(pValue, bFlag); - } + if (pValue) + pValue->SetBoolean(bFlag); } diff --git a/xfa/fxjse/include/fxjse.h b/xfa/fxjse/include/fxjse.h index cf6fbf9560..835d5de9ba 100644 --- a/xfa/fxjse/include/fxjse.h +++ b/xfa/fxjse/include/fxjse.h @@ -87,51 +87,6 @@ FX_BOOL FXJSE_Value_IsObject(CFXJSE_Value* pValue); FX_BOOL FXJSE_Value_IsArray(CFXJSE_Value* pValue); FX_BOOL FXJSE_Value_IsFunction(CFXJSE_Value* pValue); -FX_BOOL FXJSE_Value_ToBoolean(CFXJSE_Value* pValue); -FX_FLOAT FXJSE_Value_ToFloat(CFXJSE_Value* pValue); -double FXJSE_Value_ToDouble(CFXJSE_Value* pValue); -int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue); -void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue, - CFX_ByteString& szStrOutput); - -void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue); -void FXJSE_Value_SetNull(CFXJSE_Value* pValue); -void FXJSE_Value_SetBoolean(CFXJSE_Value* pValue, FX_BOOL bBoolean); -void FXJSE_Value_SetUTF8String(CFXJSE_Value* pValue, - const CFX_ByteStringC& szString); -void FXJSE_Value_SetInteger(CFXJSE_Value* pValue, int32_t nInteger); -void FXJSE_Value_SetFloat(CFXJSE_Value* pValue, FX_FLOAT fFloat); -void FXJSE_Value_SetDouble(CFXJSE_Value* pValue, double dDouble); -void FXJSE_Value_SetObject(CFXJSE_Value* pValue, - CFXJSE_HostObject* lpObject, - CFXJSE_Class* pClass); -void FXJSE_Value_SetArray(CFXJSE_Value* pValue, - uint32_t uValueCount, - CFXJSE_Value** rgValues); -void FXJSE_Value_Set(CFXJSE_Value* pValue, CFXJSE_Value* pOriginalValue); - -FX_BOOL FXJSE_Value_GetObjectProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pPropValue); -FX_BOOL FXJSE_Value_SetObjectProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pPropValue); -FX_BOOL FXJSE_Value_GetObjectPropByIdx(CFXJSE_Value* pValue, - uint32_t uPropIdx, - CFXJSE_Value* pPropValue); -FX_BOOL FXJSE_Value_DeleteObjectProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName); -FX_BOOL FXJSE_Value_ObjectHasOwnProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - FX_BOOL bUseTypeGetter); -FX_BOOL FXJSE_Value_SetObjectOwnProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pPropValue); - -FX_BOOL FXJSE_Value_SetFunctionBind(CFXJSE_Value* pValue, - CFXJSE_Value* pOldFunction, - CFXJSE_Value* pNewThis); - FX_BOOL FXJSE_ExecuteScript(CFXJSE_Context* pContext, const FX_CHAR* szScript, CFXJSE_Value* pRetValue, diff --git a/xfa/fxjse/value.cpp b/xfa/fxjse/value.cpp index 60fa09c8c3..64a10f348e 100644 --- a/xfa/fxjse/value.cpp +++ b/xfa/fxjse/value.cpp @@ -43,124 +43,6 @@ FX_BOOL FXJSE_Value_IsFunction(CFXJSE_Value* pValue) { return pValue && pValue->IsFunction(); } -FX_BOOL FXJSE_Value_ToBoolean(CFXJSE_Value* pValue) { - return pValue->ToBoolean(); -} - -FX_FLOAT FXJSE_Value_ToFloat(CFXJSE_Value* pValue) { - return pValue->ToFloat(); -} - -double FXJSE_Value_ToDouble(CFXJSE_Value* pValue) { - return pValue->ToDouble(); -} - -void FXJSE_Value_ToUTF8String(CFXJSE_Value* pValue, - CFX_ByteString& szStrOutput) { - pValue->ToString(szStrOutput); -} - -int32_t FXJSE_Value_ToInteger(CFXJSE_Value* pValue) { - return pValue->ToInteger(); -} - -void FXJSE_Value_SetUndefined(CFXJSE_Value* pValue) { - pValue->SetUndefined(); -} - -void FXJSE_Value_SetNull(CFXJSE_Value* pValue) { - pValue->SetNull(); -} - -void FXJSE_Value_SetBoolean(CFXJSE_Value* pValue, FX_BOOL bBoolean) { - pValue->SetBoolean(bBoolean); -} - -void FXJSE_Value_SetUTF8String(CFXJSE_Value* pValue, - const CFX_ByteStringC& szString) { - pValue->SetString(szString); -} - -void FXJSE_Value_SetInteger(CFXJSE_Value* pValue, int32_t nInteger) { - pValue->SetInteger(nInteger); -} - -void FXJSE_Value_SetFloat(CFXJSE_Value* pValue, FX_FLOAT fFloat) { - pValue->SetFloat(fFloat); -} - -void FXJSE_Value_SetDouble(CFXJSE_Value* pValue, double dDouble) { - pValue->SetDouble(dDouble); -} - -void FXJSE_Value_SetObject(CFXJSE_Value* pValue, - CFXJSE_HostObject* lpObject, - CFXJSE_Class* pClass) { - if (!pClass) { - ASSERT(!lpObject); - pValue->SetJSObject(); - return; - } - pValue->SetHostObject(lpObject, pClass); -} - -void FXJSE_Value_SetArray(CFXJSE_Value* pValue, - uint32_t uValueCount, - CFXJSE_Value** rgValues) { - pValue->SetArray(uValueCount, rgValues); -} - -void FXJSE_Value_Set(CFXJSE_Value* pValue, CFXJSE_Value* pOriginalValue) { - ASSERT(pOriginalValue); - pValue->Assign(pOriginalValue); -} - -FX_BOOL FXJSE_Value_GetObjectProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pPropValue) { - ASSERT(pPropValue); - return pValue->GetObjectProperty(szPropName, pPropValue); -} - -FX_BOOL FXJSE_Value_SetObjectProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pPropValue) { - ASSERT(pPropValue); - return pValue->SetObjectProperty(szPropName, pPropValue); -} - -FX_BOOL FXJSE_Value_GetObjectPropByIdx(CFXJSE_Value* pValue, - uint32_t uPropIdx, - CFXJSE_Value* pPropValue) { - ASSERT(pPropValue); - return pValue->GetObjectProperty(uPropIdx, pPropValue); -} - -FX_BOOL FXJSE_Value_DeleteObjectProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName) { - return pValue->DeleteObjectProperty(szPropName); -} - -FX_BOOL FXJSE_Value_ObjectHasOwnProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - FX_BOOL bUseTypeGetter) { - return pValue->HasObjectOwnProperty(szPropName, bUseTypeGetter); -} - -FX_BOOL FXJSE_Value_SetObjectOwnProp(CFXJSE_Value* pValue, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pPropValue) { - ASSERT(pPropValue); - return pValue->SetObjectOwnProperty(szPropName, pPropValue); -} - -FX_BOOL FXJSE_Value_SetFunctionBind(CFXJSE_Value* pValue, - CFXJSE_Value* pOldFunction, - CFXJSE_Value* pNewThis) { - ASSERT(pOldFunction && pNewThis); - return pValue->SetFunctionBind(pOldFunction, pNewThis); -} - void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, const CFX_ByteStringC& utf8Message) { v8::Isolate* pIsolate = v8::Isolate::GetCurrent(); @@ -206,50 +88,14 @@ CFXJSE_HostObject* CFXJSE_Value::ToHostObject(CFXJSE_Class* lpClass) const { return FXJSE_RetrieveObjectBinding(pValue.As<v8::Object>(), lpClass); } -V8_INLINE static double FXJSE_ftod(FX_FLOAT fNumber) { - if (sizeof(FX_FLOAT) != 4) { - ASSERT(FALSE); - return fNumber; - } - - uint32_t nFloatBits = (uint32_t&)fNumber; - uint8_t nExponent = (uint8_t)(nFloatBits >> 16 >> 7); - if (nExponent == 0 || nExponent == 255) - return fNumber; - - int8_t nErrExp = nExponent - 127 - 23; - if (nErrExp >= 0) - return fNumber; - - double dwError = pow(2.0, nErrExp), dwErrorHalf = dwError / 2; - double dNumber = fNumber, dNumberAbs = fabs(fNumber); - double dNumberAbsMin = dNumberAbs - dwErrorHalf, - dNumberAbsMax = dNumberAbs + dwErrorHalf; - int32_t iErrPos = 0; - if (floor(dNumberAbsMin) == floor(dNumberAbsMax)) { - dNumberAbsMin = fmod(dNumberAbsMin, 1.0); - dNumberAbsMax = fmod(dNumberAbsMax, 1.0); - int32_t iErrPosMin = 1, iErrPosMax = 38; - do { - int32_t iMid = (iErrPosMin + iErrPosMax) / 2; - double dPow = pow(10.0, iMid); - if (floor(dNumberAbsMin * dPow) == floor(dNumberAbsMax * dPow)) { - iErrPosMin = iMid + 1; - } else { - iErrPosMax = iMid; - } - } while (iErrPosMin < iErrPosMax); - iErrPos = iErrPosMax; +void CFXJSE_Value::SetObject(CFXJSE_HostObject* lpObject, + CFXJSE_Class* pClass) { + if (!pClass) { + ASSERT(!lpObject); + SetJSObject(); + return; } - double dPow = pow(10.0, iErrPos); - return fNumber < 0 ? ceil(dNumber * dPow - 0.5) / dPow - : floor(dNumber * dPow + 0.5) / dPow; -} - -void CFXJSE_Value::SetFloat(FX_FLOAT fFloat) { - CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); - v8::Local<v8::Value> pValue = v8::Number::New(m_pIsolate, FXJSE_ftod(fFloat)); - m_hValue.Reset(m_pIsolate, pValue); + SetHostObject(lpObject, pClass); } void CFXJSE_Value::SetHostObject(CFXJSE_HostObject* lpObject, @@ -285,6 +131,7 @@ void CFXJSE_Value::SetDate(double dDouble) { FX_BOOL CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName, CFXJSE_Value* lpPropValue) { + ASSERT(lpPropValue); CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); @@ -302,6 +149,7 @@ FX_BOOL CFXJSE_Value::SetObjectProperty(const CFX_ByteStringC& szPropName, FX_BOOL CFXJSE_Value::GetObjectProperty(const CFX_ByteStringC& szPropName, CFXJSE_Value* lpPropValue) { + ASSERT(lpPropValue); CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); @@ -329,8 +177,8 @@ FX_BOOL CFXJSE_Value::SetObjectProperty(uint32_t uPropIdx, return (FX_BOOL)hObject.As<v8::Object>()->Set(uPropIdx, hPropValue); } -FX_BOOL CFXJSE_Value::GetObjectProperty(uint32_t uPropIdx, - CFXJSE_Value* lpPropValue) { +FX_BOOL CFXJSE_Value::GetObjectPropertyByIdx(uint32_t uPropIdx, + CFXJSE_Value* lpPropValue) { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); @@ -375,6 +223,7 @@ FX_BOOL CFXJSE_Value::HasObjectOwnProperty(const CFX_ByteStringC& szPropName, FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName, CFXJSE_Value* lpPropValue) { + ASSERT(lpPropValue); CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> hObject = v8::Local<v8::Value>::New(m_pIsolate, m_hValue); @@ -395,6 +244,8 @@ FX_BOOL CFXJSE_Value::SetObjectOwnProperty(const CFX_ByteStringC& szPropName, FX_BOOL CFXJSE_Value::SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis) { + ASSERT(lpOldFunction && lpNewThis); + CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> rgArgs[2]; v8::Local<v8::Value> hOldFunction = diff --git a/xfa/fxjse/value.h b/xfa/fxjse/value.h index 84045d6d81..da4976b53c 100644 --- a/xfa/fxjse/value.h +++ b/xfa/fxjse/value.h @@ -9,6 +9,46 @@ #include "xfa/fxjse/scope_inline.h" +V8_INLINE static double FXJSE_ftod(FX_FLOAT fNumber) { + if (sizeof(FX_FLOAT) != 4) { + ASSERT(FALSE); + return fNumber; + } + + uint32_t nFloatBits = (uint32_t&)fNumber; + uint8_t nExponent = (uint8_t)(nFloatBits >> 16 >> 7); + if (nExponent == 0 || nExponent == 255) + return fNumber; + + int8_t nErrExp = nExponent - 127 - 23; + if (nErrExp >= 0) + return fNumber; + + double dwError = pow(2.0, nErrExp), dwErrorHalf = dwError / 2; + double dNumber = fNumber, dNumberAbs = fabs(fNumber); + double dNumberAbsMin = dNumberAbs - dwErrorHalf, + dNumberAbsMax = dNumberAbs + dwErrorHalf; + int32_t iErrPos = 0; + if (floor(dNumberAbsMin) == floor(dNumberAbsMax)) { + dNumberAbsMin = fmod(dNumberAbsMin, 1.0); + dNumberAbsMax = fmod(dNumberAbsMax, 1.0); + int32_t iErrPosMin = 1, iErrPosMax = 38; + do { + int32_t iMid = (iErrPosMin + iErrPosMax) / 2; + double dPow = pow(10.0, iMid); + if (floor(dNumberAbsMin * dPow) == floor(dNumberAbsMax * dPow)) { + iErrPosMin = iMid + 1; + } else { + iErrPosMax = iMid; + } + } while (iErrPosMin < iErrPosMax); + iErrPos = iErrPosMax; + } + double dPow = pow(10.0, iErrPos); + return fNumber < 0 ? ceil(dNumber * dPow - 0.5) / dPow + : floor(dNumber * dPow + 0.5) / dPow; +} + class CFXJSE_Value { public: CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} @@ -176,12 +216,19 @@ class CFXJSE_Value { v8::String::kNormalString, szString.GetLength()); m_hValue.Reset(m_pIsolate, hValue); } - V8_INLINE void SetFloat(FX_FLOAT fFloat); + V8_INLINE void SetFloat(FX_FLOAT fFloat) { + CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); + v8::Local<v8::Value> pValue = + v8::Number::New(m_pIsolate, FXJSE_ftod(fFloat)); + m_hValue.Reset(m_pIsolate, pValue); + } V8_INLINE void SetJSObject() { CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); v8::Local<v8::Value> hValue = v8::Object::New(m_pIsolate); m_hValue.Reset(m_pIsolate, hValue); } + + void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass); void SetHostObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* lpClass); void SetArray(uint32_t uValueCount, CFXJSE_Value** rgValues); void SetDate(double dDouble); @@ -190,7 +237,7 @@ class CFXJSE_Value { CFXJSE_Value* lpPropValue); FX_BOOL SetObjectProperty(const CFX_ByteStringC& szPropName, CFXJSE_Value* lpPropValue); - FX_BOOL GetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); + FX_BOOL GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); FX_BOOL SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue); FX_BOOL DeleteObjectProperty(const CFX_ByteStringC& szPropName); FX_BOOL HasObjectOwnProperty(const CFX_ByteStringC& szPropName, @@ -211,6 +258,7 @@ class CFXJSE_Value { m_hValue.Reset(m_pIsolate, hValue); } V8_INLINE void Assign(const CFXJSE_Value* lpValue) { + ASSERT(lpValue); if (lpValue) { m_hValue.Reset(m_pIsolate, lpValue->m_hValue); } else { |