nan_callbacks.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #ifndef NAN_CALLBACKS_H_
  9. #define NAN_CALLBACKS_H_
  10. template<typename T> class FunctionCallbackInfo;
  11. template<typename T> class PropertyCallbackInfo;
  12. template<typename T> class Global;
  13. typedef void(*FunctionCallback)(const FunctionCallbackInfo<v8::Value>&);
  14. typedef void(*GetterCallback)
  15. (v8::Local<v8::String>, const PropertyCallbackInfo<v8::Value>&);
  16. typedef void(*SetterCallback)(
  17. v8::Local<v8::String>,
  18. v8::Local<v8::Value>,
  19. const PropertyCallbackInfo<void>&);
  20. typedef void(*PropertyGetterCallback)(
  21. v8::Local<v8::String>,
  22. const PropertyCallbackInfo<v8::Value>&);
  23. typedef void(*PropertySetterCallback)(
  24. v8::Local<v8::String>,
  25. v8::Local<v8::Value>,
  26. const PropertyCallbackInfo<v8::Value>&);
  27. typedef void(*PropertyEnumeratorCallback)
  28. (const PropertyCallbackInfo<v8::Array>&);
  29. typedef void(*PropertyDeleterCallback)(
  30. v8::Local<v8::String>,
  31. const PropertyCallbackInfo<v8::Boolean>&);
  32. typedef void(*PropertyQueryCallback)(
  33. v8::Local<v8::String>,
  34. const PropertyCallbackInfo<v8::Integer>&);
  35. typedef void(*IndexGetterCallback)(
  36. uint32_t,
  37. const PropertyCallbackInfo<v8::Value>&);
  38. typedef void(*IndexSetterCallback)(
  39. uint32_t,
  40. v8::Local<v8::Value>,
  41. const PropertyCallbackInfo<v8::Value>&);
  42. typedef void(*IndexEnumeratorCallback)
  43. (const PropertyCallbackInfo<v8::Array>&);
  44. typedef void(*IndexDeleterCallback)(
  45. uint32_t,
  46. const PropertyCallbackInfo<v8::Boolean>&);
  47. typedef void(*IndexQueryCallback)(
  48. uint32_t,
  49. const PropertyCallbackInfo<v8::Integer>&);
  50. namespace imp {
  51. #if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION)
  52. typedef v8::Local<v8::AccessorSignature> Sig;
  53. #else
  54. typedef v8::Local<v8::Data> Sig;
  55. #endif
  56. static const int kDataIndex = 0;
  57. static const int kFunctionIndex = 1;
  58. static const int kFunctionFieldCount = 2;
  59. static const int kGetterIndex = 1;
  60. static const int kSetterIndex = 2;
  61. static const int kAccessorFieldCount = 3;
  62. static const int kPropertyGetterIndex = 1;
  63. static const int kPropertySetterIndex = 2;
  64. static const int kPropertyEnumeratorIndex = 3;
  65. static const int kPropertyDeleterIndex = 4;
  66. static const int kPropertyQueryIndex = 5;
  67. static const int kPropertyFieldCount = 6;
  68. static const int kIndexPropertyGetterIndex = 1;
  69. static const int kIndexPropertySetterIndex = 2;
  70. static const int kIndexPropertyEnumeratorIndex = 3;
  71. static const int kIndexPropertyDeleterIndex = 4;
  72. static const int kIndexPropertyQueryIndex = 5;
  73. static const int kIndexPropertyFieldCount = 6;
  74. } // end of namespace imp
  75. #if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
  76. # include "nan_callbacks_12_inl.h" // NOLINT(build/include)
  77. #else
  78. # include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include)
  79. #endif
  80. #endif // NAN_CALLBACKS_H_