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 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) { \ 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(CFX_V8* runtime, \ 25 const std::vector<v8::Local<v8::Value>>& params) 26 27 #define JSE_PROP(prop_name) \ 28 static void prop_name##_static(CJX_Object* node, CFXJSE_Value* value, \ 29 bool setting, XFA_Attribute attribute) { \ 30 if (node->DynamicTypeIs(static_type__)) \ 31 static_cast<Type__*>(node)->prop_name(value, setting, attribute); \ 32 } \ 33 void prop_name(CFXJSE_Value* pValue, bool bSetting, XFA_Attribute eAttribute) 34 35 #endif // FXJS_XFA_JSE_DEFINE_H_ 36