| 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 "fxjse/include/cfxjse_value.h" | 10 #include "fxjse/include/cfxjse_value.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 enum XFA_RESOVENODE_RSTYPE { | 31 enum XFA_RESOVENODE_RSTYPE { |
| 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 ~XFA_RESOLVENODE_RS(); |
| 43 | |
| 44 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } | |
| 45 | 43 |
| 46 int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { | 44 int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { |
| 47 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { | 45 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { |
| 48 v8::Isolate* pIsolate = valueArray.m_pIsolate; | 46 v8::Isolate* pIsolate = valueArray.m_pIsolate; |
| 49 for (int32_t i = 0; i < nodes.GetSize(); i++) { | 47 for (int32_t i = 0; i < nodes.GetSize(); i++) { |
| 50 std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(pIsolate)); | 48 std::unique_ptr<CFXJSE_Value> pValue(new CFXJSE_Value(pIsolate)); |
| 51 (nodes[i]->*(pScriptAttribute->lpfnCallback))( | 49 (nodes[i]->*(pScriptAttribute->lpfnCallback))( |
| 52 pValue.get(), FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); | 50 pValue.get(), FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); |
| 53 valueArray.Add(pValue.release()); | 51 valueArray.Add(pValue.release()); |
| 54 } | 52 } |
| 55 } | 53 } |
| 56 return valueArray.GetSize(); | 54 return valueArray.GetSize(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 CXFA_ObjArray nodes; | 57 CXFA_ObjArray nodes; |
| 60 XFA_RESOVENODE_RSTYPE dwFlags; | 58 XFA_RESOVENODE_RSTYPE dwFlags; |
| 61 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; | 59 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; |
| 62 }; | 60 }; |
| 63 | 61 |
| 62 inline XFA_RESOLVENODE_RS::XFA_RESOLVENODE_RS() |
| 63 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} |
| 64 |
| 65 inline XFA_RESOLVENODE_RS::~XFA_RESOLVENODE_RS() { |
| 66 nodes.RemoveAll(); |
| 67 } |
| 64 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ | 68 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
| OLD | NEW |