mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Initial commit.
This commit is contained in:
42
native_mate/dictionary.cc
Normal file
42
native_mate/dictionary.cc
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE.chromium file.
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
namespace mate {
|
||||
|
||||
Dictionary::Dictionary(v8::Isolate* isolate)
|
||||
: isolate_(isolate) {
|
||||
}
|
||||
|
||||
Dictionary::Dictionary(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Object> object)
|
||||
: isolate_(isolate),
|
||||
object_(object) {
|
||||
}
|
||||
|
||||
Dictionary::~Dictionary() {
|
||||
}
|
||||
|
||||
Dictionary Dictionary::CreateEmpty(v8::Isolate* isolate) {
|
||||
Dictionary dictionary(isolate);
|
||||
dictionary.object_ = v8::Object::New();
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
v8::Handle<v8::Value> Converter<Dictionary>::ToV8(v8::Isolate* isolate,
|
||||
Dictionary val) {
|
||||
return val.object_;
|
||||
}
|
||||
|
||||
bool Converter<Dictionary>::FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
Dictionary* out) {
|
||||
if (!val->IsObject())
|
||||
return false;
|
||||
*out = Dictionary(isolate, v8::Handle<v8::Object>::Cast(val));
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mate
|
||||
Reference in New Issue
Block a user