Add v8::Handle<v8::String> to converter.

This commit is contained in:
Cheng Zhao 2014-04-16 15:28:43 +08:00
parent c9fa29ef64
commit 94dec0ff85
2 changed files with 22 additions and 0 deletions

View file

@ -146,6 +146,19 @@ bool Converter<Handle<Object> >::FromV8(Isolate* isolate, Handle<Value> val,
return true; return true;
} }
Handle<Value> Converter<Handle<String> >::ToV8(Isolate* isolate,
Handle<String> val) {
return val;
}
bool Converter<Handle<String> >::FromV8(Isolate* isolate, Handle<Value> val,
Handle<String>* out) {
if (!val->IsString())
return false;
*out = Handle<String>::Cast(val);
return true;
}
Handle<Value> Converter<Handle<External> >::ToV8(Isolate* isolate, Handle<Value> Converter<Handle<External> >::ToV8(Isolate* isolate,
Handle<External> val) { Handle<External> val) {
return val; return val;

View file

@ -120,6 +120,15 @@ struct Converter<v8::Handle<v8::Object> > {
v8::Handle<v8::Object>* out); v8::Handle<v8::Object>* out);
}; };
template<>
struct Converter<v8::Handle<v8::String> > {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
v8::Handle<v8::String> val);
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Handle<v8::String>* out);
};
template<> template<>
struct Converter<v8::Handle<v8::External> > { struct Converter<v8::Handle<v8::External> > {
static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,