• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core/fxcrt/span.h"
11 #include "fxjs/cjs_result.h"
12 
13 class CFXJSE_Engine;
14 
15 #define JSE_METHOD(method_name)                                      \
16   static CJS_Result method_name##_static(                            \
17       CJX_Object* node, CFXJSE_Engine* runtime,                      \
18       pdfium::span<v8::Local<v8::Value>> params) {                   \
19     if (!node->DynamicTypeIs(static_type__))                         \
20       return CJS_Result::Failure(JSMessage::kBadObjectError);        \
21     return static_cast<Type__*>(node)->method_name(runtime, params); \
22   }                                                                  \
23   CJS_Result method_name(CFXJSE_Engine* runtime,                     \
24                          pdfium::span<v8::Local<v8::Value>> params)
25 
26 #define JSE_PROP(prop_name)                                                 \
27   static void prop_name##_static(v8::Isolate* pIsolate, CJX_Object* node,   \
28                                  v8::Local<v8::Value>* value, bool setting, \
29                                  XFA_Attribute attribute) {                 \
30     if (node->DynamicTypeIs(static_type__))                                 \
31       static_cast<Type__*>(node)->prop_name(pIsolate, value, setting,       \
32                                             attribute);                     \
33   }                                                                         \
34   void prop_name(v8::Isolate* pIsolate, v8::Local<v8::Value>* pValue,       \
35                  bool bSetting, XFA_Attribute eAttribute)
36 
37 #endif  // FXJS_XFA_JSE_DEFINE_H_
38