Index: Source/bindings/tests/results/core/TestEnumOrDouble.cpp |
diff --git a/Source/bindings/tests/results/core/TestEnumOrDouble.cpp b/Source/bindings/tests/results/core/TestEnumOrDouble.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b554430580b5658778606baef0cc486f0af912c1 |
--- /dev/null |
+++ b/Source/bindings/tests/results/core/TestEnumOrDouble.cpp |
@@ -0,0 +1,109 @@ |
+// Copyright 2015 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 file. |
+ |
+// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
+ |
+#include "config.h" |
+#include "TestEnumOrDouble.h" |
+ |
+ |
+namespace blink { |
+ |
+TestEnumOrDouble::TestEnumOrDouble() |
+ : m_type(SpecificTypeNone) |
+{ |
+} |
+ |
+String TestEnumOrDouble::getAsTestEnum() const |
+{ |
+ ASSERT(isTestEnum()); |
+ return m_testEnum; |
+} |
+ |
+void TestEnumOrDouble::setTestEnum(String value) |
+{ |
+ ASSERT(isNull()); |
+ String string = value; |
+ if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
+ ASSERT_NOT_REACHED(); |
+ return; |
+ } |
+ m_testEnum = value; |
+ m_type = SpecificTypeTestEnum; |
+} |
+ |
+TestEnumOrDouble TestEnumOrDouble::fromTestEnum(String value) |
+{ |
+ TestEnumOrDouble container; |
+ container.setTestEnum(value); |
+ return container; |
+} |
+ |
+double TestEnumOrDouble::getAsDouble() const |
+{ |
+ ASSERT(isDouble()); |
+ return m_double; |
+} |
+ |
+void TestEnumOrDouble::setDouble(double value) |
+{ |
+ ASSERT(isNull()); |
+ m_double = value; |
+ m_type = SpecificTypeDouble; |
+} |
+ |
+TestEnumOrDouble TestEnumOrDouble::fromDouble(double value) |
+{ |
+ TestEnumOrDouble container; |
+ container.setDouble(value); |
+ return container; |
+} |
+ |
+void V8TestEnumOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, TestEnumOrDouble& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty()) |
+ return; |
+ |
+ if (v8Value->IsNumber()) { |
+ TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toRestrictedDouble(v8Value, exceptionState), exceptionState); |
+ impl.setDouble(cppValue); |
+ return; |
+ } |
+ |
+ { |
+ TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState); |
+ String string = cppValue; |
+ if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || string == "EnumValue3")) { |
+ exceptionState.throwTypeError("'" + string + "' is not a valid enum value."); |
+ return; |
+ } |
+ impl.setTestEnum(cppValue); |
+ return; |
+ } |
+ |
+} |
+ |
+v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ switch (impl.m_type) { |
+ case TestEnumOrDouble::SpecificTypeNone: |
+ return v8::Null(isolate); |
+ case TestEnumOrDouble::SpecificTypeTestEnum: |
+ return v8String(isolate, impl.getAsTestEnum()); |
+ case TestEnumOrDouble::SpecificTypeDouble: |
+ return v8::Number::New(isolate, impl.getAsDouble()); |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ return v8::Local<v8::Value>(); |
+} |
+ |
+TestEnumOrDouble NativeValueTraits<TestEnumOrDouble>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
+{ |
+ TestEnumOrDouble impl; |
+ V8TestEnumOrDouble::toImpl(isolate, value, impl, exceptionState); |
+ return impl; |
+} |
+ |
+} // namespace blink |