| 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 #include "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
| 8 #include "../../include/javascript/JS_Define.h" | 8 #include "../../include/javascript/JS_Define.h" |
| 9 #include "../../include/javascript/JS_Object.h" | 9 #include "../../include/javascript/JS_Object.h" |
| 10 #include "../../include/javascript/JS_Value.h" | 10 #include "../../include/javascript/JS_Value.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 operator =(pJsObj); | 50 operator =(pJsObj); |
| 51 } | 51 } |
| 52 | 52 |
| 53 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc):m_isolate(isola
te) | 53 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Document* pJsDoc):m_isolate(isola
te) |
| 54 { | 54 { |
| 55 m_eType = VT_object; | 55 m_eType = VT_object; |
| 56 if (pJsDoc) | 56 if (pJsDoc) |
| 57 m_pValue = (JSFXObject)*pJsDoc; | 57 m_pValue = (JSFXObject)*pJsDoc; |
| 58 } | 58 } |
| 59 | 59 |
| 60 CJS_Value::CJS_Value(v8::Isolate* isolate, FX_LPCWSTR pWstr):m_isolate(isolate) | 60 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr):m_isolate(isol
ate) |
| 61 { | 61 { |
| 62 operator =(pWstr); | 62 operator =(pWstr); |
| 63 } | 63 } |
| 64 | 64 |
| 65 CJS_Value::CJS_Value(v8::Isolate* isolate, FX_LPCSTR pStr):m_isolate(isolate) | 65 CJS_Value::CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr):m_isolate(isolat
e) |
| 66 { | 66 { |
| 67 operator = (pStr); | 67 operator = (pStr); |
| 68 } | 68 } |
| 69 | 69 |
| 70 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Array& array):m_isolate(isolate) | 70 CJS_Value::CJS_Value(v8::Isolate* isolate, CJS_Array& array):m_isolate(isolate) |
| 71 { | 71 { |
| 72 operator = (array); | 72 operator = (array); |
| 73 } | 73 } |
| 74 | 74 |
| 75 CJS_Value::~CJS_Value() | 75 CJS_Value::~CJS_Value() |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 void CJS_Value::operator = (CJS_Document* pJsDoc) | 195 void CJS_Value::operator = (CJS_Document* pJsDoc) |
| 196 { | 196 { |
| 197 m_eType = VT_object; | 197 m_eType = VT_object; |
| 198 if (pJsDoc) { | 198 if (pJsDoc) { |
| 199 m_pValue = static_cast<JSFXObject>(*pJsDoc); | 199 m_pValue = static_cast<JSFXObject>(*pJsDoc); |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 | 202 |
| 203 void CJS_Value::operator =(FX_LPCWSTR pWstr) | 203 void CJS_Value::operator =(const FX_WCHAR* pWstr) |
| 204 { | 204 { |
| 205 m_pValue = JS_NewString(m_isolate,(wchar_t *)pWstr); | 205 m_pValue = JS_NewString(m_isolate,(wchar_t *)pWstr); |
| 206 | 206 |
| 207 m_eType = VT_string; | 207 m_eType = VT_string; |
| 208 } | 208 } |
| 209 | 209 |
| 210 void CJS_Value::SetNull() | 210 void CJS_Value::SetNull() |
| 211 { | 211 { |
| 212 m_pValue = JS_NewNull(); | 212 m_pValue = JS_NewNull(); |
| 213 | 213 |
| 214 m_eType = VT_null; | 214 m_eType = VT_null; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void CJS_Value::operator = (FX_LPCSTR pStr) | 217 void CJS_Value::operator = (const FX_CHAR* pStr) |
| 218 { | 218 { |
| 219 operator = (CFX_WideString::FromLocal(pStr).c_str()); | 219 operator = (CFX_WideString::FromLocal(pStr).c_str()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void CJS_Value::operator = (CJS_Array & array) | 222 void CJS_Value::operator = (CJS_Array & array) |
| 223 { | 223 { |
| 224 m_pValue = JS_NewObject2(m_isolate,(v8::Local<v8::Array>)array); | 224 m_pValue = JS_NewObject2(m_isolate,(v8::Local<v8::Array>)array); |
| 225 | 225 |
| 226 m_eType = VT_object; | 226 m_eType = VT_object; |
| 227 } | 227 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 ASSERT(!m_bIsSetting); | 412 ASSERT(!m_bIsSetting); |
| 413 CJS_Value::operator = (string.c_str()); | 413 CJS_Value::operator = (string.c_str()); |
| 414 } | 414 } |
| 415 | 415 |
| 416 void CJS_PropValue::operator >>(CFX_ByteString &string) const | 416 void CJS_PropValue::operator >>(CFX_ByteString &string) const |
| 417 { | 417 { |
| 418 ASSERT(m_bIsSetting); | 418 ASSERT(m_bIsSetting); |
| 419 string = CJS_Value::ToCFXByteString(); | 419 string = CJS_Value::ToCFXByteString(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void CJS_PropValue::operator <<(FX_LPCWSTR c_string) | 422 void CJS_PropValue::operator <<(const FX_WCHAR* c_string) |
| 423 { | 423 { |
| 424 ASSERT(!m_bIsSetting); | 424 ASSERT(!m_bIsSetting); |
| 425 CJS_Value::operator =(c_string); | 425 CJS_Value::operator =(c_string); |
| 426 } | 426 } |
| 427 | 427 |
| 428 void CJS_PropValue::operator >>(CFX_WideString &wide_string) const | 428 void CJS_PropValue::operator >>(CFX_WideString &wide_string) const |
| 429 { | 429 { |
| 430 ASSERT(m_bIsSetting); | 430 ASSERT(m_bIsSetting); |
| 431 wide_string = CJS_Value::ToCFXWideString(); | 431 wide_string = CJS_Value::ToCFXWideString(); |
| 432 } | 432 } |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 return 0.0; | 653 return 0.0; |
| 654 return JS_ToNumber(m_isolate, m_pDate); | 654 return JS_ToNumber(m_isolate, m_pDate); |
| 655 } | 655 } |
| 656 | 656 |
| 657 CFX_WideString CJS_Date::ToString() const | 657 CFX_WideString CJS_Date::ToString() const |
| 658 { | 658 { |
| 659 if(m_pDate.IsEmpty()) | 659 if(m_pDate.IsEmpty()) |
| 660 return L""; | 660 return L""; |
| 661 return JS_ToString(m_isolate, m_pDate); | 661 return JS_ToString(m_isolate, m_pDate); |
| 662 } | 662 } |
| OLD | NEW |