UNPKG

3.19 kBtext/x-cView Raw
1/*********************************************************************
2 * NAN - Native Abstractions for Node.js
3 *
4 * Copyright (c) 2018 NAN contributors
5 *
6 * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
7 ********************************************************************/
8
9#ifndef NAN_CALLBACKS_H_
10#define NAN_CALLBACKS_H_
11
12template<typename T> class FunctionCallbackInfo;
13template<typename T> class PropertyCallbackInfo;
14template<typename T> class Global;
15
16typedef void(*FunctionCallback)(const FunctionCallbackInfo<v8::Value>&);
17typedef void(*GetterCallback)
18 (v8::Local<v8::String>, const PropertyCallbackInfo<v8::Value>&);
19typedef void(*SetterCallback)(
20 v8::Local<v8::String>,
21 v8::Local<v8::Value>,
22 const PropertyCallbackInfo<void>&);
23typedef void(*PropertyGetterCallback)(
24 v8::Local<v8::String>,
25 const PropertyCallbackInfo<v8::Value>&);
26typedef void(*PropertySetterCallback)(
27 v8::Local<v8::String>,
28 v8::Local<v8::Value>,
29 const PropertyCallbackInfo<v8::Value>&);
30typedef void(*PropertyEnumeratorCallback)
31 (const PropertyCallbackInfo<v8::Array>&);
32typedef void(*PropertyDeleterCallback)(
33 v8::Local<v8::String>,
34 const PropertyCallbackInfo<v8::Boolean>&);
35typedef void(*PropertyQueryCallback)(
36 v8::Local<v8::String>,
37 const PropertyCallbackInfo<v8::Integer>&);
38typedef void(*IndexGetterCallback)(
39 uint32_t,
40 const PropertyCallbackInfo<v8::Value>&);
41typedef void(*IndexSetterCallback)(
42 uint32_t,
43 v8::Local<v8::Value>,
44 const PropertyCallbackInfo<v8::Value>&);
45typedef void(*IndexEnumeratorCallback)
46 (const PropertyCallbackInfo<v8::Array>&);
47typedef void(*IndexDeleterCallback)(
48 uint32_t,
49 const PropertyCallbackInfo<v8::Boolean>&);
50typedef void(*IndexQueryCallback)(
51 uint32_t,
52 const PropertyCallbackInfo<v8::Integer>&);
53
54namespace imp {
55#if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION)
56typedef v8::Local<v8::AccessorSignature> Sig;
57#else
58typedef v8::Local<v8::Data> Sig;
59#endif
60
61static const int kDataIndex = 0;
62
63static const int kFunctionIndex = 1;
64static const int kFunctionFieldCount = 2;
65
66static const int kGetterIndex = 1;
67static const int kSetterIndex = 2;
68static const int kAccessorFieldCount = 3;
69
70static const int kPropertyGetterIndex = 1;
71static const int kPropertySetterIndex = 2;
72static const int kPropertyEnumeratorIndex = 3;
73static const int kPropertyDeleterIndex = 4;
74static const int kPropertyQueryIndex = 5;
75static const int kPropertyFieldCount = 6;
76
77static const int kIndexPropertyGetterIndex = 1;
78static const int kIndexPropertySetterIndex = 2;
79static const int kIndexPropertyEnumeratorIndex = 3;
80static const int kIndexPropertyDeleterIndex = 4;
81static const int kIndexPropertyQueryIndex = 5;
82static const int kIndexPropertyFieldCount = 6;
83
84} // end of namespace imp
85
86#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
87# include "nan_callbacks_12_inl.h" // NOLINT(build/include)
88#else
89# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include)
90#endif
91
92#endif // NAN_CALLBACKS_H_