You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

nan_converters_pre_43_inl.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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_CONVERTERS_PRE_43_INL_H_
  9. #define NAN_CONVERTERS_PRE_43_INL_H_
  10. #define X(TYPE) \
  11. imp::ToFactory<v8::TYPE>::return_t \
  12. imp::ToFactory<v8::TYPE>::convert(v8::Local<v8::Value> val) { \
  13. return val->To ## TYPE(); \
  14. }
  15. X(Boolean)
  16. X(Number)
  17. X(String)
  18. X(Object)
  19. X(Integer)
  20. X(Uint32)
  21. X(Int32)
  22. #undef X
  23. #define X(TYPE, NAME) \
  24. imp::ToFactory<TYPE>::return_t \
  25. imp::ToFactory<TYPE>::convert(v8::Local<v8::Value> val) { \
  26. return Just(val->NAME ## Value()); \
  27. }
  28. X(bool, Boolean)
  29. X(double, Number)
  30. X(int64_t, Integer)
  31. X(uint32_t, Uint32)
  32. X(int32_t, Int32)
  33. #undef X
  34. #endif // NAN_CONVERTERS_PRE_43_INL_H_