1 // Copyright 2017 The PDFium Authors 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 CFXJSE_Engine; 15 16 #define JSE_METHOD(method_name) \ 17 static CJS_Result method_name##_static( \ 18 CJX_Object* node, CFXJSE_Engine* runtime, \ 19 const std::vector<v8::Local<v8::Value>>& params) { \ 20 if (!node->DynamicTypeIs(static_type__)) \ 21 return CJS_Result::Failure(JSMessage::kBadObjectError); \ 22 return static_cast<Type__*>(node)->method_name(runtime, params); \ 23 } \ 24 CJS_Result method_name(CFXJSE_Engine* runtime, \ 25 const std::vector<v8::Local<v8::Value>>& params) 26 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) 37 38 #endif // FXJS_XFA_JSE_DEFINE_H_ 39