diff options
Diffstat (limited to 'gin/converter.cc')
-rw-r--r-- | gin/converter.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gin/converter.cc b/gin/converter.cc index 64f5954..5fda673 100644 --- a/gin/converter.cc +++ b/gin/converter.cc @@ -7,6 +7,7 @@ #include "v8/include/v8.h" using v8::Boolean; +using v8::External; using v8::Function; using v8::Handle; using v8::Integer; @@ -124,6 +125,30 @@ bool Converter<Handle<Object> >::FromV8(Handle<Value> val, return true; } +Handle<Value> Converter<Handle<External> >::ToV8(v8::Isolate* isolate, + Handle<External> val) { + return val.As<Value>(); +} + +bool Converter<Handle<External> >::FromV8(Handle<Value> val, + Handle<External>* out) { + if (!val->IsExternal()) + return false; + *out = Handle<External>::Cast(val); + return true; +} + +Handle<Value> Converter<Handle<Value> >::ToV8(v8::Isolate* isolate, + Handle<Value> val) { + return val; +} + +bool Converter<Handle<Value> >::FromV8(Handle<Value> val, + Handle<Value>* out) { + *out = val; + return true; +} + v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate, const std::string& val) { return String::NewFromUtf8(isolate, |