Index: Source/bindings/tests/results/core/UnionTypesCore.cpp |
diff --git a/Source/bindings/tests/results/core/UnionTypesCore.cpp b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
index d3523387f89a93d6f1a4de2575ba5b8a8293128b..50fce20c272db3e0c9a041e5ffe4cb85e966d32a 100644 |
--- a/Source/bindings/tests/results/core/UnionTypesCore.cpp |
+++ b/Source/bindings/tests/results/core/UnionTypesCore.cpp |
@@ -2,4 +2,427 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// FIXME: Implement |
+// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
+ |
+#include "config.h" |
+#include "bindings/core/v8/UnionTypesCore.h" |
+ |
+#include "bindings/core/v8/V8NodeList.h" |
+#include "bindings/tests/idls/core/TestImplements2.h" |
+#include "bindings/tests/idls/core/TestImplements3Implementation.h" |
+#include "bindings/tests/idls/core/TestPartialInterface.h" |
+#include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h" |
+#include "core/dom/NameNodeList.h" |
+#include "core/dom/NodeList.h" |
+#include "core/dom/StaticNodeList.h" |
+#include "core/html/LabelsNodeList.h" |
+ |
+namespace blink { |
+ |
+LongSequenceOrStringArrayOrUnrestrictedDouble::LongSequenceOrStringArrayOrUnrestrictedDouble() |
+ : m_specificTypeFlag(0) |
+{ |
+} |
+ |
+const Vector<int>& LongSequenceOrStringArrayOrUnrestrictedDouble::getAsLongSequence() |
+{ |
+ ASSERT(isLongSequence()); |
+ return m_longSequence; |
+} |
+ |
+void LongSequenceOrStringArrayOrUnrestrictedDouble::setLongSequence(const Vector<int>& value) |
+{ |
+ ASSERT(isNull()); |
+ m_longSequence = value; |
+ m_specificTypeFlag = 1; |
+} |
+ |
+const Vector<String>& LongSequenceOrStringArrayOrUnrestrictedDouble::getAsStringArray() |
+{ |
+ ASSERT(isStringArray()); |
+ return m_stringArray; |
+} |
+ |
+void LongSequenceOrStringArrayOrUnrestrictedDouble::setStringArray(const Vector<String>& value) |
+{ |
+ ASSERT(isNull()); |
+ m_stringArray = value; |
+ m_specificTypeFlag = 2; |
+} |
+ |
+double LongSequenceOrStringArrayOrUnrestrictedDouble::getAsUnrestrictedDouble() |
+{ |
+ ASSERT(isUnrestrictedDouble()); |
+ return m_unrestrictedDouble; |
+} |
+ |
+void LongSequenceOrStringArrayOrUnrestrictedDouble::setUnrestrictedDouble(double value) |
+{ |
+ ASSERT(isNull()); |
+ m_unrestrictedDouble = value; |
+ m_specificTypeFlag = 3; |
+} |
+ |
+void V8LongSequenceOrStringArrayOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, LongSequenceOrStringArrayOrUnrestrictedDouble& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) |
+ return; |
+ |
bashi
2014/10/28 10:09:15
V8 -> impl conversion for sequences and arrays are
|
+ if (v8Value->IsNumber()) { |
+ TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState); |
+ impl.setUnrestrictedDouble(cppValue); |
+ return; |
+ } |
+ |
+ exceptionState.throwTypeError("Not a valid union member."); |
+} |
+ |
+v8::Handle<v8::Value> toV8(LongSequenceOrStringArrayOrUnrestrictedDouble& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ if (impl.isNull()) |
+ return v8::Undefined(isolate); |
+ |
+ if (impl.isLongSequence()) |
+ return v8Array(impl.getAsLongSequence(), creationContext, isolate); |
+ |
+ if (impl.isStringArray()) |
+ return v8Array(impl.getAsStringArray(), creationContext, isolate); |
+ |
+ if (impl.isUnrestrictedDouble()) |
+ return v8::Number::New(isolate, impl.getAsUnrestrictedDouble()); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return v8::Undefined(isolate); |
+} |
+ |
+NodeOrNodeList::NodeOrNodeList() |
+ : m_specificTypeFlag(0) |
+{ |
+} |
+ |
+PassRefPtr<Node> NodeOrNodeList::getAsNode() |
+{ |
+ ASSERT(isNode()); |
+ return m_node; |
+} |
+ |
+void NodeOrNodeList::setNode(PassRefPtr<Node> value) |
+{ |
+ ASSERT(isNull()); |
+ m_node = value; |
+ m_specificTypeFlag = 1; |
+} |
+ |
+PassRefPtr<NodeList> NodeOrNodeList::getAsNodeList() |
+{ |
+ ASSERT(isNodeList()); |
+ return m_nodeList; |
+} |
+ |
+void NodeOrNodeList::setNodeList(PassRefPtr<NodeList> value) |
+{ |
+ ASSERT(isNull()); |
+ m_nodeList = value; |
+ m_specificTypeFlag = 2; |
+} |
+ |
+void V8NodeOrNodeList::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, NodeOrNodeList& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) |
+ return; |
+ |
+ if (V8Node::hasInstance(v8Value, isolate)) { |
+ RefPtr<Node> cppValue = V8Node::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setNode(cppValue); |
+ return; |
+ } |
+ |
+ if (V8NodeList::hasInstance(v8Value, isolate)) { |
+ RefPtr<NodeList> cppValue = V8NodeList::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setNodeList(cppValue); |
+ return; |
+ } |
+ |
+ exceptionState.throwTypeError("Not a valid union member."); |
+} |
+ |
+v8::Handle<v8::Value> toV8(NodeOrNodeList& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ if (impl.isNull()) |
+ return v8::Undefined(isolate); |
+ |
+ if (impl.isNode()) |
+ return toV8(impl.getAsNode(), creationContext, isolate); |
+ |
+ if (impl.isNodeList()) |
+ return toV8(impl.getAsNodeList(), creationContext, isolate); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return v8::Undefined(isolate); |
+} |
+ |
+StringOrDouble::StringOrDouble() |
+ : m_specificTypeFlag(0) |
+{ |
+} |
+ |
+String StringOrDouble::getAsString() |
+{ |
+ ASSERT(isString()); |
+ return m_string; |
+} |
+ |
+void StringOrDouble::setString(String value) |
+{ |
+ ASSERT(isNull()); |
+ m_string = value; |
+ m_specificTypeFlag = 1; |
+} |
+ |
+double StringOrDouble::getAsDouble() |
+{ |
+ ASSERT(isDouble()); |
+ return m_double; |
+} |
+ |
+void StringOrDouble::setDouble(double value) |
+{ |
+ ASSERT(isNull()); |
+ m_double = value; |
+ m_specificTypeFlag = 2; |
+} |
+ |
+void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, StringOrDouble& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) |
+ return; |
+ |
+ if (v8Value->IsNumber()) { |
+ TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState); |
+ impl.setDouble(cppValue); |
+ return; |
+ } |
+ |
+ { |
+ TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
+ impl.setString(cppValue); |
+ return; |
+ } |
+ |
+ exceptionState.throwTypeError("Not a valid union member."); |
+} |
+ |
+v8::Handle<v8::Value> toV8(StringOrDouble& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ if (impl.isNull()) |
+ return v8::Undefined(isolate); |
+ |
+ if (impl.isString()) |
+ return v8String(isolate, impl.getAsString()); |
+ |
+ if (impl.isDouble()) |
+ return v8::Number::New(isolate, impl.getAsDouble()); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return v8::Undefined(isolate); |
+} |
+ |
+TestInterfaceGarbageCollectedOrString::TestInterfaceGarbageCollectedOrString() |
+ : m_specificTypeFlag(0) |
+{ |
+} |
+ |
+PassRefPtr<TestInterfaceGarbageCollected> TestInterfaceGarbageCollectedOrString::getAsTestInterfaceGarbageCollected() |
+{ |
+ ASSERT(isTestInterfaceGarbageCollected()); |
+ return m_testInterfaceGarbageCollected; |
+} |
+ |
+void TestInterfaceGarbageCollectedOrString::setTestInterfaceGarbageCollected(PassRefPtr<TestInterfaceGarbageCollected> value) |
+{ |
+ ASSERT(isNull()); |
+ m_testInterfaceGarbageCollected = value; |
+ m_specificTypeFlag = 1; |
+} |
+ |
+String TestInterfaceGarbageCollectedOrString::getAsString() |
+{ |
+ ASSERT(isString()); |
+ return m_string; |
+} |
+ |
+void TestInterfaceGarbageCollectedOrString::setString(String value) |
+{ |
+ ASSERT(isNull()); |
+ m_string = value; |
+ m_specificTypeFlag = 2; |
+} |
+ |
+void V8TestInterfaceGarbageCollectedOrString::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, TestInterfaceGarbageCollectedOrString& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) |
+ return; |
+ |
+ if (V8TestInterfaceGarbageCollected::hasInstance(v8Value, isolate)) { |
+ RefPtr<TestInterfaceGarbageCollected> cppValue = V8TestInterfaceGarbageCollected::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setTestInterfaceGarbageCollected(cppValue); |
+ return; |
+ } |
+ |
+ { |
+ TOSTRING_VOID(V8StringResource<>, cppValue, v8Value); |
+ impl.setString(cppValue); |
+ return; |
+ } |
+ |
+ exceptionState.throwTypeError("Not a valid union member."); |
+} |
+ |
+v8::Handle<v8::Value> toV8(TestInterfaceGarbageCollectedOrString& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ if (impl.isNull()) |
+ return v8::Undefined(isolate); |
+ |
+ if (impl.isTestInterfaceGarbageCollected()) |
+ return toV8(impl.getAsTestInterfaceGarbageCollected(), creationContext, isolate); |
+ |
+ if (impl.isString()) |
+ return v8String(isolate, impl.getAsString()); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return v8::Undefined(isolate); |
+} |
+ |
+TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty() |
+ : m_specificTypeFlag(0) |
+{ |
+} |
+ |
+PassRefPtr<TestInterface> TestInterfaceOrTestInterfaceEmpty::getAsTestInterface() |
+{ |
+ ASSERT(isTestInterface()); |
+ return m_testInterface; |
+} |
+ |
+void TestInterfaceOrTestInterfaceEmpty::setTestInterface(PassRefPtr<TestInterface> value) |
+{ |
+ ASSERT(isNull()); |
+ m_testInterface = value; |
+ m_specificTypeFlag = 1; |
+} |
+ |
+PassRefPtr<TestInterfaceEmpty> TestInterfaceOrTestInterfaceEmpty::getAsTestInterfaceEmpty() |
+{ |
+ ASSERT(isTestInterfaceEmpty()); |
+ return m_testInterfaceEmpty; |
+} |
+ |
+void TestInterfaceOrTestInterfaceEmpty::setTestInterfaceEmpty(PassRefPtr<TestInterfaceEmpty> value) |
+{ |
+ ASSERT(isNull()); |
+ m_testInterfaceEmpty = value; |
+ m_specificTypeFlag = 2; |
+} |
+ |
+void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) |
+ return; |
+ |
+ if (V8TestInterface::hasInstance(v8Value, isolate)) { |
+ RefPtr<TestInterface> cppValue = V8TestInterface::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setTestInterface(cppValue); |
+ return; |
+ } |
+ |
+ if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) { |
+ RefPtr<TestInterfaceEmpty> cppValue = V8TestInterfaceEmpty::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setTestInterfaceEmpty(cppValue); |
+ return; |
+ } |
+ |
+ exceptionState.throwTypeError("Not a valid union member."); |
+} |
+ |
+v8::Handle<v8::Value> toV8(TestInterfaceOrTestInterfaceEmpty& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ if (impl.isNull()) |
+ return v8::Undefined(isolate); |
+ |
+ if (impl.isTestInterface()) |
+ return toV8(impl.getAsTestInterface(), creationContext, isolate); |
+ |
+ if (impl.isTestInterfaceEmpty()) |
+ return toV8(impl.getAsTestInterfaceEmpty(), creationContext, isolate); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return v8::Undefined(isolate); |
+} |
+ |
+TestInterfaceWillBeGarbageCollectedOrTestDictionary::TestInterfaceWillBeGarbageCollectedOrTestDictionary() |
+ : m_specificTypeFlag(0) |
+{ |
+} |
+ |
+PassRefPtr<TestInterfaceWillBeGarbageCollected> TestInterfaceWillBeGarbageCollectedOrTestDictionary::getAsTestInterfaceWillBeGarbageCollected() |
+{ |
+ ASSERT(isTestInterfaceWillBeGarbageCollected()); |
+ return m_testInterfaceWillBeGarbageCollected; |
+} |
+ |
+void TestInterfaceWillBeGarbageCollectedOrTestDictionary::setTestInterfaceWillBeGarbageCollected(PassRefPtr<TestInterfaceWillBeGarbageCollected> value) |
+{ |
+ ASSERT(isNull()); |
+ m_testInterfaceWillBeGarbageCollected = value; |
+ m_specificTypeFlag = 1; |
+} |
+ |
+PassRefPtr<TestDictionary> TestInterfaceWillBeGarbageCollectedOrTestDictionary::getAsTestDictionary() |
+{ |
+ ASSERT(isTestDictionary()); |
+ return m_testDictionary; |
+} |
+ |
+void TestInterfaceWillBeGarbageCollectedOrTestDictionary::setTestDictionary(PassRefPtr<TestDictionary> value) |
+{ |
+ ASSERT(isNull()); |
+ m_testDictionary = value; |
+ m_specificTypeFlag = 2; |
+} |
+ |
+void V8TestInterfaceWillBeGarbageCollectedOrTestDictionary::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, TestInterfaceWillBeGarbageCollectedOrTestDictionary& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty() || isUndefinedOrNull(v8Value)) |
+ return; |
+ |
+ if (V8TestInterfaceWillBeGarbageCollected::hasInstance(v8Value, isolate)) { |
+ RefPtr<TestInterfaceWillBeGarbageCollected> cppValue = V8TestInterfaceWillBeGarbageCollected::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setTestInterfaceWillBeGarbageCollected(cppValue); |
+ return; |
+ } |
+ |
+ if (V8TestDictionary::hasInstance(v8Value, isolate)) { |
+ RefPtr<TestDictionary> cppValue = V8TestDictionary::toImplWithTypeCheck(isolate, v8Value); |
+ impl.setTestDictionary(cppValue); |
+ return; |
+ } |
+ |
+ exceptionState.throwTypeError("Not a valid union member."); |
+} |
+ |
+v8::Handle<v8::Value> toV8(TestInterfaceWillBeGarbageCollectedOrTestDictionary& impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ if (impl.isNull()) |
+ return v8::Undefined(isolate); |
+ |
+ if (impl.isTestInterfaceWillBeGarbageCollected()) |
+ return toV8(impl.getAsTestInterfaceWillBeGarbageCollected(), creationContext, isolate); |
+ |
+ if (impl.isTestDictionary()) |
+ return toV8(impl.getAsTestDictionary(), creationContext, isolate); |
+ |
+ ASSERT_NOT_REACHED(); |
+ return v8::Undefined(isolate); |
+} |
+ |
+} // namespace blink |