7#ifndef FXJS_XFA_CFXJSE_VALUE_H_
8#define FXJS_XFA_CFXJSE_VALUE_H_
15#include "core/fxcrt/fx_string.h"
16#include "core/fxcrt/unowned_ptr.h"
17#include "third_party/base/check.h"
18#include "v8/include/v8-forward.h"
19#include "v8/include/v8-persistent-handle.h"
27 CFXJSE_Value(v8::Isolate* pIsolate, v8::Local<v8::Value> value);
32 bool IsNull(v8::Isolate* pIsolate)
const;
33 bool IsBoolean(v8::Isolate* pIsolate)
const;
34 bool IsString(v8::Isolate* pIsolate)
const;
35 bool IsNumber(v8::Isolate* pIsolate)
const;
36 bool IsInteger(v8::Isolate* pIsolate)
const;
37 bool IsObject(v8::Isolate* pIsolate)
const;
38 bool IsArray(v8::Isolate* pIsolate)
const;
40 bool ToBoolean(v8::Isolate* pIsolate)
const;
41 float ToFloat(v8::Isolate* pIsolate)
const;
42 double ToDouble(v8::Isolate* pIsolate)
const;
43 int32_t
ToInteger(v8::Isolate* pIsolate)
const;
44 ByteString
ToString(v8::Isolate* pIsolate)
const;
46 return WideString::FromUTF8(ToString(pIsolate).AsStringView());
51 void SetNull(v8::Isolate* pIsolate);
52 void SetBoolean(v8::Isolate* pIsolate,
bool bBoolean);
53 void SetInteger(v8::Isolate* pIsolate, int32_t nInteger);
54 void SetDouble(v8::Isolate* pIsolate,
double dDouble);
55 void SetString(v8::Isolate* pIsolate, ByteStringView szString);
56 void SetFloat(v8::Isolate* pIsolate,
float fFloat);
63 const std::vector<std::unique_ptr<CFXJSE_Value>>& values);
66 ByteStringView szPropName,
69 ByteStringView szPropName,
76 ByteStringView szPropName,
81 v8::Isolate* pIsolate,
82 v8::Local<v8::Function> hOldFunction,
83 v8::Local<v8::Object> lpNewThis);
87 void ForceSetValue(v8::Isolate* pIsolate, v8::Local<v8::Value> hValue) {
88 m_hValue.Reset(pIsolate, hValue);
95 v8::Global<v8::Value> m_hValue;
void FXJSE_ClearObjectBinding(v8::Local< v8::Object > hJSObject)
CFXJSE_HostObject * FXJSE_RetrieveObjectBinding(v8::Local< v8::Value > hValue)
void FXJSE_UpdateObjectBinding(v8::Local< v8::Object > hObject, CFXJSE_HostObject *pNewBinding)
const FXJSE_CLASS_DESCRIPTOR kNormalClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kGlobalClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kVariablesClassDescriptor
const FXJSE_CLASS_DESCRIPTOR kFormCalcDescriptor
bool IsName(ByteStringView name) const
const CFXJSE_Context * GetContext() const
static CFXJSE_Class * Create(CFXJSE_Context *pContext, const FXJSE_CLASS_DESCRIPTOR *pClassDescriptor, bool bIsJSGlobal)
UnownedPtr< const CFXJSE_Context > const m_pContext
v8::Global< v8::FunctionTemplate > m_hTemplate
CFXJSE_Class(const CFXJSE_Context *pContext)
v8::Local< v8::FunctionTemplate > GetTemplate(v8::Isolate *pIsolate)
UnownedPtr< const FXJSE_CLASS_DESCRIPTOR > m_pClassDescriptor
v8::Local< v8::Object > GetGlobalObject()
v8::Local< v8::Context > GetContext()
ExecutionResult ExecuteScript(ByteStringView bsScript, v8::Local< v8::Object > pNewThisObject)
void AddClass(std::unique_ptr< CFXJSE_Class > pClass)
static std::unique_ptr< CFXJSE_Context > Create(v8::Isolate *pIsolate, const FXJSE_CLASS_DESCRIPTOR *pGlobalClass, CFXJSE_HostObject *pGlobalObject, CXFA_ThisProxy *pProxy)
v8::Isolate * GetIsolate() const
void EnableCompatibleMode()
CFXJSE_Class * GetClassByName(ByteStringView szName) const
CFXJSE_ScopeUtil_Context & operator=(const CFXJSE_ScopeUtil_Context &)=delete
~CFXJSE_ScopeUtil_Context()
CFXJSE_ScopeUtil_Context(const CFXJSE_ScopeUtil_Context &)=delete
CFXJSE_ScopeUtil_Context(CFXJSE_Context *pContext)
CFXJSE_ScopeUtil_IsolateHandleContext(CFXJSE_Context *pContext)
CFXJSE_ScopeUtil_IsolateHandleContext(const CFXJSE_ScopeUtil_IsolateHandleContext &)=delete
~CFXJSE_ScopeUtil_IsolateHandleContext()
CFXJSE_ScopeUtil_IsolateHandleContext & operator=(const CFXJSE_ScopeUtil_IsolateHandleContext &)=delete
CFXJSE_ScopeUtil_IsolateHandleRootContext(const CFXJSE_ScopeUtil_IsolateHandleRootContext &)=delete
CFXJSE_ScopeUtil_IsolateHandleRootContext(v8::Isolate *pIsolate)
CFXJSE_ScopeUtil_IsolateHandleRootContext & operator=(const CFXJSE_ScopeUtil_IsolateHandleRootContext &)=delete
~CFXJSE_ScopeUtil_IsolateHandleRootContext()
CFXJSE_ScopeUtil_IsolateHandle & operator=(const CFXJSE_ScopeUtil_IsolateHandle &)=delete
~CFXJSE_ScopeUtil_IsolateHandle()
CFXJSE_ScopeUtil_IsolateHandle(const CFXJSE_ScopeUtil_IsolateHandle &)=delete
CFXJSE_ScopeUtil_IsolateHandle(v8::Isolate *pIsolate)
CFXJSE_ScopeUtil_RootContext & operator=(const CFXJSE_ScopeUtil_RootContext &)=delete
~CFXJSE_ScopeUtil_RootContext()
CFXJSE_ScopeUtil_RootContext(const CFXJSE_ScopeUtil_RootContext &)=delete
CFXJSE_ScopeUtil_RootContext(v8::Isolate *pIsolate)
bool IsBoolean(v8::Isolate *pIsolate) const
CFXJSE_Value(v8::Isolate *pIsolate, v8::Local< v8::Value > value)
void SetArray(v8::Isolate *pIsolate, const std::vector< std::unique_ptr< CFXJSE_Value > > &values)
CFXJSE_HostObject * ToHostObject(v8::Isolate *pIsolate) const
bool GetObjectProperty(v8::Isolate *pIsolate, ByteStringView szPropName, CFXJSE_Value *pPropValue)
bool SetObjectOwnProperty(v8::Isolate *pIsolate, ByteStringView szPropName, CFXJSE_Value *pPropValue)
WideString ToWideString(v8::Isolate *pIsolate) const
bool IsString(v8::Isolate *pIsolate) const
const v8::Global< v8::Value > & DirectGetValue() const
bool IsArray(v8::Isolate *pIsolate) const
void SetInteger(v8::Isolate *pIsolate, int32_t nInteger)
bool GetObjectPropertyByIdx(v8::Isolate *pIsolate, uint32_t uPropIdx, CFXJSE_Value *pPropValue)
void ForceSetValue(v8::Isolate *pIsolate, v8::Local< v8::Value > hValue)
int32_t ToInteger(v8::Isolate *pIsolate) const
bool SetObjectProperty(v8::Isolate *pIsolate, ByteStringView szPropName, CFXJSE_Value *pPropValue)
bool IsFunction(v8::Isolate *pIsolate) const
static v8::Local< v8::Function > NewBoundFunction(v8::Isolate *pIsolate, v8::Local< v8::Function > hOldFunction, v8::Local< v8::Object > lpNewThis)
bool IsUndefined(v8::Isolate *pIsolate) const
double ToDouble(v8::Isolate *pIsolate) const
bool IsObject(v8::Isolate *pIsolate) const
void SetDouble(v8::Isolate *pIsolate, double dDouble)
bool IsNull(v8::Isolate *pIsolate) const
void SetFloat(v8::Isolate *pIsolate, float fFloat)
void SetString(v8::Isolate *pIsolate, ByteStringView szString)
ByteString ToString(v8::Isolate *pIsolate) const
void SetNull(v8::Isolate *pIsolate)
void DeleteObjectProperty(v8::Isolate *pIsolate, ByteStringView szPropName)
void SetHostObject(v8::Isolate *pIsolate, CFXJSE_HostObject *pObject, CFXJSE_Class *pClass)
float ToFloat(v8::Isolate *pIsolate) const
bool ToBoolean(v8::Isolate *pIsolate) const
void SetUndefined(v8::Isolate *pIsolate)
v8::Local< v8::Value > GetValue(v8::Isolate *pIsolate) const
bool IsInteger(v8::Isolate *pIsolate) const
void SetBoolean(v8::Isolate *pIsolate, bool bBoolean)
bool IsNumber(v8::Isolate *pIsolate) const
static ByteString Format(const char *pFormat,...)
void ThrowExceptionHelper(v8::Isolate *pIsolate, WideStringView str)
std::unique_ptr< CFXJSE_Value > value
ExecutionResult & operator=(ExecutionResult &&that) noexcept
ExecutionResult(ExecutionResult &&that) noexcept
ExecutionResult(bool sts, std::unique_ptr< CFXJSE_Value > val)
FXJSE_PropTypeGetter dynPropTypeGetter
FXJSE_PropSetter dynPropSetter
FXJSE_MethodCallback dynMethodCall
FXJSE_FuncCallback callbackProc