blob: bb181b2d4a260a493d9a180d7f1f2051ad66ca4f [file] [log] [blame]
Tom Sepez49dbb7f2018-12-19 17:56:55 +00001// 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
14class CFX_V8;
15
Tom Sepezd37d9202019-01-22 19:41:13 +000016#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 Sepezf3c92e42019-01-23 22:33:51 +000020 if (!node->DynamicTypeIs(static_type__)) \
21 return CJS_Result::Failure(JSMessage::kBadObjectError); \
Tom Sepezd37d9202019-01-22 19:41:13 +000022 return static_cast<Type__*>(node)->method_name(runtime, params); \
23 } \
24 CJS_Result method_name(CFX_V8* runtime, \
Tom Sepez49dbb7f2018-12-19 17:56:55 +000025 const std::vector<v8::Local<v8::Value>>& params)
26
Tom Sepezaa443612021-01-21 19:58:48 +000027#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 Sepez49dbb7f2018-12-19 17:56:55 +000037
38#endif // FXJS_XFA_JSE_DEFINE_H_