Add converter for unsigned long

This commit is contained in:
Cheng Zhao 2015-03-10 16:08:30 -07:00
parent d0db7bfb58
commit a636fad51e
2 changed files with 23 additions and 0 deletions

View file

@ -31,6 +31,20 @@ bool Converter<bool>::FromV8(Isolate* isolate, Handle<Value> val, bool* out) {
return true;
}
Handle<Value> Converter<unsigned long>::ToV8(Isolate* isolate,
unsigned long val) {
return MATE_INTEGER_NEW(isolate, val);
}
bool Converter<unsigned long>::FromV8(Isolate* isolate, Handle<Value> val,
unsigned long* out) {
if (!val->IsNumber())
return false;
*out = val->IntegerValue();
return true;
}
Handle<Value> Converter<int32_t>::ToV8(Isolate* isolate, int32_t val) {
return MATE_INTEGER_NEW(isolate, val);
}

View file

@ -33,6 +33,15 @@ struct Converter<bool> {
bool* out);
};
template<>
struct Converter<unsigned long> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
unsigned long val);
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
unsigned long* out);
};
template<>
struct Converter<int32_t> {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,