Add converter for unsigned long
This commit is contained in:
parent
d0db7bfb58
commit
a636fad51e
2 changed files with 23 additions and 0 deletions
|
@ -31,6 +31,20 @@ bool Converter<bool>::FromV8(Isolate* isolate, Handle<Value> val, bool* out) {
|
||||||
return true;
|
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) {
|
Handle<Value> Converter<int32_t>::ToV8(Isolate* isolate, int32_t val) {
|
||||||
return MATE_INTEGER_NEW(isolate, val);
|
return MATE_INTEGER_NEW(isolate, val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,15 @@ struct Converter<bool> {
|
||||||
bool* out);
|
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<>
|
template<>
|
||||||
struct Converter<int32_t> {
|
struct Converter<int32_t> {
|
||||||
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
|
||||||
|
|
Loading…
Reference in a new issue