| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 CJS_PropValue(CJS_Runtime* pRuntime, const CJS_Value&); | 85 CJS_PropValue(CJS_Runtime* pRuntime, const CJS_Value&); |
| 86 ~CJS_PropValue(); | 86 ~CJS_PropValue(); |
| 87 | 87 |
| 88 void StartSetting() { m_bIsSetting = true; } | 88 void StartSetting() { m_bIsSetting = true; } |
| 89 void StartGetting() { m_bIsSetting = false; } | 89 void StartGetting() { m_bIsSetting = false; } |
| 90 bool IsSetting() const { return m_bIsSetting; } | 90 bool IsSetting() const { return m_bIsSetting; } |
| 91 bool IsGetting() const { return !m_bIsSetting; } | 91 bool IsGetting() const { return !m_bIsSetting; } |
| 92 CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; } | 92 CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; } |
| 93 CJS_Value* GetJSValue() { return &m_Value; } | 93 CJS_Value* GetJSValue() { return &m_Value; } |
| 94 | 94 |
| 95 // These calls may re-enter JS (and hence invalidate objects). |
| 95 void operator<<(int val); | 96 void operator<<(int val); |
| 96 void operator>>(int&) const; | 97 void operator>>(int&) const; |
| 97 void operator<<(bool val); | 98 void operator<<(bool val); |
| 98 void operator>>(bool&) const; | 99 void operator>>(bool&) const; |
| 99 void operator<<(double val); | 100 void operator<<(double val); |
| 100 void operator>>(double&) const; | 101 void operator>>(double&) const; |
| 101 void operator<<(CJS_Object* pObj); | 102 void operator<<(CJS_Object* pObj); |
| 102 void operator>>(CJS_Object*& ppObj) const; | 103 void operator>>(CJS_Object*& ppObj) const; |
| 103 void operator<<(CJS_Document* pJsDoc); | 104 void operator<<(CJS_Document* pJsDoc); |
| 104 void operator>>(CJS_Document*& ppJsDoc) const; | 105 void operator>>(CJS_Document*& ppJsDoc) const; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 120 CJS_Runtime* const m_pJSRuntime; | 121 CJS_Runtime* const m_pJSRuntime; |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 class CJS_Array { | 124 class CJS_Array { |
| 124 public: | 125 public: |
| 125 CJS_Array(); | 126 CJS_Array(); |
| 126 CJS_Array(const CJS_Array& other); | 127 CJS_Array(const CJS_Array& other); |
| 127 virtual ~CJS_Array(); | 128 virtual ~CJS_Array(); |
| 128 | 129 |
| 129 void Attach(v8::Local<v8::Array> pArray); | 130 void Attach(v8::Local<v8::Array> pArray); |
| 131 int GetLength(CJS_Runtime* pRuntime) const; |
| 132 |
| 133 // These two calls may re-enter JS (and hence invalidate objects). |
| 130 void GetElement(CJS_Runtime* pRuntime, | 134 void GetElement(CJS_Runtime* pRuntime, |
| 131 unsigned index, | 135 unsigned index, |
| 132 CJS_Value& value) const; | 136 CJS_Value& value) const; |
| 133 void SetElement(CJS_Runtime* pRuntime, | 137 void SetElement(CJS_Runtime* pRuntime, |
| 134 unsigned index, | 138 unsigned index, |
| 135 const CJS_Value& value); | 139 const CJS_Value& value); |
| 136 int GetLength(CJS_Runtime* pRuntime) const; | |
| 137 | 140 |
| 138 v8::Local<v8::Array> ToV8Array(CJS_Runtime* pRuntime) const; | 141 v8::Local<v8::Array> ToV8Array(CJS_Runtime* pRuntime) const; |
| 139 | 142 |
| 140 private: | 143 private: |
| 141 mutable v8::Local<v8::Array> m_pArray; | 144 mutable v8::Local<v8::Array> m_pArray; |
| 142 }; | 145 }; |
| 143 | 146 |
| 144 class CJS_Date { | 147 class CJS_Date { |
| 145 public: | 148 public: |
| 146 CJS_Date(); | 149 CJS_Date(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // names as wchar_t string literals corresponding to each positional argument. | 206 // names as wchar_t string literals corresponding to each positional argument. |
| 204 // The result will always contain |nKeywords| value, with unspecified ones | 207 // The result will always contain |nKeywords| value, with unspecified ones |
| 205 // being set to type VT_unknown. | 208 // being set to type VT_unknown. |
| 206 std::vector<CJS_Value> JS_ExpandKeywordParams( | 209 std::vector<CJS_Value> JS_ExpandKeywordParams( |
| 207 CJS_Runtime* pRuntime, | 210 CJS_Runtime* pRuntime, |
| 208 const std::vector<CJS_Value>& originals, | 211 const std::vector<CJS_Value>& originals, |
| 209 size_t nKeywords, | 212 size_t nKeywords, |
| 210 ...); | 213 ...); |
| 211 | 214 |
| 212 #endif // FPDFSDK_JAVASCRIPT_JS_VALUE_H_ | 215 #endif // FPDFSDK_JAVASCRIPT_JS_VALUE_H_ |
| OLD | NEW |