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_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ | 7 #ifndef FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ | 8 #define FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
9 | 9 |
10 #include "../jsapi/fxjs_v8.h" | 10 #include "../../include/jsapi/fxjs_v8.h" |
11 #include "resource.h" | 11 #include "resource.h" |
12 #include "JS_Object.h" | 12 #include "JS_Object.h" |
13 #include "JS_Value.h" | 13 #include "JS_Value.h" |
14 | 14 |
15 struct JSConstSpec { | 15 struct JSConstSpec { |
16 const wchar_t* pName; | 16 const wchar_t* pName; |
17 double number; | 17 double number; |
18 const wchar_t* string; | 18 const wchar_t* string; |
19 uint8_t t; // 0:double 1:str | 19 uint8_t t; // 0:double 1:str |
20 }; | 20 }; |
(...skipping 21 matching lines...) Expand all Loading... |
42 #define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) \ | 42 #define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) \ |
43 { const_name, 0, pValue, 1 } \ | 43 { const_name, 0, pValue, 1 } \ |
44 , | 44 , |
45 #define END_JS_STATIC_CONST() \ | 45 #define END_JS_STATIC_CONST() \ |
46 { 0, 0, 0, 0 } \ | 46 { 0, 0, 0, 0 } \ |
47 } \ | 47 } \ |
48 ; | 48 ; |
49 | 49 |
50 #define BEGIN_JS_STATIC_PROP(js_class_name) \ | 50 #define BEGIN_JS_STATIC_PROP(js_class_name) \ |
51 JSPropertySpec js_class_name::JS_Class_Properties[] = { | 51 JSPropertySpec js_class_name::JS_Class_Properties[] = { |
52 #define JS_STATIC_PROP_ENTRY(prop_name)
\ | 52 #define JS_STATIC_PROP_ENTRY(prop_name) \ |
53 {
\ | 53 { \ |
54 JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static
\ | 54 JS_WIDESTRING(prop_name), get_##prop_name##_static, \ |
55 }
\ | 55 set_##prop_name##_static \ |
| 56 } \ |
56 , | 57 , |
57 #define END_JS_STATIC_PROP() \ | 58 #define END_JS_STATIC_PROP() \ |
58 { 0, 0, 0 } \ | 59 { 0, 0, 0 } \ |
59 } \ | 60 } \ |
60 ; | 61 ; |
61 | 62 |
62 #define BEGIN_JS_STATIC_METHOD(js_class_name) \ | 63 #define BEGIN_JS_STATIC_METHOD(js_class_name) \ |
63 JSMethodSpec js_class_name::JS_Class_Methods[] = { | 64 JSMethodSpec js_class_name::JS_Class_Methods[] = { |
64 #define JS_STATIC_METHOD_ENTRY(method_name) \ | 65 #define JS_STATIC_METHOD_ENTRY(method_name) \ |
65 { JS_WIDESTRING(method_name), method_name##_static } \ | 66 { JS_WIDESTRING(method_name), method_name##_static } \ |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate) { \ | 469 void js_class_name::DefineJSObjects(v8::Isolate* pIsolate) { \ |
469 for (int i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ | 470 for (int i = 0; i < FX_ArraySize(global_methods) - 1; ++i) { \ |
470 FXJS_DefineGlobalMethod(pIsolate, \ | 471 FXJS_DefineGlobalMethod(pIsolate, \ |
471 js_class_name::global_methods[i].pName, \ | 472 js_class_name::global_methods[i].pName, \ |
472 js_class_name::global_methods[i].pMethodCall); \ | 473 js_class_name::global_methods[i].pMethodCall); \ |
473 } \ | 474 } \ |
474 } | 475 } |
475 | 476 |
476 CJS_Value::Type GET_VALUE_TYPE(v8::Local<v8::Value> p); | 477 CJS_Value::Type GET_VALUE_TYPE(v8::Local<v8::Value> p); |
477 | 478 |
478 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_DEFINE_H_ | 479 #endif // FPDFSDK_SRC_JAVASCRIPT_JS_DEFINE_H_ |
OLD | NEW |