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_PARSER_XFA_SCRIPT_H_ | 7 #ifndef XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
8 #define XFA_FXFA_PARSER_XFA_SCRIPT_H_ | 8 #define XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
9 | 9 |
10 #include "xfa/fxfa/include/fxfa.h" | 10 #include "xfa/fxfa/include/fxfa.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 XFA_RESOVENODE_RSTYPE_Nodes, | 32 XFA_RESOVENODE_RSTYPE_Nodes, |
33 XFA_RESOVENODE_RSTYPE_Attribute, | 33 XFA_RESOVENODE_RSTYPE_Attribute, |
34 XFA_RESOLVENODE_RSTYPE_CreateNodeOne, | 34 XFA_RESOLVENODE_RSTYPE_CreateNodeOne, |
35 XFA_RESOLVENODE_RSTYPE_CreateNodeAll, | 35 XFA_RESOLVENODE_RSTYPE_CreateNodeAll, |
36 XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll, | 36 XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll, |
37 XFA_RESOVENODE_RSTYPE_ExistNodes, | 37 XFA_RESOVENODE_RSTYPE_ExistNodes, |
38 }; | 38 }; |
39 | 39 |
40 struct XFA_RESOLVENODE_RS { | 40 struct XFA_RESOLVENODE_RS { |
41 XFA_RESOLVENODE_RS() | 41 XFA_RESOLVENODE_RS() |
42 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} | 42 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(nullptr) {} |
43 | 43 |
44 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } | 44 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } |
45 | 45 |
46 int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { | 46 int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { |
47 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { | 47 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { |
48 v8::Isolate* pIsolate = valueArray.m_pIsolate; | 48 v8::Isolate* pIsolate = valueArray.m_pIsolate; |
49 for (int32_t i = 0; i < nodes.GetSize(); i++) { | 49 for (int32_t i = 0; i < nodes.GetSize(); i++) { |
50 std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(pIsolate)); | 50 std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(pIsolate)); |
51 (nodes[i]->*(pScriptAttribute->lpfnCallback))( | 51 (nodes[i]->*(pScriptAttribute->lpfnCallback))( |
52 pValue.get(), FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); | 52 pValue.get(), FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); |
53 valueArray.Add(pValue.release()); | 53 valueArray.Add(pValue.release()); |
54 } | 54 } |
55 } | 55 } |
56 return valueArray.GetSize(); | 56 return valueArray.GetSize(); |
57 } | 57 } |
58 | 58 |
59 CXFA_ObjArray nodes; | 59 CXFA_ObjArray nodes; |
60 XFA_RESOVENODE_RSTYPE dwFlags; | 60 XFA_RESOVENODE_RSTYPE dwFlags; |
61 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; | 61 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; |
62 }; | 62 }; |
63 | 63 |
64 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ | 64 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
OLD | NEW |