summaryrefslogtreecommitdiff
path: root/xfa/fxfa/fm2js/cxfa_fmexpression.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-05-16 15:14:02 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-05-17 03:08:06 +0000
commit2e9d47ac2c9a4ebf0821d10c766fafa85e6d3cb9 (patch)
tree212ca832851067eb5f40cf49c1dc2ffe81a24ada /xfa/fxfa/fm2js/cxfa_fmexpression.h
parent7876609b3540137663d48282ad94ba42a3749e73 (diff)
downloadpdfium-2e9d47ac2c9a4ebf0821d10c766fafa85e6d3cb9.tar.xz
Rename formcalc files to better match contents
Most files match the contents. The expression files are named to match their base type even though they contain all the expression subclasses. Change-Id: I3b7705c7b206a9fa1afae8b677f765e8b788e84d Reviewed-on: https://pdfium-review.googlesource.com/5492 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/fm2js/cxfa_fmexpression.h')
-rw-r--r--xfa/fxfa/fm2js/cxfa_fmexpression.h214
1 files changed, 214 insertions, 0 deletions
diff --git a/xfa/fxfa/fm2js/cxfa_fmexpression.h b/xfa/fxfa/fm2js/cxfa_fmexpression.h
new file mode 100644
index 0000000000..c04bc2f117
--- /dev/null
+++ b/xfa/fxfa/fm2js/cxfa_fmexpression.h
@@ -0,0 +1,214 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FXFA_FM2JS_CXFA_FMEXPRESSION_H_
+#define XFA_FXFA_FM2JS_CXFA_FMEXPRESSION_H_
+
+#include <memory>
+#include <vector>
+
+#include "xfa/fxfa/fm2js/cxfa_fmsimpleexpression.h"
+
+enum XFA_FM_EXPTYPE {
+ XFA_FM_EXPTYPE_UNKNOWN,
+ XFA_FM_EXPTYPE_FUNC,
+ XFA_FM_EXPTYPE_VAR,
+ XFA_FM_EXPTYPE_EXP,
+ XFA_FM_EXPTYPE_BLOCK,
+ XFA_FM_EXPTYPE_IF,
+ XFA_FM_EXPTYPE_BREAK,
+ XFA_FM_EXPTYPE_CONTINUE,
+};
+
+class CXFA_FMExpression {
+ public:
+ explicit CXFA_FMExpression(uint32_t line);
+ CXFA_FMExpression(uint32_t line, XFA_FM_EXPTYPE type);
+ virtual ~CXFA_FMExpression() {}
+ virtual bool ToJavaScript(CFX_WideTextBuf& javascript);
+ virtual bool ToImpliedReturnJS(CFX_WideTextBuf&);
+ uint32_t GetLine() { return m_line; }
+ XFA_FM_EXPTYPE GetExpType() const { return m_type; }
+
+ private:
+ XFA_FM_EXPTYPE m_type;
+ uint32_t m_line;
+};
+
+class CXFA_FMFunctionDefinition : public CXFA_FMExpression {
+ public:
+ // Takes ownership of |arguments| and |expressions|.
+ CXFA_FMFunctionDefinition(
+ uint32_t line,
+ bool isGlobal,
+ const CFX_WideStringC& wsName,
+ std::vector<CFX_WideStringC>&& arguments,
+ std::vector<std::unique_ptr<CXFA_FMExpression>>&& expressions);
+ ~CXFA_FMFunctionDefinition() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ CFX_WideStringC m_wsName;
+ std::vector<CFX_WideStringC> m_pArguments;
+ std::vector<std::unique_ptr<CXFA_FMExpression>> m_pExpressions;
+ bool m_isGlobal;
+};
+
+class CXFA_FMVarExpression : public CXFA_FMExpression {
+ public:
+ CXFA_FMVarExpression(uint32_t line,
+ const CFX_WideStringC& wsName,
+ std::unique_ptr<CXFA_FMExpression> pInit);
+ ~CXFA_FMVarExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ CFX_WideStringC m_wsName;
+ std::unique_ptr<CXFA_FMExpression> m_pInit;
+};
+
+class CXFA_FMExpExpression : public CXFA_FMExpression {
+ public:
+ CXFA_FMExpExpression(uint32_t line,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExpression);
+ ~CXFA_FMExpExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ std::unique_ptr<CXFA_FMSimpleExpression> m_pExpression;
+};
+
+class CXFA_FMBlockExpression : public CXFA_FMExpression {
+ public:
+ CXFA_FMBlockExpression(
+ uint32_t line,
+ std::vector<std::unique_ptr<CXFA_FMExpression>>&& pExpressionList);
+ ~CXFA_FMBlockExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ std::vector<std::unique_ptr<CXFA_FMExpression>> m_ExpressionList;
+};
+
+class CXFA_FMDoExpression : public CXFA_FMExpression {
+ public:
+ CXFA_FMDoExpression(uint32_t line, std::unique_ptr<CXFA_FMExpression> pList);
+ ~CXFA_FMDoExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ std::unique_ptr<CXFA_FMExpression> m_pList;
+};
+
+class CXFA_FMIfExpression : public CXFA_FMExpression {
+ public:
+ CXFA_FMIfExpression(uint32_t line,
+ std::unique_ptr<CXFA_FMSimpleExpression> pExpression,
+ std::unique_ptr<CXFA_FMExpression> pIfExpression,
+ std::unique_ptr<CXFA_FMExpression> pElseExpression);
+ ~CXFA_FMIfExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ std::unique_ptr<CXFA_FMSimpleExpression> m_pExpression;
+ std::unique_ptr<CXFA_FMExpression> m_pIfExpression;
+ std::unique_ptr<CXFA_FMExpression> m_pElseExpression;
+};
+
+class CXFA_FMLoopExpression : public CXFA_FMExpression {
+ public:
+ explicit CXFA_FMLoopExpression(uint32_t line) : CXFA_FMExpression(line) {}
+ ~CXFA_FMLoopExpression() override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+};
+
+class CXFA_FMWhileExpression : public CXFA_FMLoopExpression {
+ public:
+ CXFA_FMWhileExpression(uint32_t line,
+ std::unique_ptr<CXFA_FMSimpleExpression> pCodition,
+ std::unique_ptr<CXFA_FMExpression> pExpression);
+ ~CXFA_FMWhileExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ std::unique_ptr<CXFA_FMSimpleExpression> m_pCondition;
+ std::unique_ptr<CXFA_FMExpression> m_pExpression;
+};
+
+class CXFA_FMBreakExpression : public CXFA_FMExpression {
+ public:
+ explicit CXFA_FMBreakExpression(uint32_t line);
+ ~CXFA_FMBreakExpression() override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+};
+
+class CXFA_FMContinueExpression : public CXFA_FMExpression {
+ public:
+ explicit CXFA_FMContinueExpression(uint32_t line);
+ ~CXFA_FMContinueExpression() override;
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+};
+
+class CXFA_FMForExpression : public CXFA_FMLoopExpression {
+ public:
+ CXFA_FMForExpression(uint32_t line,
+ const CFX_WideStringC& wsVariant,
+ std::unique_ptr<CXFA_FMSimpleExpression> pAssignment,
+ std::unique_ptr<CXFA_FMSimpleExpression> pAccessor,
+ int32_t iDirection,
+ std::unique_ptr<CXFA_FMSimpleExpression> pStep,
+ std::unique_ptr<CXFA_FMExpression> pList);
+ ~CXFA_FMForExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ CFX_WideStringC m_wsVariant;
+ std::unique_ptr<CXFA_FMSimpleExpression> m_pAssignment;
+ std::unique_ptr<CXFA_FMSimpleExpression> m_pAccessor;
+ const bool m_bDirection;
+ std::unique_ptr<CXFA_FMSimpleExpression> m_pStep;
+ std::unique_ptr<CXFA_FMExpression> m_pList;
+};
+
+class CXFA_FMForeachExpression : public CXFA_FMLoopExpression {
+ public:
+ // Takes ownership of |pAccessors|.
+ CXFA_FMForeachExpression(
+ uint32_t line,
+ const CFX_WideStringC& wsIdentifier,
+ std::vector<std::unique_ptr<CXFA_FMSimpleExpression>>&& pAccessors,
+ std::unique_ptr<CXFA_FMExpression> pList);
+ ~CXFA_FMForeachExpression() override;
+
+ bool ToJavaScript(CFX_WideTextBuf& javascript) override;
+ bool ToImpliedReturnJS(CFX_WideTextBuf&) override;
+
+ private:
+ CFX_WideStringC m_wsIdentifier;
+ std::vector<std::unique_ptr<CXFA_FMSimpleExpression>> m_pAccessors;
+ std::unique_ptr<CXFA_FMExpression> m_pList;
+};
+
+#endif // XFA_FXFA_FM2JS_CXFA_FMEXPRESSION_H_