nan_callbacks.h 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. typedef v8::Local<v8::AccessorSignature> Sig;
  52. static const int kDataIndex = 0;
  53. static const int kFunctionIndex = 1;
  54. static const int kFunctionFieldCount = 2;
  55. static const int kGetterIndex = 1;
  56. static const int kSetterIndex = 2;
  57. static const int kAccessorFieldCount = 3;
  58. static const int kPropertyGetterIndex = 1;
  59. static const int kPropertySetterIndex = 2;
  60. static const int kPropertyEnumeratorIndex = 3;
  61. static const int kPropertyDeleterIndex = 4;
  62. static const int kPropertyQueryIndex = 5;
  63. static const int kPropertyFieldCount = 6;
  64. static const int kIndexPropertyGetterIndex = 1;
  65. static const int kIndexPropertySetterIndex = 2;
  66. static const int kIndexPropertyEnumeratorIndex = 3;
  67. static const int kIndexPropertyDeleterIndex = 4;
  68. static const int kIndexPropertyQueryIndex = 5;
  69. static const int kIndexPropertyFieldCount = 6;
  70. } // end of namespace imp
  71. #if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
  72. # include "nan_callbacks_12_inl.h" // NOLINT(build/include)
  73. #else
  74. # include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include)
  75. #endif
  76. #endif // NAN_CALLBACKS_H_