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_VALUE_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_JS_VALUE_H_ |
8 #define FPDFSDK_JAVASCRIPT_JS_VALUE_H_ | 8 #define FPDFSDK_JAVASCRIPT_JS_VALUE_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 explicit CJS_Value(CJS_Runtime* pRuntime); | 34 explicit CJS_Value(CJS_Runtime* pRuntime); |
35 CJS_Value(CJS_Runtime* pRuntime, v8::Local<v8::Value> pValue); | 35 CJS_Value(CJS_Runtime* pRuntime, v8::Local<v8::Value> pValue); |
36 CJS_Value(CJS_Runtime* pRuntime, const int& iValue); | 36 CJS_Value(CJS_Runtime* pRuntime, const int& iValue); |
37 CJS_Value(CJS_Runtime* pRuntime, const double& dValue); | 37 CJS_Value(CJS_Runtime* pRuntime, const double& dValue); |
38 CJS_Value(CJS_Runtime* pRuntime, const float& fValue); | 38 CJS_Value(CJS_Runtime* pRuntime, const float& fValue); |
39 CJS_Value(CJS_Runtime* pRuntime, const bool& bValue); | 39 CJS_Value(CJS_Runtime* pRuntime, const bool& bValue); |
40 CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj); | 40 CJS_Value(CJS_Runtime* pRuntime, CJS_Object* pObj); |
41 CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr); | 41 CJS_Value(CJS_Runtime* pRuntime, const FX_CHAR* pStr); |
42 CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr); | 42 CJS_Value(CJS_Runtime* pRuntime, const FX_WCHAR* pWstr); |
43 CJS_Value(CJS_Runtime* pRuntime, CJS_Array& array); | 43 CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array); |
44 CJS_Value(const CJS_Value& other); | 44 CJS_Value(const CJS_Value& other); |
45 | 45 |
46 ~CJS_Value(); | 46 ~CJS_Value(); |
47 | 47 |
48 void SetNull(); | 48 void SetNull(); |
49 void Attach(v8::Local<v8::Value> pValue); | 49 void Attach(v8::Local<v8::Value> pValue); |
50 void Detach(); | 50 void Detach(); |
51 | 51 |
52 static Type GetValueType(v8::Local<v8::Value> value); | 52 static Type GetValueType(v8::Local<v8::Value> value); |
53 Type GetType() const { return GetValueType(m_pValue); } | 53 Type GetType() const { return GetValueType(m_pValue); } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void operator<<(CJS_Array& array); | 122 void operator<<(CJS_Array& array); |
123 void operator<<(CJS_Date& date); | 123 void operator<<(CJS_Date& date); |
124 void operator>>(CJS_Date& date) const; | 124 void operator>>(CJS_Date& date) const; |
125 | 125 |
126 private: | 126 private: |
127 bool m_bIsSetting; | 127 bool m_bIsSetting; |
128 }; | 128 }; |
129 | 129 |
130 class CJS_Array { | 130 class CJS_Array { |
131 public: | 131 public: |
132 explicit CJS_Array(CJS_Runtime* pRuntime); | 132 CJS_Array(); |
133 CJS_Array(const CJS_Array& other); | 133 CJS_Array(const CJS_Array& other); |
134 virtual ~CJS_Array(); | 134 virtual ~CJS_Array(); |
135 | 135 |
136 void Attach(v8::Local<v8::Array> pArray); | 136 void Attach(v8::Local<v8::Array> pArray); |
137 void GetElement(unsigned index, CJS_Value& value) const; | 137 void GetElement(v8::Isolate* pIsolate, |
138 void SetElement(unsigned index, CJS_Value value); | 138 unsigned index, |
| 139 CJS_Value& value) const; |
| 140 void SetElement(v8::Isolate* pIsolate, |
| 141 unsigned index, |
| 142 const CJS_Value& value); |
139 int GetLength() const; | 143 int GetLength() const; |
140 | 144 |
141 v8::Local<v8::Array> ToV8Array() const; | 145 v8::Local<v8::Array> ToV8Array(v8::Isolate* pIsolate) const; |
142 CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; } | |
143 | 146 |
144 private: | 147 private: |
145 mutable v8::Local<v8::Array> m_pArray; | 148 mutable v8::Local<v8::Array> m_pArray; |
146 CJS_Runtime* const m_pJSRuntime; | |
147 }; | 149 }; |
148 | 150 |
149 class CJS_Date { | 151 class CJS_Date { |
150 public: | 152 public: |
151 explicit CJS_Date(CJS_Runtime* pRuntime); | 153 explicit CJS_Date(CJS_Runtime* pRuntime); |
152 CJS_Date(CJS_Runtime* pRuntime, double dMsec_time); | 154 CJS_Date(CJS_Runtime* pRuntime, double dMsec_time); |
153 CJS_Date(CJS_Runtime* pRuntime, | 155 CJS_Date(CJS_Runtime* pRuntime, |
154 int year, | 156 int year, |
155 int mon, | 157 int mon, |
156 int day, | 158 int day, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // names as wchar_t string literals corresponding to each positional argument. | 212 // names as wchar_t string literals corresponding to each positional argument. |
211 // The result will always contain |nKeywords| value, with unspecified ones | 213 // The result will always contain |nKeywords| value, with unspecified ones |
212 // being set to type VT_unknown. | 214 // being set to type VT_unknown. |
213 std::vector<CJS_Value> JS_ExpandKeywordParams( | 215 std::vector<CJS_Value> JS_ExpandKeywordParams( |
214 CJS_Runtime* pRuntime, | 216 CJS_Runtime* pRuntime, |
215 const std::vector<CJS_Value>& originals, | 217 const std::vector<CJS_Value>& originals, |
216 size_t nKeywords, | 218 size_t nKeywords, |
217 ...); | 219 ...); |
218 | 220 |
219 #endif // FPDFSDK_JAVASCRIPT_JS_VALUE_H_ | 221 #endif // FPDFSDK_JAVASCRIPT_JS_VALUE_H_ |
OLD | NEW |