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_DEFINE_H_ | 7 #ifndef _JS_DEFINE_H_ |
8 #define _JS_DEFINE_H_ | 8 #define _JS_DEFINE_H_ |
9 | 9 |
10 typedef v8::Value JSValue; | 10 typedef v8::Value JSValue; |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 #define VALUE_NAME_DATE L"date" | 641 #define VALUE_NAME_DATE L"date" |
642 #define VALUE_NAME_OBJECT L"object" | 642 #define VALUE_NAME_OBJECT L"object" |
643 #define VALUE_NAME_FXOBJ L"fxobj" | 643 #define VALUE_NAME_FXOBJ L"fxobj" |
644 #define VALUE_NAME_NULL L"null" | 644 #define VALUE_NAME_NULL L"null" |
645 #define VALUE_NAME_UNDEFINED L"undefined" | 645 #define VALUE_NAME_UNDEFINED L"undefined" |
646 | 646 |
647 #define CLASSNAME_ARRAY L"Array" | 647 #define CLASSNAME_ARRAY L"Array" |
648 #define CLASSNAME_DATE L"Date" | 648 #define CLASSNAME_DATE L"Date" |
649 #define CLASSNAME_STRING L"v8::String" | 649 #define CLASSNAME_STRING L"v8::String" |
650 | 650 |
651 const unsigned int JSCONST_nStringHash = JS_CalcHash(VALUE_NAME_STRING,wcslen(VA
LUE_NAME_STRING)); | 651 extern const unsigned int JSCONST_nStringHash; |
652 const unsigned int JSCONST_nNumberHash = JS_CalcHash(VALUE_NAME_NUMBER,wcslen(VA
LUE_NAME_NUMBER)); | 652 extern const unsigned int JSCONST_nNumberHash; |
653 const unsigned int JSCONST_nBoolHash = JS_CalcHash(VALUE_NAME_BOOLEAN,wcslen(VAL
UE_NAME_BOOLEAN)); | 653 extern const unsigned int JSCONST_nBoolHash; |
654 const unsigned int JSCONST_nDateHash = JS_CalcHash(VALUE_NAME_DATE,wcslen(VALUE_
NAME_DATE)); | 654 extern const unsigned int JSCONST_nDateHash; |
655 const unsigned int JSCONST_nObjectHash = JS_CalcHash(VALUE_NAME_OBJECT,wcslen(VA
LUE_NAME_OBJECT)); | 655 extern const unsigned int JSCONST_nObjectHash; |
656 const unsigned int JSCONST_nFXobjHash = JS_CalcHash(VALUE_NAME_FXOBJ,wcslen(VALU
E_NAME_FXOBJ)); | 656 extern const unsigned int JSCONST_nFXobjHash; |
657 const unsigned int JSCONST_nNullHash = JS_CalcHash(VALUE_NAME_NULL,wcslen(VALUE_
NAME_NULL)); | 657 extern const unsigned int JSCONST_nNullHash; |
658 const unsigned int JSCONST_nUndefHash = JS_CalcHash(VALUE_NAME_UNDEFINED,wcslen(
VALUE_NAME_UNDEFINED)); | 658 extern const unsigned int JSCONST_nUndefHash; |
659 | 659 |
660 static FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p) | 660 static FXJSVALUETYPE GET_VALUE_TYPE(v8::Handle<v8::Value> p) |
661 { | 661 { |
662 | 662 |
663 const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p)); | 663 const unsigned int nHash = JS_CalcHash(JS_GetTypeof(p)); |
664 | 664 |
665 if (nHash == JSCONST_nUndefHash) | 665 if (nHash == JSCONST_nUndefHash) |
666 return VT_undefined; | 666 return VT_undefined; |
667 else if (nHash == JSCONST_nNullHash) | 667 else if (nHash == JSCONST_nNullHash) |
668 return VT_null; | 668 return VT_null; |
(...skipping 27 matching lines...) Expand all Loading... |
696 else if (strcmp(sType,VALUE_NAME_NULL) == 0) | 696 else if (strcmp(sType,VALUE_NAME_NULL) == 0) |
697 return VT_null; | 697 return VT_null; |
698 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) | 698 else if (strcmp(sType,VALUE_NAME_UNDEFINED) == 0) |
699 return VT_undefined; | 699 return VT_undefined; |
700 */ | 700 */ |
701 | 701 |
702 return VT_unknown; | 702 return VT_unknown; |
703 } | 703 } |
704 | 704 |
705 #endif //_JS_DEFINE_H_ | 705 #endif //_JS_DEFINE_H_ |
OLD | NEW |