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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 enum XFA_RESOVENODE_RSTYPE { | 29 enum XFA_RESOVENODE_RSTYPE { |
30 XFA_RESOVENODE_RSTYPE_Nodes, | 30 XFA_RESOVENODE_RSTYPE_Nodes, |
31 XFA_RESOVENODE_RSTYPE_Attribute, | 31 XFA_RESOVENODE_RSTYPE_Attribute, |
32 XFA_RESOLVENODE_RSTYPE_CreateNodeOne, | 32 XFA_RESOLVENODE_RSTYPE_CreateNodeOne, |
33 XFA_RESOLVENODE_RSTYPE_CreateNodeAll, | 33 XFA_RESOLVENODE_RSTYPE_CreateNodeAll, |
34 XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll, | 34 XFA_RESOLVENODE_RSTYPE_CreateNodeMidAll, |
35 XFA_RESOVENODE_RSTYPE_ExistNodes, | 35 XFA_RESOVENODE_RSTYPE_ExistNodes, |
36 }; | 36 }; |
37 | 37 |
38 class CXFA_HVALUEArray : public CFX_ArrayTemplate<FXJSE_HVALUE> { | 38 class CXFA_ValueArray : public CFX_ArrayTemplate<CFXJSE_Value*> { |
39 public: | 39 public: |
40 CXFA_HVALUEArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} | 40 CXFA_ValueArray(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} |
41 ~CXFA_HVALUEArray() { | 41 |
| 42 ~CXFA_ValueArray() { |
42 for (int32_t i = 0; i < GetSize(); i++) { | 43 for (int32_t i = 0; i < GetSize(); i++) { |
43 FXJSE_Value_Release(GetAt(i)); | 44 FXJSE_Value_Release(GetAt(i)); |
44 } | 45 } |
45 } | 46 } |
| 47 |
46 void GetAttributeObject(CXFA_ObjArray& objArray) { | 48 void GetAttributeObject(CXFA_ObjArray& objArray) { |
47 for (int32_t i = 0; i < GetSize(); i++) { | 49 for (int32_t i = 0; i < GetSize(); i++) { |
48 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i), NULL); | 50 CXFA_Object* pObject = (CXFA_Object*)FXJSE_Value_ToObject(GetAt(i), NULL); |
49 objArray.Add(pObject); | 51 objArray.Add(pObject); |
50 } | 52 } |
51 } | 53 } |
| 54 |
52 v8::Isolate* m_pIsolate; | 55 v8::Isolate* m_pIsolate; |
53 }; | 56 }; |
54 | 57 |
55 struct XFA_RESOLVENODE_RS { | 58 struct XFA_RESOLVENODE_RS { |
56 XFA_RESOLVENODE_RS() | 59 XFA_RESOLVENODE_RS() |
57 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} | 60 : dwFlags(XFA_RESOVENODE_RSTYPE_Nodes), pScriptAttribute(NULL) {} |
| 61 |
58 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } | 62 ~XFA_RESOLVENODE_RS() { nodes.RemoveAll(); } |
59 int32_t GetAttributeResult(CXFA_HVALUEArray& hValueArray) const { | 63 |
| 64 int32_t GetAttributeResult(CXFA_ValueArray& valueArray) const { |
60 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { | 65 if (pScriptAttribute && pScriptAttribute->eValueType == XFA_SCRIPT_Object) { |
61 v8::Isolate* pIsolate = hValueArray.m_pIsolate; | 66 v8::Isolate* pIsolate = valueArray.m_pIsolate; |
62 for (int32_t i = 0; i < nodes.GetSize(); i++) { | 67 for (int32_t i = 0; i < nodes.GetSize(); i++) { |
63 FXJSE_HVALUE hValue = FXJSE_Value_Create(pIsolate); | 68 CFXJSE_Value* pValue = FXJSE_Value_Create(pIsolate); |
64 (nodes[i]->*(pScriptAttribute->lpfnCallback))( | 69 (nodes[i]->*(pScriptAttribute->lpfnCallback))( |
65 hValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); | 70 pValue, FALSE, (XFA_ATTRIBUTE)pScriptAttribute->eAttribute); |
66 hValueArray.Add(hValue); | 71 valueArray.Add(pValue); |
67 } | 72 } |
68 } | 73 } |
69 return hValueArray.GetSize(); | 74 return valueArray.GetSize(); |
70 } | 75 } |
71 | 76 |
72 CXFA_ObjArray nodes; | 77 CXFA_ObjArray nodes; |
73 XFA_RESOVENODE_RSTYPE dwFlags; | 78 XFA_RESOVENODE_RSTYPE dwFlags; |
74 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; | 79 const XFA_SCRIPTATTRIBUTEINFO* pScriptAttribute; |
75 }; | 80 }; |
76 | 81 |
77 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ | 82 #endif // XFA_FXFA_PARSER_XFA_SCRIPT_H_ |
OLD | NEW |