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 _JS_VALUE_H_ | 7 #ifndef _JS_VALUE_H_ |
8 #define _JS_VALUE_H_ | 8 #define _JS_VALUE_H_ |
9 | 9 |
10 class CJS_Array; | 10 class CJS_Array; |
11 class CJS_Date; | 11 class CJS_Date; |
| 12 class CJS_Document; |
| 13 class CJS_Object; |
12 | 14 |
13 class CJS_Value | 15 class CJS_Value |
14 { | 16 { |
15 public: | 17 public: |
16 CJS_Value(v8::Isolate* isolate); | 18 CJS_Value(v8::Isolate* isolate); |
17 CJS_Value(v8::Isolate* isolate, v8::Handle<v8::Value> pValue,FXJSVALUETY
PE t); | 19 CJS_Value(v8::Isolate* isolate, v8::Handle<v8::Value> pValue,FXJSVALUETY
PE t); |
18 CJS_Value(v8::Isolate* isolate, const int &iValue); | 20 CJS_Value(v8::Isolate* isolate, const int &iValue); |
19 CJS_Value(v8::Isolate* isolate, const double &dValue); | 21 CJS_Value(v8::Isolate* isolate, const double &dValue); |
20 » CJS_Value(v8::Isolate* isolate, const float &fValue);» | 22 » CJS_Value(v8::Isolate* isolate, const float &fValue); |
21 CJS_Value(v8::Isolate* isolate, const bool &bValue); | 23 CJS_Value(v8::Isolate* isolate, const bool &bValue); |
22 CJS_Value(v8::Isolate* isolate, JSFXObject); | 24 CJS_Value(v8::Isolate* isolate, JSFXObject); |
23 CJS_Value(v8::Isolate* isolate, CJS_Object *); | 25 CJS_Value(v8::Isolate* isolate, CJS_Object *); |
| 26 CJS_Value(v8::Isolate* isolate, CJS_Document *); |
24 CJS_Value(v8::Isolate* isolate, FX_LPCSTR pStr); | 27 CJS_Value(v8::Isolate* isolate, FX_LPCSTR pStr); |
25 CJS_Value(v8::Isolate* isolate, FX_LPCWSTR pWstr); | 28 CJS_Value(v8::Isolate* isolate, FX_LPCWSTR pWstr); |
26 CJS_Value(v8::Isolate* isolate, CJS_Array& array); | 29 CJS_Value(v8::Isolate* isolate, CJS_Array& array); |
27 » | 30 |
28 ~CJS_Value(); | 31 ~CJS_Value(); |
29 | 32 |
30 void SetNull(); | 33 void SetNull(); |
31 void Attach(v8::Handle<v8::Value> pValue,FXJSVALUETYPE t); | 34 void Attach(v8::Handle<v8::Value> pValue,FXJSVALUETYPE t); |
32 void Attach(CJS_Value *pValue); | 35 void Attach(CJS_Value *pValue); |
33 void Detach(); | 36 void Detach(); |
34 | 37 |
35 | 38 |
36 operator int() const; | 39 operator int() const; |
37 operator bool() const; | 40 operator bool() const; |
38 operator double() const; | 41 operator double() const; |
39 operator float() const; | 42 operator float() const; |
40 operator CJS_Object *() const; | 43 operator CJS_Object *() const; |
41 //operator JSFXObject *() const; | |
42 operator v8::Handle<v8::Object>() const; | 44 operator v8::Handle<v8::Object>() const; |
43 operator v8::Handle<v8::Array>() const; | 45 operator v8::Handle<v8::Array>() const; |
44 operator CFX_WideString() const; | 46 operator CFX_WideString() const; |
45 //operator FX_WCHAR *() const; | |
46 operator CFX_ByteString() const; | 47 operator CFX_ByteString() const; |
47 v8::Handle<v8::Value> ToJSValue(); | 48 v8::Handle<v8::Value> ToJSValue(); |
48 | 49 |
49 void operator = (int iValue); | 50 void operator = (int iValue); |
50 » void operator = (bool bValue);» | 51 » void operator = (bool bValue); |
51 » void operator = (double);» | 52 » void operator = (double); |
52 » void operator = (float);» | 53 » void operator = (float); |
53 » void operator = (CJS_Object *);» | 54 » void operator = (CJS_Object *); |
54 void operator = (v8::Handle<v8::Object>); | 55 void operator = (v8::Handle<v8::Object>); |
55 // void operator = (JSObject *); | |
56 void operator = (CJS_Array &); | 56 void operator = (CJS_Array &); |
57 void operator = (CJS_Date &); | 57 void operator = (CJS_Date &); |
58 » void operator = (FX_LPCWSTR pWstr);» | 58 » void operator = (FX_LPCWSTR pWstr); |
59 » void operator = (FX_LPCSTR pStr);» | 59 » void operator = (FX_LPCSTR pStr); |
60 void operator = (CJS_Value value); | 60 void operator = (CJS_Value value); |
61 » | 61 |
62 FX_BOOL IsArrayObject() const; | 62 FX_BOOL IsArrayObject() const; |
63 FX_BOOL IsDateObject() const; | 63 FX_BOOL IsDateObject() const; |
64 FXJSVALUETYPE GetType() const; | 64 FXJSVALUETYPE GetType() const; |
65 | 65 |
66 FX_BOOL ConvertToArray(CJS_Array &) const; | 66 FX_BOOL ConvertToArray(CJS_Array &) const; |
67 FX_BOOL ConvertToDate(CJS_Date &) const; | 67 FX_BOOL ConvertToDate(CJS_Date &) const; |
68 | 68 |
69 v8::Isolate* GetIsolate() {return m_isolate;} | 69 v8::Isolate* GetIsolate() {return m_isolate;} |
70 protected:» | 70 protected: |
71 v8::Handle<v8::Value> m_pValue; | 71 v8::Handle<v8::Value> m_pValue; |
72 FXJSVALUETYPE m_eType; | 72 FXJSVALUETYPE m_eType; |
73 v8::Isolate* m_isolate; | 73 v8::Isolate* m_isolate; |
74 }; | 74 }; |
75 | 75 |
76 template<class TYPE> class CJS_ParametersTmpl : public CFX_ArrayTemplate<TYPE> | 76 template<class TYPE> class CJS_ParametersTmpl : public CFX_ArrayTemplate<TYPE> |
77 { | 77 { |
78 public: | 78 public: |
79 void push_back(TYPE newElement){CFX_ArrayTemplate<TYPE>::Add(newElement)
;} | 79 void push_back(TYPE newElement){CFX_ArrayTemplate<TYPE>::Add(newElement)
;} |
80 int size() const{return CFX_ArrayTemplate<TYPE>::GetSize();} | 80 int size() const{return CFX_ArrayTemplate<TYPE>::GetSize();} |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 FX_BOOL IsValidDate(); | 178 FX_BOOL IsValidDate(); |
179 | 179 |
180 protected: | 180 protected: |
181 v8::Handle<v8::Value> m_pDate; | 181 v8::Handle<v8::Value> m_pDate; |
182 v8::Isolate* m_isolate; | 182 v8::Isolate* m_isolate; |
183 }; | 183 }; |
184 | 184 |
185 #endif //_JS_VALUE_H_ | 185 #endif //_JS_VALUE_H_ |
186 | 186 |
OLD | NEW |