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 FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ |
8 #define FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ | 8 #define FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "core/fxcrt/fx_basic.h" | 13 #include "core/fxcrt/fx_basic.h" |
14 #include "fpdfsdk/javascript/JS_KeyValue.h" | 14 #include "fpdfsdk/javascript/JS_KeyValue.h" |
15 | 15 |
16 class CPDFSDK_FormFillEnvironment; | 16 class CPDFSDK_FormFillEnvironment; |
17 | 17 |
18 class CJS_GlobalData_Element { | 18 class CJS_GlobalData_Element { |
19 public: | 19 public: |
20 CJS_GlobalData_Element() {} | 20 CJS_GlobalData_Element() {} |
21 ~CJS_GlobalData_Element() {} | 21 ~CJS_GlobalData_Element() {} |
22 | 22 |
23 CJS_KeyValue data; | 23 CJS_KeyValue data; |
24 FX_BOOL bPersistent; | 24 bool bPersistent; |
25 }; | 25 }; |
26 | 26 |
27 class CJS_GlobalData { | 27 class CJS_GlobalData { |
28 public: | 28 public: |
29 static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp); | 29 static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp); |
30 void Release(); | 30 void Release(); |
31 | 31 |
32 void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData); | 32 void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData); |
33 void SetGlobalVariableBoolean(const CFX_ByteString& propname, bool bData); | 33 void SetGlobalVariableBoolean(const CFX_ByteString& propname, bool bData); |
34 void SetGlobalVariableString(const CFX_ByteString& propname, | 34 void SetGlobalVariableString(const CFX_ByteString& propname, |
35 const CFX_ByteString& sData); | 35 const CFX_ByteString& sData); |
36 void SetGlobalVariableObject(const CFX_ByteString& propname, | 36 void SetGlobalVariableObject(const CFX_ByteString& propname, |
37 const CJS_GlobalVariableArray& array); | 37 const CJS_GlobalVariableArray& array); |
38 void SetGlobalVariableNull(const CFX_ByteString& propname); | 38 void SetGlobalVariableNull(const CFX_ByteString& propname); |
39 FX_BOOL SetGlobalVariablePersistent(const CFX_ByteString& propname, | 39 bool SetGlobalVariablePersistent(const CFX_ByteString& propname, |
40 FX_BOOL bPersistent); | 40 bool bPersistent); |
41 FX_BOOL DeleteGlobalVariable(const CFX_ByteString& propname); | 41 bool DeleteGlobalVariable(const CFX_ByteString& propname); |
42 | 42 |
43 int32_t GetSize() const; | 43 int32_t GetSize() const; |
44 CJS_GlobalData_Element* GetAt(int index) const; | 44 CJS_GlobalData_Element* GetAt(int index) const; |
45 | 45 |
46 private: | 46 private: |
47 using iterator = | 47 using iterator = |
48 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::iterator; | 48 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::iterator; |
49 using const_iterator = | 49 using const_iterator = |
50 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::const_iterator; | 50 std::vector<std::unique_ptr<CJS_GlobalData_Element>>::const_iterator; |
51 | 51 |
(...skipping 16 matching lines...) Expand all Loading... |
68 void MakeByteString(const CFX_ByteString& name, | 68 void MakeByteString(const CFX_ByteString& name, |
69 CJS_KeyValue* pData, | 69 CJS_KeyValue* pData, |
70 CFX_BinaryBuf& sData); | 70 CFX_BinaryBuf& sData); |
71 | 71 |
72 size_t m_RefCount; | 72 size_t m_RefCount; |
73 std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData; | 73 std::vector<std::unique_ptr<CJS_GlobalData_Element>> m_arrayGlobalData; |
74 CFX_WideString m_sFilePath; | 74 CFX_WideString m_sFilePath; |
75 }; | 75 }; |
76 | 76 |
77 #endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ | 77 #endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ |
OLD | NEW |