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_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 7 #ifndef XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
8 #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 8 #define XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
9 | 9 |
10 #include "xfa/fxfa/parser/xfa_script.h" | 10 #include "xfa/fxfa/parser/xfa_script.h" |
11 #include "xfa/fxjse/cfxjse_arguments.h" | 11 #include "xfa/fxjse/cfxjse_arguments.h" |
12 | 12 |
13 class CXFA_FM2JSContext { | 13 class CXFA_FM2JSContext { |
14 public: | 14 public: |
15 static void Abs(FXJSE_HOBJECT hThis, | 15 static void Abs(CFXJSE_Value* pThis, |
16 const CFX_ByteStringC& szFuncName, | 16 const CFX_ByteStringC& szFuncName, |
17 CFXJSE_Arguments& args); | 17 CFXJSE_Arguments& args); |
18 static void Avg(FXJSE_HOBJECT hThis, | 18 static void Avg(CFXJSE_Value* pThis, |
19 const CFX_ByteStringC& szFuncName, | 19 const CFX_ByteStringC& szFuncName, |
20 CFXJSE_Arguments& args); | 20 CFXJSE_Arguments& args); |
21 static void Ceil(FXJSE_HOBJECT hThis, | 21 static void Ceil(CFXJSE_Value* pThis, |
22 const CFX_ByteStringC& szFuncName, | 22 const CFX_ByteStringC& szFuncName, |
23 CFXJSE_Arguments& args); | 23 CFXJSE_Arguments& args); |
24 static void Count(FXJSE_HOBJECT hThis, | 24 static void Count(CFXJSE_Value* pThis, |
25 const CFX_ByteStringC& szFuncName, | 25 const CFX_ByteStringC& szFuncName, |
26 CFXJSE_Arguments& args); | 26 CFXJSE_Arguments& args); |
27 static void Floor(FXJSE_HOBJECT hThis, | 27 static void Floor(CFXJSE_Value* pThis, |
28 const CFX_ByteStringC& szFuncName, | 28 const CFX_ByteStringC& szFuncName, |
29 CFXJSE_Arguments& args); | 29 CFXJSE_Arguments& args); |
30 static void Max(FXJSE_HOBJECT hThis, | 30 static void Max(CFXJSE_Value* pThis, |
31 const CFX_ByteStringC& szFuncName, | 31 const CFX_ByteStringC& szFuncName, |
32 CFXJSE_Arguments& args); | 32 CFXJSE_Arguments& args); |
33 static void Min(FXJSE_HOBJECT hThis, | 33 static void Min(CFXJSE_Value* pThis, |
34 const CFX_ByteStringC& szFuncName, | 34 const CFX_ByteStringC& szFuncName, |
35 CFXJSE_Arguments& args); | 35 CFXJSE_Arguments& args); |
36 static void Mod(FXJSE_HOBJECT hThis, | 36 static void Mod(CFXJSE_Value* pThis, |
37 const CFX_ByteStringC& szFuncName, | 37 const CFX_ByteStringC& szFuncName, |
38 CFXJSE_Arguments& args); | 38 CFXJSE_Arguments& args); |
39 static void Round(FXJSE_HOBJECT hThis, | 39 static void Round(CFXJSE_Value* pThis, |
40 const CFX_ByteStringC& szFuncName, | 40 const CFX_ByteStringC& szFuncName, |
41 CFXJSE_Arguments& args); | 41 CFXJSE_Arguments& args); |
42 static void Sum(FXJSE_HOBJECT hThis, | 42 static void Sum(CFXJSE_Value* pThis, |
43 const CFX_ByteStringC& szFuncName, | 43 const CFX_ByteStringC& szFuncName, |
44 CFXJSE_Arguments& args); | 44 CFXJSE_Arguments& args); |
45 static void Date(FXJSE_HOBJECT hThis, | 45 static void Date(CFXJSE_Value* pThis, |
46 const CFX_ByteStringC& szFuncName, | 46 const CFX_ByteStringC& szFuncName, |
47 CFXJSE_Arguments& args); | 47 CFXJSE_Arguments& args); |
48 static void Date2Num(FXJSE_HOBJECT hThis, | 48 static void Date2Num(CFXJSE_Value* pThis, |
49 const CFX_ByteStringC& szFuncName, | 49 const CFX_ByteStringC& szFuncName, |
50 CFXJSE_Arguments& args); | 50 CFXJSE_Arguments& args); |
51 static void DateFmt(FXJSE_HOBJECT hThis, | 51 static void DateFmt(CFXJSE_Value* pThis, |
52 const CFX_ByteStringC& szFuncName, | 52 const CFX_ByteStringC& szFuncName, |
53 CFXJSE_Arguments& args); | 53 CFXJSE_Arguments& args); |
54 static void IsoDate2Num(FXJSE_HOBJECT hThis, | 54 static void IsoDate2Num(CFXJSE_Value* pThis, |
55 const CFX_ByteStringC& szFuncName, | 55 const CFX_ByteStringC& szFuncName, |
56 CFXJSE_Arguments& args); | 56 CFXJSE_Arguments& args); |
57 static void IsoTime2Num(FXJSE_HOBJECT hThis, | 57 static void IsoTime2Num(CFXJSE_Value* pThis, |
58 const CFX_ByteStringC& szFuncName, | 58 const CFX_ByteStringC& szFuncName, |
59 CFXJSE_Arguments& args); | 59 CFXJSE_Arguments& args); |
60 static void LocalDateFmt(FXJSE_HOBJECT hThis, | 60 static void LocalDateFmt(CFXJSE_Value* pThis, |
61 const CFX_ByteStringC& szFuncName, | 61 const CFX_ByteStringC& szFuncName, |
62 CFXJSE_Arguments& args); | 62 CFXJSE_Arguments& args); |
63 static void LocalTimeFmt(FXJSE_HOBJECT hThis, | 63 static void LocalTimeFmt(CFXJSE_Value* pThis, |
64 const CFX_ByteStringC& szFuncName, | 64 const CFX_ByteStringC& szFuncName, |
65 CFXJSE_Arguments& args); | 65 CFXJSE_Arguments& args); |
66 static void Num2Date(FXJSE_HOBJECT hThis, | 66 static void Num2Date(CFXJSE_Value* pThis, |
67 const CFX_ByteStringC& szFuncName, | 67 const CFX_ByteStringC& szFuncName, |
68 CFXJSE_Arguments& args); | 68 CFXJSE_Arguments& args); |
69 static void Num2GMTime(FXJSE_HOBJECT hThis, | 69 static void Num2GMTime(CFXJSE_Value* pThis, |
70 const CFX_ByteStringC& szFuncName, | 70 const CFX_ByteStringC& szFuncName, |
71 CFXJSE_Arguments& args); | 71 CFXJSE_Arguments& args); |
72 static void Num2Time(FXJSE_HOBJECT hThis, | 72 static void Num2Time(CFXJSE_Value* pThis, |
73 const CFX_ByteStringC& szFuncName, | 73 const CFX_ByteStringC& szFuncName, |
74 CFXJSE_Arguments& args); | 74 CFXJSE_Arguments& args); |
75 static void Time(FXJSE_HOBJECT hThis, | 75 static void Time(CFXJSE_Value* pThis, |
76 const CFX_ByteStringC& szFuncName, | 76 const CFX_ByteStringC& szFuncName, |
77 CFXJSE_Arguments& args); | 77 CFXJSE_Arguments& args); |
78 static void Time2Num(FXJSE_HOBJECT hThis, | 78 static void Time2Num(CFXJSE_Value* pThis, |
79 const CFX_ByteStringC& szFuncName, | 79 const CFX_ByteStringC& szFuncName, |
80 CFXJSE_Arguments& args); | 80 CFXJSE_Arguments& args); |
81 static void TimeFmt(FXJSE_HOBJECT hThis, | 81 static void TimeFmt(CFXJSE_Value* pThis, |
82 const CFX_ByteStringC& szFuncName, | 82 const CFX_ByteStringC& szFuncName, |
83 CFXJSE_Arguments& args); | 83 CFXJSE_Arguments& args); |
84 | 84 |
85 static FX_BOOL IsIsoDateFormat(const FX_CHAR* pData, | 85 static FX_BOOL IsIsoDateFormat(const FX_CHAR* pData, |
86 int32_t iLength, | 86 int32_t iLength, |
87 int32_t& iStyle, | 87 int32_t& iStyle, |
88 int32_t& iYear, | 88 int32_t& iYear, |
89 int32_t& iMonth, | 89 int32_t& iMonth, |
90 int32_t& iDay); | 90 int32_t& iDay); |
91 static FX_BOOL IsIsoTimeFormat(const FX_CHAR* pData, | 91 static FX_BOOL IsIsoTimeFormat(const FX_CHAR* pData, |
92 int32_t iLength, | 92 int32_t iLength, |
93 int32_t& iHour, | 93 int32_t& iHour, |
94 int32_t& iMinute, | 94 int32_t& iMinute, |
95 int32_t& iSecond, | 95 int32_t& iSecond, |
96 int32_t& iMilliSecond, | 96 int32_t& iMilliSecond, |
97 int32_t& iZoneHour, | 97 int32_t& iZoneHour, |
98 int32_t& iZoneMinute); | 98 int32_t& iZoneMinute); |
99 static FX_BOOL IsIsoDateTimeFormat(const FX_CHAR* pData, | 99 static FX_BOOL IsIsoDateTimeFormat(const FX_CHAR* pData, |
100 int32_t iLength, | 100 int32_t iLength, |
101 int32_t& iYear, | 101 int32_t& iYear, |
102 int32_t& iMonth, | 102 int32_t& iMonth, |
103 int32_t& iDay, | 103 int32_t& iDay, |
104 int32_t& iHour, | 104 int32_t& iHour, |
105 int32_t& iMinute, | 105 int32_t& iMinute, |
106 int32_t& iSecond, | 106 int32_t& iSecond, |
107 int32_t& iMillionSecond, | 107 int32_t& iMillionSecond, |
108 int32_t& iZoneHour, | 108 int32_t& iZoneHour, |
109 int32_t& iZoneMinute); | 109 int32_t& iZoneMinute); |
110 static FX_BOOL Local2IsoDate(FXJSE_HOBJECT hThis, | 110 static FX_BOOL Local2IsoDate(CFXJSE_Value* pThis, |
111 const CFX_ByteStringC& szDate, | 111 const CFX_ByteStringC& szDate, |
112 const CFX_ByteStringC& szFormat, | 112 const CFX_ByteStringC& szFormat, |
113 const CFX_ByteStringC& szLocale, | 113 const CFX_ByteStringC& szLocale, |
114 CFX_ByteString& strIsoDate); | 114 CFX_ByteString& strIsoDate); |
115 static FX_BOOL Local2IsoTime(FXJSE_HOBJECT hThis, | 115 static FX_BOOL Local2IsoTime(CFXJSE_Value* pThis, |
116 const CFX_ByteStringC& szTime, | 116 const CFX_ByteStringC& szTime, |
117 const CFX_ByteStringC& szFormat, | 117 const CFX_ByteStringC& szFormat, |
118 const CFX_ByteStringC& szLocale, | 118 const CFX_ByteStringC& szLocale, |
119 CFX_ByteString& strIsoTime); | 119 CFX_ByteString& strIsoTime); |
120 static FX_BOOL IsoDate2Local(FXJSE_HOBJECT hThis, | 120 static FX_BOOL IsoDate2Local(CFXJSE_Value* pThis, |
121 const CFX_ByteStringC& szDate, | 121 const CFX_ByteStringC& szDate, |
122 const CFX_ByteStringC& szFormat, | 122 const CFX_ByteStringC& szFormat, |
123 const CFX_ByteStringC& szLocale, | 123 const CFX_ByteStringC& szLocale, |
124 CFX_ByteString& strLocalDate); | 124 CFX_ByteString& strLocalDate); |
125 static FX_BOOL IsoTime2Local(FXJSE_HOBJECT hThis, | 125 static FX_BOOL IsoTime2Local(CFXJSE_Value* pThis, |
126 const CFX_ByteStringC& szTime, | 126 const CFX_ByteStringC& szTime, |
127 const CFX_ByteStringC& szFormat, | 127 const CFX_ByteStringC& szFormat, |
128 const CFX_ByteStringC& szLocale, | 128 const CFX_ByteStringC& szLocale, |
129 CFX_ByteString& strLocalTime); | 129 CFX_ByteString& strLocalTime); |
130 static FX_BOOL GetGMTTime(FXJSE_HOBJECT hThis, | 130 static FX_BOOL GetGMTTime(CFXJSE_Value* pThis, |
131 const CFX_ByteStringC& szTime, | 131 const CFX_ByteStringC& szTime, |
132 const CFX_ByteStringC& szFormat, | 132 const CFX_ByteStringC& szFormat, |
133 const CFX_ByteStringC& szLocale, | 133 const CFX_ByteStringC& szLocale, |
134 CFX_ByteString& strGMTTime); | 134 CFX_ByteString& strGMTTime); |
135 static int32_t DateString2Num(const CFX_ByteStringC& szDateString); | 135 static int32_t DateString2Num(const CFX_ByteStringC& szDateString); |
136 static void GetLocalDateFormat(FXJSE_HOBJECT hThis, | 136 static void GetLocalDateFormat(CFXJSE_Value* pThis, |
137 int32_t iStyle, | 137 int32_t iStyle, |
138 const CFX_ByteStringC& szLocalStr, | 138 const CFX_ByteStringC& szLocalStr, |
139 CFX_ByteString& strFormat, | 139 CFX_ByteString& strFormat, |
140 FX_BOOL bStandard); | 140 FX_BOOL bStandard); |
141 static void GetLocalTimeFormat(FXJSE_HOBJECT hThis, | 141 static void GetLocalTimeFormat(CFXJSE_Value* pThis, |
142 int32_t iStyle, | 142 int32_t iStyle, |
143 const CFX_ByteStringC& szLocalStr, | 143 const CFX_ByteStringC& szLocalStr, |
144 CFX_ByteString& strFormat, | 144 CFX_ByteString& strFormat, |
145 FX_BOOL bStandard); | 145 FX_BOOL bStandard); |
146 static void GetStandardDateFormat(FXJSE_HOBJECT hThis, | 146 static void GetStandardDateFormat(CFXJSE_Value* pThis, |
147 int32_t iStyle, | 147 int32_t iStyle, |
148 const CFX_ByteStringC& szLocalStr, | 148 const CFX_ByteStringC& szLocalStr, |
149 CFX_ByteString& strFormat); | 149 CFX_ByteString& strFormat); |
150 static void GetStandardTimeFormat(FXJSE_HOBJECT hThis, | 150 static void GetStandardTimeFormat(CFXJSE_Value* pThis, |
151 int32_t iStyle, | 151 int32_t iStyle, |
152 const CFX_ByteStringC& szLocalStr, | 152 const CFX_ByteStringC& szLocalStr, |
153 CFX_ByteString& strFormat); | 153 CFX_ByteString& strFormat); |
154 | 154 |
155 static void Num2AllTime(FXJSE_HOBJECT hThis, | 155 static void Num2AllTime(CFXJSE_Value* pThis, |
156 int32_t iTime, | 156 int32_t iTime, |
157 const CFX_ByteStringC& szFormat, | 157 const CFX_ByteStringC& szFormat, |
158 const CFX_ByteStringC& szLocale, | 158 const CFX_ByteStringC& szLocale, |
159 FX_BOOL bGM, | 159 FX_BOOL bGM, |
160 CFX_ByteString& strTime); | 160 CFX_ByteString& strTime); |
161 static void GetLocalTimeZone(int32_t& iHour, int32_t& iMin, int32_t& iSec); | 161 static void GetLocalTimeZone(int32_t& iHour, int32_t& iMin, int32_t& iSec); |
162 | 162 |
163 static void Apr(FXJSE_HOBJECT hThis, | 163 static void Apr(CFXJSE_Value* pThis, |
164 const CFX_ByteStringC& szFuncName, | 164 const CFX_ByteStringC& szFuncName, |
165 CFXJSE_Arguments& args); | 165 CFXJSE_Arguments& args); |
166 static void CTerm(FXJSE_HOBJECT hThis, | 166 static void CTerm(CFXJSE_Value* pThis, |
167 const CFX_ByteStringC& szFuncName, | 167 const CFX_ByteStringC& szFuncName, |
168 CFXJSE_Arguments& args); | 168 CFXJSE_Arguments& args); |
169 static void FV(FXJSE_HOBJECT hThis, | 169 static void FV(CFXJSE_Value* pThis, |
170 const CFX_ByteStringC& szFuncName, | 170 const CFX_ByteStringC& szFuncName, |
171 CFXJSE_Arguments& args); | 171 CFXJSE_Arguments& args); |
172 static void IPmt(FXJSE_HOBJECT hThis, | 172 static void IPmt(CFXJSE_Value* pThis, |
173 const CFX_ByteStringC& szFuncName, | 173 const CFX_ByteStringC& szFuncName, |
174 CFXJSE_Arguments& args); | 174 CFXJSE_Arguments& args); |
175 static void NPV(FXJSE_HOBJECT hThis, | 175 static void NPV(CFXJSE_Value* pThis, |
176 const CFX_ByteStringC& szFuncName, | 176 const CFX_ByteStringC& szFuncName, |
177 CFXJSE_Arguments& args); | 177 CFXJSE_Arguments& args); |
178 static void Pmt(FXJSE_HOBJECT hThis, | 178 static void Pmt(CFXJSE_Value* pThis, |
179 const CFX_ByteStringC& szFuncName, | 179 const CFX_ByteStringC& szFuncName, |
180 CFXJSE_Arguments& args); | 180 CFXJSE_Arguments& args); |
181 static void PPmt(FXJSE_HOBJECT hThis, | 181 static void PPmt(CFXJSE_Value* pThis, |
182 const CFX_ByteStringC& szFuncName, | 182 const CFX_ByteStringC& szFuncName, |
183 CFXJSE_Arguments& args); | 183 CFXJSE_Arguments& args); |
184 static void PV(FXJSE_HOBJECT hThis, | 184 static void PV(CFXJSE_Value* pThis, |
185 const CFX_ByteStringC& szFuncName, | 185 const CFX_ByteStringC& szFuncName, |
186 CFXJSE_Arguments& args); | 186 CFXJSE_Arguments& args); |
187 static void Rate(FXJSE_HOBJECT hThis, | 187 static void Rate(CFXJSE_Value* pThis, |
188 const CFX_ByteStringC& szFuncName, | 188 const CFX_ByteStringC& szFuncName, |
189 CFXJSE_Arguments& args); | 189 CFXJSE_Arguments& args); |
190 static void Term(FXJSE_HOBJECT hThis, | 190 static void Term(CFXJSE_Value* pThis, |
191 const CFX_ByteStringC& szFuncName, | 191 const CFX_ByteStringC& szFuncName, |
192 CFXJSE_Arguments& args); | 192 CFXJSE_Arguments& args); |
193 static void Choose(FXJSE_HOBJECT hThis, | 193 static void Choose(CFXJSE_Value* pThis, |
194 const CFX_ByteStringC& szFuncName, | 194 const CFX_ByteStringC& szFuncName, |
195 CFXJSE_Arguments& args); | 195 CFXJSE_Arguments& args); |
196 static void Exists(FXJSE_HOBJECT hThis, | 196 static void Exists(CFXJSE_Value* pThis, |
197 const CFX_ByteStringC& szFuncName, | 197 const CFX_ByteStringC& szFuncName, |
198 CFXJSE_Arguments& args); | 198 CFXJSE_Arguments& args); |
199 static void HasValue(FXJSE_HOBJECT hThis, | 199 static void HasValue(CFXJSE_Value* pThis, |
200 const CFX_ByteStringC& szFuncName, | 200 const CFX_ByteStringC& szFuncName, |
201 CFXJSE_Arguments& args); | 201 CFXJSE_Arguments& args); |
202 static void Oneof(FXJSE_HOBJECT hThis, | 202 static void Oneof(CFXJSE_Value* pThis, |
203 const CFX_ByteStringC& szFuncName, | 203 const CFX_ByteStringC& szFuncName, |
204 CFXJSE_Arguments& args); | 204 CFXJSE_Arguments& args); |
205 static void Within(FXJSE_HOBJECT hThis, | 205 static void Within(CFXJSE_Value* pThis, |
206 const CFX_ByteStringC& szFuncName, | 206 const CFX_ByteStringC& szFuncName, |
207 CFXJSE_Arguments& args); | 207 CFXJSE_Arguments& args); |
208 static void If(FXJSE_HOBJECT hThis, | 208 static void If(CFXJSE_Value* pThis, |
209 const CFX_ByteStringC& szFuncName, | 209 const CFX_ByteStringC& szFuncName, |
210 CFXJSE_Arguments& args); | 210 CFXJSE_Arguments& args); |
211 static void Eval(FXJSE_HOBJECT hThis, | 211 static void Eval(CFXJSE_Value* pThis, |
212 const CFX_ByteStringC& szFuncName, | 212 const CFX_ByteStringC& szFuncName, |
213 CFXJSE_Arguments& args); | 213 CFXJSE_Arguments& args); |
214 static void Ref(FXJSE_HOBJECT hThis, | 214 static void Ref(CFXJSE_Value* pThis, |
215 const CFX_ByteStringC& szFuncName, | 215 const CFX_ByteStringC& szFuncName, |
216 CFXJSE_Arguments& args); | 216 CFXJSE_Arguments& args); |
217 static void UnitType(FXJSE_HOBJECT hThis, | 217 static void UnitType(CFXJSE_Value* pThis, |
218 const CFX_ByteStringC& szFuncName, | 218 const CFX_ByteStringC& szFuncName, |
219 CFXJSE_Arguments& args); | 219 CFXJSE_Arguments& args); |
220 static void UnitValue(FXJSE_HOBJECT hThis, | 220 static void UnitValue(CFXJSE_Value* pThis, |
221 const CFX_ByteStringC& szFuncName, | 221 const CFX_ByteStringC& szFuncName, |
222 CFXJSE_Arguments& args); | 222 CFXJSE_Arguments& args); |
223 | 223 |
224 static void At(FXJSE_HOBJECT hThis, | 224 static void At(CFXJSE_Value* pThis, |
225 const CFX_ByteStringC& szFuncName, | 225 const CFX_ByteStringC& szFuncName, |
226 CFXJSE_Arguments& args); | 226 CFXJSE_Arguments& args); |
227 static void Concat(FXJSE_HOBJECT hThis, | 227 static void Concat(CFXJSE_Value* pThis, |
228 const CFX_ByteStringC& szFuncName, | 228 const CFX_ByteStringC& szFuncName, |
229 CFXJSE_Arguments& args); | 229 CFXJSE_Arguments& args); |
230 static void Decode(FXJSE_HOBJECT hThis, | 230 static void Decode(CFXJSE_Value* pThis, |
231 const CFX_ByteStringC& szFuncName, | 231 const CFX_ByteStringC& szFuncName, |
232 CFXJSE_Arguments& args); | 232 CFXJSE_Arguments& args); |
233 static void DecodeURL(const CFX_ByteStringC& szURLString, | 233 static void DecodeURL(const CFX_ByteStringC& szURLString, |
234 CFX_ByteTextBuf& szResultBuf); | 234 CFX_ByteTextBuf& szResultBuf); |
235 static void DecodeHTML(const CFX_ByteStringC& szHTMLString, | 235 static void DecodeHTML(const CFX_ByteStringC& szHTMLString, |
236 CFX_ByteTextBuf& szResultBuf); | 236 CFX_ByteTextBuf& szResultBuf); |
237 static void DecodeXML(const CFX_ByteStringC& szXMLString, | 237 static void DecodeXML(const CFX_ByteStringC& szXMLString, |
238 CFX_ByteTextBuf& szResultBuf); | 238 CFX_ByteTextBuf& szResultBuf); |
239 static void Encode(FXJSE_HOBJECT hThis, | 239 static void Encode(CFXJSE_Value* pThis, |
240 const CFX_ByteStringC& szFuncName, | 240 const CFX_ByteStringC& szFuncName, |
241 CFXJSE_Arguments& args); | 241 CFXJSE_Arguments& args); |
242 static void EncodeURL(const CFX_ByteStringC& szURLString, | 242 static void EncodeURL(const CFX_ByteStringC& szURLString, |
243 CFX_ByteTextBuf& szResultBuf); | 243 CFX_ByteTextBuf& szResultBuf); |
244 static void EncodeHTML(const CFX_ByteStringC& szHTMLString, | 244 static void EncodeHTML(const CFX_ByteStringC& szHTMLString, |
245 CFX_ByteTextBuf& szResultBuf); | 245 CFX_ByteTextBuf& szResultBuf); |
246 static void EncodeXML(const CFX_ByteStringC& szXMLString, | 246 static void EncodeXML(const CFX_ByteStringC& szXMLString, |
247 CFX_ByteTextBuf& szResultBuf); | 247 CFX_ByteTextBuf& szResultBuf); |
248 static FX_BOOL HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t& iCode); | 248 static FX_BOOL HTMLSTR2Code(const CFX_WideStringC& pData, uint32_t& iCode); |
249 static FX_BOOL HTMLCode2STR(uint32_t iCode, CFX_WideString& wsHTMLReserve); | 249 static FX_BOOL HTMLCode2STR(uint32_t iCode, CFX_WideString& wsHTMLReserve); |
250 static void Format(FXJSE_HOBJECT hThis, | 250 static void Format(CFXJSE_Value* pThis, |
251 const CFX_ByteStringC& szFuncName, | 251 const CFX_ByteStringC& szFuncName, |
252 CFXJSE_Arguments& args); | 252 CFXJSE_Arguments& args); |
253 static void Left(FXJSE_HOBJECT hThis, | 253 static void Left(CFXJSE_Value* pThis, |
254 const CFX_ByteStringC& szFuncName, | 254 const CFX_ByteStringC& szFuncName, |
255 CFXJSE_Arguments& args); | 255 CFXJSE_Arguments& args); |
256 static void Len(FXJSE_HOBJECT hThis, | 256 static void Len(CFXJSE_Value* pThis, |
257 const CFX_ByteStringC& szFuncName, | 257 const CFX_ByteStringC& szFuncName, |
258 CFXJSE_Arguments& args); | 258 CFXJSE_Arguments& args); |
259 static void Lower(FXJSE_HOBJECT hThis, | 259 static void Lower(CFXJSE_Value* pThis, |
260 const CFX_ByteStringC& szFuncName, | 260 const CFX_ByteStringC& szFuncName, |
261 CFXJSE_Arguments& args); | 261 CFXJSE_Arguments& args); |
262 static void Ltrim(FXJSE_HOBJECT hThis, | 262 static void Ltrim(CFXJSE_Value* pThis, |
263 const CFX_ByteStringC& szFuncName, | 263 const CFX_ByteStringC& szFuncName, |
264 CFXJSE_Arguments& args); | 264 CFXJSE_Arguments& args); |
265 static void Parse(FXJSE_HOBJECT hThis, | 265 static void Parse(CFXJSE_Value* pThis, |
266 const CFX_ByteStringC& szFuncName, | 266 const CFX_ByteStringC& szFuncName, |
267 CFXJSE_Arguments& args); | 267 CFXJSE_Arguments& args); |
268 static void Replace(FXJSE_HOBJECT hThis, | 268 static void Replace(CFXJSE_Value* pThis, |
269 const CFX_ByteStringC& szFuncName, | 269 const CFX_ByteStringC& szFuncName, |
270 CFXJSE_Arguments& args); | 270 CFXJSE_Arguments& args); |
271 static void Right(FXJSE_HOBJECT hThis, | 271 static void Right(CFXJSE_Value* pThis, |
272 const CFX_ByteStringC& szFuncName, | 272 const CFX_ByteStringC& szFuncName, |
273 CFXJSE_Arguments& args); | 273 CFXJSE_Arguments& args); |
274 static void Rtrim(FXJSE_HOBJECT hThis, | 274 static void Rtrim(CFXJSE_Value* pThis, |
275 const CFX_ByteStringC& szFuncName, | 275 const CFX_ByteStringC& szFuncName, |
276 CFXJSE_Arguments& args); | 276 CFXJSE_Arguments& args); |
277 static void Space(FXJSE_HOBJECT hThis, | 277 static void Space(CFXJSE_Value* pThis, |
278 const CFX_ByteStringC& szFuncName, | 278 const CFX_ByteStringC& szFuncName, |
279 CFXJSE_Arguments& args); | 279 CFXJSE_Arguments& args); |
280 static void Str(FXJSE_HOBJECT hThis, | 280 static void Str(CFXJSE_Value* pThis, |
281 const CFX_ByteStringC& szFuncName, | 281 const CFX_ByteStringC& szFuncName, |
282 CFXJSE_Arguments& args); | 282 CFXJSE_Arguments& args); |
283 static void Stuff(FXJSE_HOBJECT hThis, | 283 static void Stuff(CFXJSE_Value* pThis, |
284 const CFX_ByteStringC& szFuncName, | 284 const CFX_ByteStringC& szFuncName, |
285 CFXJSE_Arguments& args); | 285 CFXJSE_Arguments& args); |
286 static void Substr(FXJSE_HOBJECT hThis, | 286 static void Substr(CFXJSE_Value* pThis, |
287 const CFX_ByteStringC& szFuncName, | 287 const CFX_ByteStringC& szFuncName, |
288 CFXJSE_Arguments& args); | 288 CFXJSE_Arguments& args); |
289 static void Uuid(FXJSE_HOBJECT hThis, | 289 static void Uuid(CFXJSE_Value* pThis, |
290 const CFX_ByteStringC& szFuncName, | 290 const CFX_ByteStringC& szFuncName, |
291 CFXJSE_Arguments& args); | 291 CFXJSE_Arguments& args); |
292 static void Upper(FXJSE_HOBJECT hThis, | 292 static void Upper(CFXJSE_Value* pThis, |
293 const CFX_ByteStringC& szFuncName, | 293 const CFX_ByteStringC& szFuncName, |
294 CFXJSE_Arguments& args); | 294 CFXJSE_Arguments& args); |
295 static void WordNum(FXJSE_HOBJECT hThis, | 295 static void WordNum(CFXJSE_Value* pThis, |
296 const CFX_ByteStringC& szFuncName, | 296 const CFX_ByteStringC& szFuncName, |
297 CFXJSE_Arguments& args); | 297 CFXJSE_Arguments& args); |
298 static void TrillionUS(const CFX_ByteStringC& szData, | 298 static void TrillionUS(const CFX_ByteStringC& szData, |
299 CFX_ByteTextBuf& strBuf); | 299 CFX_ByteTextBuf& strBuf); |
300 static void WordUS(const CFX_ByteStringC& szData, | 300 static void WordUS(const CFX_ByteStringC& szData, |
301 int32_t iStyle, | 301 int32_t iStyle, |
302 CFX_ByteTextBuf& strBuf); | 302 CFX_ByteTextBuf& strBuf); |
303 | 303 |
304 static void Get(FXJSE_HOBJECT hThis, | 304 static void Get(CFXJSE_Value* pThis, |
305 const CFX_ByteStringC& szFuncName, | 305 const CFX_ByteStringC& szFuncName, |
306 CFXJSE_Arguments& args); | 306 CFXJSE_Arguments& args); |
307 static void Post(FXJSE_HOBJECT hThis, | 307 static void Post(CFXJSE_Value* pThis, |
308 const CFX_ByteStringC& szFuncName, | 308 const CFX_ByteStringC& szFuncName, |
309 CFXJSE_Arguments& args); | 309 CFXJSE_Arguments& args); |
310 static void Put(FXJSE_HOBJECT hThis, | 310 static void Put(CFXJSE_Value* pThis, |
311 const CFX_ByteStringC& szFuncName, | 311 const CFX_ByteStringC& szFuncName, |
312 CFXJSE_Arguments& args); | 312 CFXJSE_Arguments& args); |
313 static void assign_value_operator(FXJSE_HOBJECT hThis, | 313 static void assign_value_operator(CFXJSE_Value* pThis, |
314 const CFX_ByteStringC& szFuncName, | 314 const CFX_ByteStringC& szFuncName, |
315 CFXJSE_Arguments& args); | 315 CFXJSE_Arguments& args); |
316 static void logical_or_operator(FXJSE_HOBJECT hThis, | 316 static void logical_or_operator(CFXJSE_Value* pThis, |
317 const CFX_ByteStringC& szFuncName, | 317 const CFX_ByteStringC& szFuncName, |
318 CFXJSE_Arguments& args); | 318 CFXJSE_Arguments& args); |
319 static void logical_and_operator(FXJSE_HOBJECT hThis, | 319 static void logical_and_operator(CFXJSE_Value* pThis, |
320 const CFX_ByteStringC& szFuncName, | 320 const CFX_ByteStringC& szFuncName, |
321 CFXJSE_Arguments& args); | 321 CFXJSE_Arguments& args); |
322 static void equality_operator(FXJSE_HOBJECT hThis, | 322 static void equality_operator(CFXJSE_Value* pThis, |
323 const CFX_ByteStringC& szFuncName, | 323 const CFX_ByteStringC& szFuncName, |
324 CFXJSE_Arguments& args); | 324 CFXJSE_Arguments& args); |
325 static void notequality_operator(FXJSE_HOBJECT hThis, | 325 static void notequality_operator(CFXJSE_Value* pThis, |
326 const CFX_ByteStringC& szFuncName, | 326 const CFX_ByteStringC& szFuncName, |
327 CFXJSE_Arguments& args); | 327 CFXJSE_Arguments& args); |
328 static FX_BOOL fm_ref_equal(FXJSE_HOBJECT hThis, CFXJSE_Arguments& args); | 328 static FX_BOOL fm_ref_equal(CFXJSE_Value* pThis, CFXJSE_Arguments& args); |
329 static void less_operator(FXJSE_HOBJECT hThis, | 329 static void less_operator(CFXJSE_Value* pThis, |
330 const CFX_ByteStringC& szFuncName, | 330 const CFX_ByteStringC& szFuncName, |
331 CFXJSE_Arguments& args); | 331 CFXJSE_Arguments& args); |
332 static void lessequal_operator(FXJSE_HOBJECT hThis, | 332 static void lessequal_operator(CFXJSE_Value* pThis, |
333 const CFX_ByteStringC& szFuncName, | 333 const CFX_ByteStringC& szFuncName, |
334 CFXJSE_Arguments& args); | 334 CFXJSE_Arguments& args); |
335 static void greater_operator(FXJSE_HOBJECT hThis, | 335 static void greater_operator(CFXJSE_Value* pThis, |
336 const CFX_ByteStringC& szFuncName, | 336 const CFX_ByteStringC& szFuncName, |
337 CFXJSE_Arguments& args); | 337 CFXJSE_Arguments& args); |
338 static void greaterequal_operator(FXJSE_HOBJECT hThis, | 338 static void greaterequal_operator(CFXJSE_Value* pThis, |
339 const CFX_ByteStringC& szFuncName, | 339 const CFX_ByteStringC& szFuncName, |
340 CFXJSE_Arguments& args); | 340 CFXJSE_Arguments& args); |
341 static void plus_operator(FXJSE_HOBJECT hThis, | 341 static void plus_operator(CFXJSE_Value* pThis, |
342 const CFX_ByteStringC& szFuncName, | 342 const CFX_ByteStringC& szFuncName, |
343 CFXJSE_Arguments& args); | 343 CFXJSE_Arguments& args); |
344 static void minus_operator(FXJSE_HOBJECT hThis, | 344 static void minus_operator(CFXJSE_Value* pThis, |
345 const CFX_ByteStringC& szFuncName, | 345 const CFX_ByteStringC& szFuncName, |
346 CFXJSE_Arguments& args); | 346 CFXJSE_Arguments& args); |
347 static void multiple_operator(FXJSE_HOBJECT hThis, | 347 static void multiple_operator(CFXJSE_Value* pThis, |
348 const CFX_ByteStringC& szFuncName, | 348 const CFX_ByteStringC& szFuncName, |
349 CFXJSE_Arguments& args); | 349 CFXJSE_Arguments& args); |
350 static void divide_operator(FXJSE_HOBJECT hThis, | 350 static void divide_operator(CFXJSE_Value* pThis, |
351 const CFX_ByteStringC& szFuncName, | 351 const CFX_ByteStringC& szFuncName, |
352 CFXJSE_Arguments& args); | 352 CFXJSE_Arguments& args); |
353 static void positive_operator(FXJSE_HOBJECT hThis, | 353 static void positive_operator(CFXJSE_Value* pThis, |
354 const CFX_ByteStringC& szFuncName, | 354 const CFX_ByteStringC& szFuncName, |
355 CFXJSE_Arguments& args); | 355 CFXJSE_Arguments& args); |
356 static void negative_operator(FXJSE_HOBJECT hThis, | 356 static void negative_operator(CFXJSE_Value* pThis, |
357 const CFX_ByteStringC& szFuncName, | 357 const CFX_ByteStringC& szFuncName, |
358 CFXJSE_Arguments& args); | 358 CFXJSE_Arguments& args); |
359 static void logical_not_operator(FXJSE_HOBJECT hThis, | 359 static void logical_not_operator(CFXJSE_Value* pThis, |
360 const CFX_ByteStringC& szFuncName, | 360 const CFX_ByteStringC& szFuncName, |
361 CFXJSE_Arguments& args); | 361 CFXJSE_Arguments& args); |
362 static void dot_accessor(FXJSE_HOBJECT hThis, | 362 static void dot_accessor(CFXJSE_Value* pThis, |
363 const CFX_ByteStringC& szFuncName, | 363 const CFX_ByteStringC& szFuncName, |
364 CFXJSE_Arguments& args); | 364 CFXJSE_Arguments& args); |
365 static void dotdot_accessor(FXJSE_HOBJECT hThis, | 365 static void dotdot_accessor(CFXJSE_Value* pThis, |
366 const CFX_ByteStringC& szFuncName, | 366 const CFX_ByteStringC& szFuncName, |
367 CFXJSE_Arguments& args); | 367 CFXJSE_Arguments& args); |
368 static void eval_translation(FXJSE_HOBJECT hThis, | 368 static void eval_translation(CFXJSE_Value* pThis, |
369 const CFX_ByteStringC& szFuncName, | 369 const CFX_ByteStringC& szFuncName, |
370 CFXJSE_Arguments& args); | 370 CFXJSE_Arguments& args); |
371 static void is_fm_object(FXJSE_HOBJECT hThis, | 371 static void is_fm_object(CFXJSE_Value* pThis, |
372 const CFX_ByteStringC& szFuncName, | 372 const CFX_ByteStringC& szFuncName, |
373 CFXJSE_Arguments& args); | 373 CFXJSE_Arguments& args); |
374 static void is_fm_array(FXJSE_HOBJECT hThis, | 374 static void is_fm_array(CFXJSE_Value* pThis, |
375 const CFX_ByteStringC& szFuncName, | 375 const CFX_ByteStringC& szFuncName, |
376 CFXJSE_Arguments& args); | 376 CFXJSE_Arguments& args); |
377 static void get_fm_value(FXJSE_HOBJECT hThis, | 377 static void get_fm_value(CFXJSE_Value* pThis, |
378 const CFX_ByteStringC& szFuncName, | 378 const CFX_ByteStringC& szFuncName, |
379 CFXJSE_Arguments& args); | 379 CFXJSE_Arguments& args); |
380 static void get_fm_jsobj(FXJSE_HOBJECT hThis, | 380 static void get_fm_jsobj(CFXJSE_Value* pThis, |
381 const CFX_ByteStringC& szFuncName, | 381 const CFX_ByteStringC& szFuncName, |
382 CFXJSE_Arguments& args); | 382 CFXJSE_Arguments& args); |
383 static void fm_var_filter(FXJSE_HOBJECT hThis, | 383 static void fm_var_filter(CFXJSE_Value* pThis, |
384 const CFX_ByteStringC& szFuncName, | 384 const CFX_ByteStringC& szFuncName, |
385 CFXJSE_Arguments& args); | 385 CFXJSE_Arguments& args); |
386 static void concat_fm_object(FXJSE_HOBJECT hThis, | 386 static void concat_fm_object(CFXJSE_Value* pThis, |
387 const CFX_ByteStringC& szFuncName, | 387 const CFX_ByteStringC& szFuncName, |
388 CFXJSE_Arguments& args); | 388 CFXJSE_Arguments& args); |
389 | 389 |
390 static int32_t hvalue_get_array_length(FXJSE_HOBJECT hThis, FXJSE_HVALUE arg); | 390 static int32_t hvalue_get_array_length(CFXJSE_Value* pThis, |
391 static FX_BOOL simpleValueCompare(FXJSE_HOBJECT hThis, | 391 CFXJSE_Value* arg); |
392 FXJSE_HVALUE firstValue, | 392 static FX_BOOL simpleValueCompare(CFXJSE_Value* pThis, |
393 FXJSE_HVALUE secondValue); | 393 CFXJSE_Value* firstValue, |
394 static void unfoldArgs(FXJSE_HOBJECT hThis, | 394 CFXJSE_Value* secondValue); |
| 395 static void unfoldArgs(CFXJSE_Value* pThis, |
395 CFXJSE_Arguments& args, | 396 CFXJSE_Arguments& args, |
396 FXJSE_HVALUE*& resultValues, | 397 CFXJSE_Value**& resultValues, |
397 int32_t& iCount, | 398 int32_t& iCount, |
398 int32_t iStart = 0); | 399 int32_t iStart = 0); |
399 static void GetObjectDefaultValue(FXJSE_HVALUE hObjectValue, | 400 static void GetObjectDefaultValue(CFXJSE_Value* pObjectValue, |
400 FXJSE_HVALUE hDefaultValue); | 401 CFXJSE_Value* pDefaultValue); |
401 static FX_BOOL SetObjectDefaultValue(FXJSE_HVALUE hObjectValue, | 402 static FX_BOOL SetObjectDefaultValue(CFXJSE_Value* pObjectValue, |
402 FXJSE_HVALUE hNewValue); | 403 CFXJSE_Value* pNewValue); |
403 static void GenerateSomExpression(const CFX_ByteStringC& szName, | 404 static void GenerateSomExpression(const CFX_ByteStringC& szName, |
404 int32_t iIndexFlags, | 405 int32_t iIndexFlags, |
405 int32_t iIndexValue, | 406 int32_t iIndexValue, |
406 FX_BOOL bIsStar, | 407 FX_BOOL bIsStar, |
407 CFX_ByteString& szSomExp); | 408 CFX_ByteString& szSomExp); |
408 static FX_BOOL GetObjectByName(FXJSE_HOBJECT hThis, | 409 static FX_BOOL GetObjectByName(CFXJSE_Value* pThis, |
409 FXJSE_HVALUE accessorValue, | 410 CFXJSE_Value* accessorValue, |
410 const CFX_ByteStringC& szAccessorName); | 411 const CFX_ByteStringC& szAccessorName); |
411 static int32_t ResolveObjects(FXJSE_HOBJECT hThis, | 412 static int32_t ResolveObjects(CFXJSE_Value* pThis, |
412 FXJSE_HVALUE hParentValue, | 413 CFXJSE_Value* pParentValue, |
413 const CFX_ByteStringC& bsSomExp, | 414 const CFX_ByteStringC& bsSomExp, |
414 XFA_RESOLVENODE_RS& resoveNodeRS, | 415 XFA_RESOLVENODE_RS& resoveNodeRS, |
415 FX_BOOL bdotAccessor = TRUE, | 416 FX_BOOL bdotAccessor = TRUE, |
416 FX_BOOL bHasNoResolveName = FALSE); | 417 FX_BOOL bHasNoResolveName = FALSE); |
417 static void ParseResolveResult(FXJSE_HOBJECT hThis, | 418 static void ParseResolveResult(CFXJSE_Value* pThis, |
418 const XFA_RESOLVENODE_RS& resoveNodeRS, | 419 const XFA_RESOLVENODE_RS& resoveNodeRS, |
419 FXJSE_HVALUE hParentValue, | 420 CFXJSE_Value* pParentValue, |
420 FXJSE_HVALUE*& resultValues, | 421 CFXJSE_Value**& resultValues, |
421 int32_t& iSize, | 422 int32_t& iSize, |
422 FX_BOOL& bAttribute); | 423 FX_BOOL& bAttribute); |
423 | 424 |
424 static FXJSE_HVALUE GetSimpleHValue(FXJSE_HOBJECT hThis, | 425 static CFXJSE_Value* GetSimpleValue(CFXJSE_Value* pThis, |
425 CFXJSE_Arguments& args, | 426 CFXJSE_Arguments& args, |
426 uint32_t index); | 427 uint32_t index); |
427 static FX_BOOL HValueIsNull(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue); | 428 static FX_BOOL ValueIsNull(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
428 static int32_t HValueToInteger(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue); | 429 static int32_t ValueToInteger(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
429 static FX_DOUBLE StringToDouble(const CFX_ByteStringC& szStringVal); | 430 static FX_DOUBLE StringToDouble(const CFX_ByteStringC& szStringVal); |
430 static FX_FLOAT HValueToFloat(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue); | 431 static FX_FLOAT ValueToFloat(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
431 static FX_DOUBLE HValueToDouble(FXJSE_HOBJECT hThis, FXJSE_HVALUE hValue); | 432 static FX_DOUBLE ValueToDouble(CFXJSE_Value* pThis, CFXJSE_Value* pValue); |
432 static void HValueToUTF8String(FXJSE_HVALUE hValue, | 433 static void ValueToUTF8String(CFXJSE_Value* pValue, |
433 CFX_ByteString& outputValue); | 434 CFX_ByteString& outputValue); |
434 | 435 |
435 CXFA_FM2JSContext(); | 436 CXFA_FM2JSContext(); |
436 ~CXFA_FM2JSContext(); | 437 ~CXFA_FM2JSContext(); |
437 | 438 |
438 void Initialize(v8::Isolate* pScriptIsolate, | 439 void Initialize(v8::Isolate* pScriptIsolate, |
439 CFXJSE_Context* pScriptContext, | 440 CFXJSE_Context* pScriptContext, |
440 CXFA_Document* pDoc); | 441 CXFA_Document* pDoc); |
441 void GlobalPropertyGetter(FXJSE_HVALUE hValue); | 442 void GlobalPropertyGetter(CFXJSE_Value* pValue); |
442 | 443 |
443 v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } | 444 v8::Isolate* GetScriptRuntime() const { return m_pIsolate; } |
444 CXFA_Document* GetDocument() const { return m_pDocument; } | 445 CXFA_Document* GetDocument() const { return m_pDocument; } |
445 void ThrowScriptErrorMessage(int32_t iStringID, ...); | 446 void ThrowScriptErrorMessage(int32_t iStringID, ...); |
446 | 447 |
447 private: | 448 private: |
448 v8::Isolate* m_pIsolate; | 449 v8::Isolate* m_pIsolate; |
449 FXJSE_CLASS m_fmClass; | 450 FXJSE_CLASS m_fmClass; |
450 CFXJSE_Class* m_pFMClass; | 451 CFXJSE_Class* m_pFMClass; |
451 FXJSE_HVALUE m_hValue; | 452 CFXJSE_Value* m_pValue; |
452 CXFA_Document* m_pDocument; | 453 CXFA_Document* m_pDocument; |
453 }; | 454 }; |
454 | 455 |
455 #endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ | 456 #endif // XFA_FXFA_FM2JS_XFA_FM2JSCONTEXT_H_ |
OLD | NEW |