nan_converters.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  * NAN - Native Abstractions for Node.js
00003  *
00004  * Copyright (c) 2016 NAN contributors
00005  *
00006  * MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
00007  ********************************************************************/
00008 
00009 #ifndef NAN_CONVERTERS_H_
00010 #define NAN_CONVERTERS_H_
00011 
00012 namespace imp {
00013 template<typename T> struct ToFactoryBase {
00014   typedef MaybeLocal<T> return_t;
00015 };
00016 template<typename T> struct ValueFactoryBase { typedef Maybe<T> return_t; };
00017 
00018 template<typename T> struct ToFactory;
00019 
00020 #define X(TYPE)                                                                \
00021     template<>                                                                 \
00022     struct ToFactory<v8::TYPE> : ToFactoryBase<v8::TYPE> {                     \
00023       static inline return_t convert(v8::Local<v8::Value> val);                \
00024     };
00025 
00026 X(Boolean)
00027 X(Number)
00028 X(String)
00029 X(Object)
00030 X(Integer)
00031 X(Uint32)
00032 X(Int32)
00033 
00034 #undef X
00035 
00036 #define X(TYPE)                                                                \
00037     template<>                                                                 \
00038     struct ToFactory<TYPE> : ValueFactoryBase<TYPE> {                          \
00039       static inline return_t convert(v8::Local<v8::Value> val);                \
00040     };
00041 
00042 X(bool)
00043 X(double)
00044 X(int64_t)
00045 X(uint32_t)
00046 X(int32_t)
00047 
00048 #undef X
00049 }  // end of namespace imp
00050 
00051 template<typename T>
00052 inline
00053 typename imp::ToFactory<T>::return_t To(v8::Local<v8::Value> val) {
00054   return imp::ToFactory<T>::convert(val);
00055 }
00056 
00057 #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 ||                      \
00058   (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
00059 # include "nan_converters_43_inl.h"
00060 #else
00061 # include "nan_converters_pre_43_inl.h"
00062 #endif
00063 
00064 #endif  // NAN_CONVERTERS_H_


dji_ronin
Author(s):
autogenerated on Sat Jun 8 2019 20:15:31