Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: xfa/src/fxfa/fm2js/xfa_simpleexpression.h

Issue 1803723002: Move xfa/src up to xfa/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/src/fxfa/fm2js/xfa_program.cpp ('k') | xfa/src/fxfa/fm2js/xfa_simpleexpression.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef XFA_SRC_FXFA_FM2JS_XFA_SIMPLEEXPRESSION_H_
8 #define XFA_SRC_FXFA_FM2JS_XFA_SIMPLEEXPRESSION_H_
9
10 #include <memory>
11
12 #include "core/include/fxcrt/fx_basic.h"
13 #include "xfa/src/fxfa/fm2js/xfa_lexer.h"
14
15 #define RUNTIMEFUNCTIONRETURNVALUE \
16 (FX_WSTRC(L"foxit_xfa_formcalc_runtime_func_return_value"))
17 #define EXCLAMATION_IN_IDENTIFIER \
18 (FX_WSTRC(L"foxit_xfa_formcalc__exclamation__"))
19
20 enum XFA_FM_SimpleExpressionType {
21 ASSIGN,
22 LOGICALOR,
23 LOGICALAND,
24 EQUALITY,
25 NOTEQUALITY,
26 LESS,
27 LESSEQUAL,
28 GREATER,
29 GREATEREQUAL,
30 PLUS,
31 MINUS,
32 MULTIPLE,
33 DIVIDE,
34 POSITIVE,
35 NEGATIVE,
36 NOT,
37 CALL,
38 DOT,
39 DOTDOT,
40 CONCATFMOBJECT,
41 ISFMOBJECT,
42 ISFMARRAY,
43 GETFMVALUE,
44 GETFMJSOBJ,
45 VARFILTER
46 };
47
48 CFX_WideStringC XFA_FM_EXPTypeToString(
49 XFA_FM_SimpleExpressionType simpleExpType);
50
51 enum XFA_FM_AccessorIndex {
52 ACCESSOR_NO_INDEX,
53 ACCESSOR_NO_RELATIVEINDEX,
54 ACCESSOR_POSITIVE_INDEX,
55 ACCESSOR_NEGATIVE_INDEX
56 };
57
58 class CXFA_FMSimpleExpression {
59 public:
60 CXFA_FMSimpleExpression(FX_DWORD line, XFA_FM_TOKEN op);
61 virtual ~CXFA_FMSimpleExpression() {}
62 virtual void ToJavaScript(CFX_WideTextBuf& javascript);
63 virtual void ToImpliedReturnJS(CFX_WideTextBuf& javascript);
64
65 XFA_FM_TOKEN GetOperatorToken() const;
66
67 protected:
68 FX_DWORD m_line;
69 XFA_FM_TOKEN m_op;
70 };
71
72 class CXFA_FMNullExpression : public CXFA_FMSimpleExpression {
73 public:
74 explicit CXFA_FMNullExpression(FX_DWORD line);
75 ~CXFA_FMNullExpression() override {}
76 void ToJavaScript(CFX_WideTextBuf& javascript) override;
77 };
78
79 class CXFA_FMNumberExpression : public CXFA_FMSimpleExpression {
80 public:
81 CXFA_FMNumberExpression(FX_DWORD line, CFX_WideStringC wsNumber);
82 ~CXFA_FMNumberExpression() override {}
83 void ToJavaScript(CFX_WideTextBuf& javascript) override;
84
85 private:
86 CFX_WideStringC m_wsNumber;
87 };
88
89 class CXFA_FMStringExpression : public CXFA_FMSimpleExpression {
90 public:
91 CXFA_FMStringExpression(FX_DWORD line, CFX_WideStringC wsString);
92 ~CXFA_FMStringExpression() override {}
93 void ToJavaScript(CFX_WideTextBuf& javascript) override;
94
95 private:
96 CFX_WideStringC m_wsString;
97 };
98
99 class CXFA_FMIdentifierExpressionn : public CXFA_FMSimpleExpression {
100 public:
101 CXFA_FMIdentifierExpressionn(FX_DWORD line, CFX_WideStringC wsIdentifier);
102 ~CXFA_FMIdentifierExpressionn() override {}
103 void ToJavaScript(CFX_WideTextBuf& javascript) override;
104
105 private:
106 CFX_WideStringC m_wsIdentifier;
107 };
108
109 class CXFA_FMUnaryExpression : public CXFA_FMSimpleExpression {
110 public:
111 CXFA_FMUnaryExpression(FX_DWORD line,
112 XFA_FM_TOKEN op,
113 CXFA_FMSimpleExpression* pExp);
114 void ToJavaScript(CFX_WideTextBuf& javascript) override;
115
116 protected:
117 std::unique_ptr<CXFA_FMSimpleExpression> m_pExp;
118 };
119
120 class CXFA_FMBinExpression : public CXFA_FMSimpleExpression {
121 public:
122 CXFA_FMBinExpression(FX_DWORD line,
123 XFA_FM_TOKEN op,
124 CXFA_FMSimpleExpression* pExp1,
125 CXFA_FMSimpleExpression* pExp2);
126 void ToJavaScript(CFX_WideTextBuf& javascript) override;
127
128 protected:
129 std::unique_ptr<CXFA_FMSimpleExpression> m_pExp1;
130 std::unique_ptr<CXFA_FMSimpleExpression> m_pExp2;
131 };
132
133 class CXFA_FMAssignExpression : public CXFA_FMBinExpression {
134 public:
135 CXFA_FMAssignExpression(FX_DWORD line,
136 XFA_FM_TOKEN op,
137 CXFA_FMSimpleExpression* pExp1,
138 CXFA_FMSimpleExpression* pExp2);
139 ~CXFA_FMAssignExpression() override {}
140 void ToJavaScript(CFX_WideTextBuf& javascript) override;
141 void ToImpliedReturnJS(CFX_WideTextBuf& javascript) override;
142 };
143
144 class CXFA_FMLogicalOrExpression : public CXFA_FMBinExpression {
145 public:
146 CXFA_FMLogicalOrExpression(FX_DWORD line,
147 XFA_FM_TOKEN op,
148 CXFA_FMSimpleExpression* pExp1,
149 CXFA_FMSimpleExpression* pExp2);
150 ~CXFA_FMLogicalOrExpression() override {}
151 void ToJavaScript(CFX_WideTextBuf& javascript) override;
152 };
153
154 class CXFA_FMLogicalAndExpression : public CXFA_FMBinExpression {
155 public:
156 CXFA_FMLogicalAndExpression(FX_DWORD line,
157 XFA_FM_TOKEN op,
158 CXFA_FMSimpleExpression* pExp1,
159 CXFA_FMSimpleExpression* pExp2);
160 ~CXFA_FMLogicalAndExpression() override {}
161 void ToJavaScript(CFX_WideTextBuf& javascript) override;
162 };
163
164 class CXFA_FMEqualityExpression : public CXFA_FMBinExpression {
165 public:
166 CXFA_FMEqualityExpression(FX_DWORD line,
167 XFA_FM_TOKEN op,
168 CXFA_FMSimpleExpression* pExp1,
169 CXFA_FMSimpleExpression* pExp2);
170 ~CXFA_FMEqualityExpression() override {}
171 void ToJavaScript(CFX_WideTextBuf& javascript) override;
172 };
173
174 class CXFA_FMRelationalExpression : public CXFA_FMBinExpression {
175 public:
176 CXFA_FMRelationalExpression(FX_DWORD line,
177 XFA_FM_TOKEN op,
178 CXFA_FMSimpleExpression* pExp1,
179 CXFA_FMSimpleExpression* pExp2);
180 ~CXFA_FMRelationalExpression() override {}
181 void ToJavaScript(CFX_WideTextBuf& javascript) override;
182 };
183
184 class CXFA_FMAdditiveExpression : public CXFA_FMBinExpression {
185 public:
186 CXFA_FMAdditiveExpression(FX_DWORD line,
187 XFA_FM_TOKEN op,
188 CXFA_FMSimpleExpression* pExp1,
189 CXFA_FMSimpleExpression* pExp2);
190 ~CXFA_FMAdditiveExpression() override {}
191 void ToJavaScript(CFX_WideTextBuf& javascript) override;
192 };
193
194 class CXFA_FMMultiplicativeExpression : public CXFA_FMBinExpression {
195 public:
196 CXFA_FMMultiplicativeExpression(FX_DWORD line,
197 XFA_FM_TOKEN op,
198 CXFA_FMSimpleExpression* pExp1,
199 CXFA_FMSimpleExpression* pExp2);
200 ~CXFA_FMMultiplicativeExpression() override {}
201 void ToJavaScript(CFX_WideTextBuf& javascript) override;
202 };
203
204 class CXFA_FMPosExpression : public CXFA_FMUnaryExpression {
205 public:
206 CXFA_FMPosExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp);
207 ~CXFA_FMPosExpression() override {}
208 void ToJavaScript(CFX_WideTextBuf& javascript) override;
209 };
210
211 class CXFA_FMNegExpression : public CXFA_FMUnaryExpression {
212 public:
213 CXFA_FMNegExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp);
214 ~CXFA_FMNegExpression() override {}
215 void ToJavaScript(CFX_WideTextBuf& javascript) override;
216 };
217
218 class CXFA_FMNotExpression : public CXFA_FMUnaryExpression {
219 public:
220 CXFA_FMNotExpression(FX_DWORD line, CXFA_FMSimpleExpression* pExp);
221 ~CXFA_FMNotExpression() override {}
222 void ToJavaScript(CFX_WideTextBuf& javascript) override;
223 };
224
225 class CXFA_FMCallExpression : public CXFA_FMUnaryExpression {
226 public:
227 CXFA_FMCallExpression(FX_DWORD line,
228 CXFA_FMSimpleExpression* pExp,
229 CFX_PtrArray* pArguments,
230 FX_BOOL bIsSomMethod);
231 ~CXFA_FMCallExpression() override;
232 bool IsBuildInFunc(CFX_WideTextBuf* funcName);
233 FX_DWORD IsMethodWithObjParam(const CFX_WideStringC& methodName);
234 void ToJavaScript(CFX_WideTextBuf& javascript) override;
235
236 private:
237 FX_BOOL m_bIsSomMethod;
238 CFX_PtrArray* m_pArguments;
239 };
240
241 class CXFA_FMDotAccessorExpression : public CXFA_FMBinExpression {
242 public:
243 CXFA_FMDotAccessorExpression(FX_DWORD line,
244 CXFA_FMSimpleExpression* pAccessor,
245 XFA_FM_TOKEN op,
246 CFX_WideStringC wsIdentifier,
247 CXFA_FMSimpleExpression* pIndexExp);
248 ~CXFA_FMDotAccessorExpression() override {}
249 void ToJavaScript(CFX_WideTextBuf& javascript) override;
250
251 private:
252 CFX_WideStringC m_wsIdentifier;
253 };
254
255 class CXFA_FMIndexExpression : public CXFA_FMUnaryExpression {
256 public:
257 CXFA_FMIndexExpression(FX_DWORD line,
258 XFA_FM_AccessorIndex accessorIndex,
259 CXFA_FMSimpleExpression* pIndexExp,
260 FX_BOOL bIsStarIndex);
261 ~CXFA_FMIndexExpression() override {}
262 void ToJavaScript(CFX_WideTextBuf& javascript) override;
263
264 private:
265 XFA_FM_AccessorIndex m_accessorIndex;
266 FX_BOOL m_bIsStarIndex;
267 };
268
269 class CXFA_FMDotDotAccessorExpression : public CXFA_FMBinExpression {
270 public:
271 CXFA_FMDotDotAccessorExpression(FX_DWORD line,
272 CXFA_FMSimpleExpression* pAccessor,
273 XFA_FM_TOKEN op,
274 CFX_WideStringC wsIdentifier,
275 CXFA_FMSimpleExpression* pIndexExp);
276 ~CXFA_FMDotDotAccessorExpression() override {}
277 void ToJavaScript(CFX_WideTextBuf& javascript) override;
278
279 private:
280 CFX_WideStringC m_wsIdentifier;
281 };
282
283 class CXFA_FMMethodCallExpression : public CXFA_FMBinExpression {
284 public:
285 CXFA_FMMethodCallExpression(FX_DWORD line,
286 CXFA_FMSimpleExpression* pAccessorExp1,
287 CXFA_FMSimpleExpression* pCallExp);
288 ~CXFA_FMMethodCallExpression() override {}
289 void ToJavaScript(CFX_WideTextBuf& javascript) override;
290 };
291
292 #endif // XFA_SRC_FXFA_FM2JS_XFA_SIMPLEEXPRESSION_H_
OLDNEW
« no previous file with comments | « xfa/src/fxfa/fm2js/xfa_program.cpp ('k') | xfa/src/fxfa/fm2js/xfa_simpleexpression.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698