OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXJSE_INCLUDE_FXJSE_H_ | 7 #ifndef XFA_FXJSE_INCLUDE_FXJSE_H_ |
8 #define XFA_FXJSE_INCLUDE_FXJSE_H_ | 8 #define XFA_FXJSE_INCLUDE_FXJSE_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_string.h" | 10 #include "core/fxcrt/include/fx_string.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 void FXJSE_Finalize(); | 72 void FXJSE_Finalize(); |
73 | 73 |
74 FXJSE_HRUNTIME FXJSE_Runtime_Create(); | 74 FXJSE_HRUNTIME FXJSE_Runtime_Create(); |
75 void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); | 75 void FXJSE_Runtime_Release(FXJSE_HRUNTIME hRuntime, bool bOwnedRuntime); |
76 | 76 |
77 FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, | 77 FXJSE_HCONTEXT FXJSE_Context_Create(FXJSE_HRUNTIME hRuntime, |
78 const FXJSE_CLASS* lpGlobalClass = nullptr, | 78 const FXJSE_CLASS* lpGlobalClass = nullptr, |
79 void* lpGlobalObject = nullptr); | 79 void* lpGlobalObject = nullptr); |
80 void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); | 80 void FXJSE_Context_Release(FXJSE_HCONTEXT hContext); |
81 FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); | 81 FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext); |
82 FXJSE_HRUNTIME FXJSE_Context_GetRuntime(FXJSE_HCONTEXT hContext); | |
83 | 82 |
84 void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, | 83 void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext, |
85 uint32_t dwCompatibleFlags); | 84 uint32_t dwCompatibleFlags); |
86 | 85 |
87 void FXJSE_DefineFunctions(FXJSE_HCONTEXT hContext, | |
88 const FXJSE_FUNCTION* lpFunctions, | |
89 int nNum); | |
90 FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, | 86 FXJSE_HCLASS FXJSE_DefineClass(FXJSE_HCONTEXT hContext, |
91 const FXJSE_CLASS* lpClass); | 87 const FXJSE_CLASS* lpClass); |
92 FXJSE_HCLASS FXJSE_GetClass(FXJSE_HCONTEXT hContext, | |
93 const CFX_ByteStringC& szName); | |
94 | 88 |
95 FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); | 89 FXJSE_HVALUE FXJSE_Value_Create(FXJSE_HRUNTIME hRuntime); |
96 void FXJSE_Value_Release(FXJSE_HVALUE hValue); | 90 void FXJSE_Value_Release(FXJSE_HVALUE hValue); |
97 FXJSE_HRUNTIME FXJSE_Value_GetRuntime(FXJSE_HVALUE hValue); | |
98 | 91 |
99 FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue); | 92 FX_BOOL FXJSE_Value_IsUndefined(FXJSE_HVALUE hValue); |
100 FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue); | 93 FX_BOOL FXJSE_Value_IsNull(FXJSE_HVALUE hValue); |
101 FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue); | 94 FX_BOOL FXJSE_Value_IsBoolean(FXJSE_HVALUE hValue); |
102 FX_BOOL FXJSE_Value_IsUTF8String(FXJSE_HVALUE hValue); | 95 FX_BOOL FXJSE_Value_IsUTF8String(FXJSE_HVALUE hValue); |
103 FX_BOOL FXJSE_Value_IsNumber(FXJSE_HVALUE hValue); | 96 FX_BOOL FXJSE_Value_IsNumber(FXJSE_HVALUE hValue); |
104 FX_BOOL FXJSE_Value_IsInteger(FXJSE_HVALUE hValue); | |
105 FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue); | 97 FX_BOOL FXJSE_Value_IsObject(FXJSE_HVALUE hValue); |
106 FX_BOOL FXJSE_Value_IsArray(FXJSE_HVALUE hValue); | 98 FX_BOOL FXJSE_Value_IsArray(FXJSE_HVALUE hValue); |
107 FX_BOOL FXJSE_Value_IsFunction(FXJSE_HVALUE hValue); | 99 FX_BOOL FXJSE_Value_IsFunction(FXJSE_HVALUE hValue); |
108 FX_BOOL FXJSE_Value_IsDate(FXJSE_HVALUE hValue); | |
109 | 100 |
110 FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue); | 101 FX_BOOL FXJSE_Value_ToBoolean(FXJSE_HVALUE hValue); |
111 FX_FLOAT FXJSE_Value_ToFloat(FXJSE_HVALUE hValue); | 102 FX_FLOAT FXJSE_Value_ToFloat(FXJSE_HVALUE hValue); |
112 double FXJSE_Value_ToDouble(FXJSE_HVALUE hValue); | 103 double FXJSE_Value_ToDouble(FXJSE_HVALUE hValue); |
113 int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue); | 104 int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue); |
114 void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue, CFX_ByteString& szStrOutput); | 105 void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue, CFX_ByteString& szStrOutput); |
115 void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, FXJSE_HCLASS hClass); | 106 void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, FXJSE_HCLASS hClass); |
116 | 107 |
117 void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue); | 108 void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue); |
118 void FXJSE_Value_SetNull(FXJSE_HVALUE hValue); | 109 void FXJSE_Value_SetNull(FXJSE_HVALUE hValue); |
119 void FXJSE_Value_SetBoolean(FXJSE_HVALUE hValue, FX_BOOL bBoolean); | 110 void FXJSE_Value_SetBoolean(FXJSE_HVALUE hValue, FX_BOOL bBoolean); |
120 void FXJSE_Value_SetUTF8String(FXJSE_HVALUE hValue, | 111 void FXJSE_Value_SetUTF8String(FXJSE_HVALUE hValue, |
121 const CFX_ByteStringC& szString); | 112 const CFX_ByteStringC& szString); |
122 void FXJSE_Value_SetInteger(FXJSE_HVALUE hValue, int32_t nInteger); | 113 void FXJSE_Value_SetInteger(FXJSE_HVALUE hValue, int32_t nInteger); |
123 void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat); | 114 void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat); |
124 void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble); | 115 void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble); |
125 void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, | 116 void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, |
126 void* lpObject, | 117 void* lpObject, |
127 FXJSE_HCLASS hClass); | 118 FXJSE_HCLASS hClass); |
128 void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, | 119 void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, |
129 uint32_t uValueCount, | 120 uint32_t uValueCount, |
130 FXJSE_HVALUE* rgValues); | 121 FXJSE_HVALUE* rgValues); |
131 void FXJSE_Value_SetDate(FXJSE_HVALUE hValue, double dDouble); | |
132 void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue); | 122 void FXJSE_Value_Set(FXJSE_HVALUE hValue, FXJSE_HVALUE hOriginalValue); |
133 | 123 |
134 FX_BOOL FXJSE_Value_GetObjectProp(FXJSE_HVALUE hValue, | 124 FX_BOOL FXJSE_Value_GetObjectProp(FXJSE_HVALUE hValue, |
135 const CFX_ByteStringC& szPropName, | 125 const CFX_ByteStringC& szPropName, |
136 FXJSE_HVALUE hPropValue); | 126 FXJSE_HVALUE hPropValue); |
137 FX_BOOL FXJSE_Value_SetObjectProp(FXJSE_HVALUE hValue, | 127 FX_BOOL FXJSE_Value_SetObjectProp(FXJSE_HVALUE hValue, |
138 const CFX_ByteStringC& szPropName, | 128 const CFX_ByteStringC& szPropName, |
139 FXJSE_HVALUE hPropValue); | 129 FXJSE_HVALUE hPropValue); |
140 FX_BOOL FXJSE_Value_GetObjectPropByIdx(FXJSE_HVALUE hValue, | 130 FX_BOOL FXJSE_Value_GetObjectPropByIdx(FXJSE_HVALUE hValue, |
141 uint32_t uPropIdx, | 131 uint32_t uPropIdx, |
142 FXJSE_HVALUE hPropValue); | 132 FXJSE_HVALUE hPropValue); |
143 FX_BOOL FXJSE_Value_SetObjectPropByIdx(FXJSE_HVALUE hValue, | |
144 uint32_t uPropIdx, | |
145 FXJSE_HVALUE hPropValue); | |
146 FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue, | 133 FX_BOOL FXJSE_Value_DeleteObjectProp(FXJSE_HVALUE hValue, |
147 const CFX_ByteStringC& szPropName); | 134 const CFX_ByteStringC& szPropName); |
148 FX_BOOL FXJSE_Value_ObjectHasOwnProp(FXJSE_HVALUE hValue, | 135 FX_BOOL FXJSE_Value_ObjectHasOwnProp(FXJSE_HVALUE hValue, |
149 const CFX_ByteStringC& szPropName, | 136 const CFX_ByteStringC& szPropName, |
150 FX_BOOL bUseTypeGetter); | 137 FX_BOOL bUseTypeGetter); |
151 FX_BOOL FXJSE_Value_SetObjectOwnProp(FXJSE_HVALUE hValue, | 138 FX_BOOL FXJSE_Value_SetObjectOwnProp(FXJSE_HVALUE hValue, |
152 const CFX_ByteStringC& szPropName, | 139 const CFX_ByteStringC& szPropName, |
153 FXJSE_HVALUE hPropValue); | 140 FXJSE_HVALUE hPropValue); |
154 | 141 |
155 FX_BOOL FXJSE_Value_CallFunction(FXJSE_HVALUE hFunction, | |
156 FXJSE_HVALUE hThis, | |
157 FXJSE_HVALUE hRetValue, | |
158 uint32_t nArgCount, | |
159 FXJSE_HVALUE* lpArgs); | |
160 FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue, | 142 FX_BOOL FXJSE_Value_SetFunctionBind(FXJSE_HVALUE hValue, |
161 FXJSE_HVALUE hOldFunction, | 143 FXJSE_HVALUE hOldFunction, |
162 FXJSE_HVALUE hNewThis); | 144 FXJSE_HVALUE hNewThis); |
163 | 145 |
164 FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext, | 146 FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext, |
165 const FX_CHAR* szScript, | 147 const FX_CHAR* szScript, |
166 FXJSE_HVALUE hRetValue, | 148 FXJSE_HVALUE hRetValue, |
167 FXJSE_HVALUE hNewThisObject = nullptr); | 149 FXJSE_HVALUE hNewThisObject = nullptr); |
168 | 150 |
169 void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, | 151 void FXJSE_ThrowMessage(const CFX_ByteStringC& utf8Name, |
170 const CFX_ByteStringC& utf8Message); | 152 const CFX_ByteStringC& utf8Message); |
171 | 153 |
172 FX_BOOL FXJSE_ReturnValue_GetMessage(FXJSE_HVALUE hRetValue, | |
173 CFX_ByteString& utf8Name, | |
174 CFX_ByteString& utf8Message); | |
175 FX_BOOL FXJSE_ReturnValue_GetLineInfo(FXJSE_HVALUE hRetValue, | |
176 int32_t& nLine, | |
177 int32_t& nCol); | |
178 | |
179 #endif // XFA_FXJSE_INCLUDE_FXJSE_H_ | 154 #endif // XFA_FXJSE_INCLUDE_FXJSE_H_ |
OLD | NEW |