Tom Sepez | 49dbb7f | 2018-12-19 17:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2017 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
| 7 | #ifndef FXJS_XFA_JSE_DEFINE_H_ |
| 8 | #define FXJS_XFA_JSE_DEFINE_H_ |
| 9 | |
| 10 | #include <vector> |
| 11 | |
| 12 | #include "fxjs/cjs_result.h" |
| 13 | |
| 14 | class CFX_V8; |
| 15 | |
Tom Sepez | d37d920 | 2019-01-22 19:41:13 +0000 | [diff] [blame] | 16 | #define JSE_METHOD(method_name) \ |
| 17 | static CJS_Result method_name##_static( \ |
| 18 | CJX_Object* node, CFX_V8* runtime, \ |
| 19 | const std::vector<v8::Local<v8::Value>>& params) { \ |
Tom Sepez | f3c92e4 | 2019-01-23 22:33:51 +0000 | [diff] [blame] | 20 | if (!node->DynamicTypeIs(static_type__)) \ |
| 21 | return CJS_Result::Failure(JSMessage::kBadObjectError); \ |
Tom Sepez | d37d920 | 2019-01-22 19:41:13 +0000 | [diff] [blame] | 22 | return static_cast<Type__*>(node)->method_name(runtime, params); \ |
| 23 | } \ |
| 24 | CJS_Result method_name(CFX_V8* runtime, \ |
Tom Sepez | 49dbb7f | 2018-12-19 17:56:55 +0000 | [diff] [blame] | 25 | const std::vector<v8::Local<v8::Value>>& params) |
| 26 | |
Tom Sepez | aa44361 | 2021-01-21 19:58:48 +0000 | [diff] [blame] | 27 | #define JSE_PROP(prop_name) \ |
| 28 | static void prop_name##_static(v8::Isolate* pIsolate, CJX_Object* node, \ |
| 29 | v8::Local<v8::Value>* value, bool setting, \ |
| 30 | XFA_Attribute attribute) { \ |
| 31 | if (node->DynamicTypeIs(static_type__)) \ |
| 32 | static_cast<Type__*>(node)->prop_name(pIsolate, value, setting, \ |
| 33 | attribute); \ |
| 34 | } \ |
| 35 | void prop_name(v8::Isolate* pIsolate, v8::Local<v8::Value>* pValue, \ |
| 36 | bool bSetting, XFA_Attribute eAttribute) |
Tom Sepez | 49dbb7f | 2018-12-19 17:56:55 +0000 | [diff] [blame] | 37 | |
| 38 | #endif // FXJS_XFA_JSE_DEFINE_H_ |