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_SRC_JAVASCRIPT_JS_VALUE_H_ | 7 #ifndef FPDFSDK_SRC_JAVASCRIPT_JS_VALUE_H_ |
8 #define FPDFSDK_SRC_JAVASCRIPT_JS_VALUE_H_ | 8 #define FPDFSDK_SRC_JAVASCRIPT_JS_VALUE_H_ |
9 | 9 |
10 #include "core/include/fxcrt/fx_basic.h" | 10 #include "core/include/fxcrt/fx_basic.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 v8::Local<v8::Array> ToV8Array() const; | 62 v8::Local<v8::Array> ToV8Array() const; |
63 v8::Local<v8::Value> ToV8Value() const; | 63 v8::Local<v8::Value> ToV8Value() const; |
64 | 64 |
65 // Replace the current |m_pValue| with a v8::Number if possible | 65 // Replace the current |m_pValue| with a v8::Number if possible |
66 // to make one from the current |m_pValue|, updating |m_eType| | 66 // to make one from the current |m_pValue|, updating |m_eType| |
67 // as appropriate to indicate the result. | 67 // as appropriate to indicate the result. |
68 void MaybeCoerceToNumber(); | 68 void MaybeCoerceToNumber(); |
69 | 69 |
70 void operator=(int iValue); | 70 void operator=(int iValue); |
71 void operator=(bool bValue); | 71 void operator=(bool bValue); |
72 void operator=(double); | 72 void operator=(double val); |
73 void operator=(float); | 73 void operator=(float val); |
74 void operator=(CJS_Object*); | 74 void operator=(CJS_Object* val); |
75 void operator=(CJS_Document*); | 75 void operator=(CJS_Document* val); |
76 void operator=(v8::Local<v8::Object>); | 76 void operator=(v8::Local<v8::Object> val); |
77 void operator=(CJS_Array&); | 77 void operator=(CJS_Array& val); |
78 void operator=(CJS_Date&); | 78 void operator=(CJS_Date& val); |
79 void operator=(const FX_WCHAR* pWstr); | 79 void operator=(const FX_WCHAR* pWstr); |
80 void operator=(const FX_CHAR* pStr); | 80 void operator=(const FX_CHAR* pStr); |
81 void operator=(CJS_Value value); | 81 void operator=(CJS_Value value); |
82 | 82 |
83 FX_BOOL IsArrayObject() const; | 83 FX_BOOL IsArrayObject() const; |
84 FX_BOOL IsDateObject() const; | 84 FX_BOOL IsDateObject() const; |
85 FX_BOOL ConvertToArray(CJS_Array&) const; | 85 FX_BOOL ConvertToArray(CJS_Array&) const; |
86 FX_BOOL ConvertToDate(CJS_Date&) const; | 86 FX_BOOL ConvertToDate(CJS_Date&) const; |
87 | 87 |
88 CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; } | 88 CJS_Runtime* GetJSRuntime() const { return m_pJSRuntime; } |
89 | 89 |
90 protected: | 90 protected: |
91 Type m_eType; | 91 Type m_eType; |
92 v8::Local<v8::Value> m_pValue; | 92 v8::Local<v8::Value> m_pValue; |
93 CJS_Runtime* m_pJSRuntime; | 93 CJS_Runtime* m_pJSRuntime; |
94 }; | 94 }; |
95 | 95 |
96 class CJS_PropValue : public CJS_Value { | 96 class CJS_PropValue : public CJS_Value { |
97 public: | 97 public: |
98 CJS_PropValue(const CJS_Value&); | 98 CJS_PropValue(const CJS_Value&); |
99 CJS_PropValue(CJS_Runtime* pRuntime); | 99 CJS_PropValue(CJS_Runtime* pRuntime); |
100 ~CJS_PropValue(); | 100 ~CJS_PropValue(); |
101 | 101 |
102 FX_BOOL IsSetting() const { return m_bIsSetting; } | 102 FX_BOOL IsSetting() const { return m_bIsSetting; } |
103 FX_BOOL IsGetting() const { return !m_bIsSetting; } | 103 FX_BOOL IsGetting() const { return !m_bIsSetting; } |
104 | 104 |
105 void operator<<(int); | 105 void operator<<(int val); |
106 void operator>>(int&) const; | 106 void operator>>(int&) const; |
107 void operator<<(bool); | 107 void operator<<(bool val); |
108 void operator>>(bool&) const; | 108 void operator>>(bool&) const; |
109 void operator<<(double); | 109 void operator<<(double val); |
110 void operator>>(double&) const; | 110 void operator>>(double&) const; |
111 void operator<<(CJS_Object* pObj); | 111 void operator<<(CJS_Object* pObj); |
112 void operator>>(CJS_Object*& ppObj) const; | 112 void operator>>(CJS_Object*& ppObj) const; |
113 void operator<<(CJS_Document* pJsDoc); | 113 void operator<<(CJS_Document* pJsDoc); |
114 void operator>>(CJS_Document*& ppJsDoc) const; | 114 void operator>>(CJS_Document*& ppJsDoc) const; |
115 void operator<<(CFX_ByteString); | 115 void operator<<(CFX_ByteString); |
116 void operator>>(CFX_ByteString&) const; | 116 void operator>>(CFX_ByteString&) const; |
117 void operator<<(CFX_WideString); | 117 void operator<<(CFX_WideString); |
118 void operator>>(CFX_WideString&) const; | 118 void operator>>(CFX_WideString&) const; |
119 void operator<<(const FX_WCHAR* c_string); | 119 void operator<<(const FX_WCHAR* c_string); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // names as wchar_t string literals corresponding to each positional argument. | 219 // names as wchar_t string literals corresponding to each positional argument. |
220 // The result will always contain |nKeywords| value, with unspecified ones | 220 // The result will always contain |nKeywords| value, with unspecified ones |
221 // being set to type VT_unknown. | 221 // being set to type VT_unknown. |
222 std::vector<CJS_Value> JS_ExpandKeywordParams( | 222 std::vector<CJS_Value> JS_ExpandKeywordParams( |
223 CJS_Runtime* pRuntime, | 223 CJS_Runtime* pRuntime, |
224 const std::vector<CJS_Value>& originals, | 224 const std::vector<CJS_Value>& originals, |
225 size_t nKeywords, | 225 size_t nKeywords, |
226 ...); | 226 ...); |
227 | 227 |
228 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_VALUE_H_ | 228 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_VALUE_H_ |
OLD | NEW |