Index: Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp |
diff --git a/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp b/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..980a60c6d77925819dfb55467b80a0e6f2fdb6b3 |
--- /dev/null |
+++ b/Source/bindings/tests/results/core/UnrestrictedDoubleOrString.cpp |
@@ -0,0 +1,99 @@ |
+// 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 "UnrestrictedDoubleOrString.h" |
+ |
+ |
+namespace blink { |
+ |
+UnrestrictedDoubleOrString::UnrestrictedDoubleOrString() |
+ : m_type(SpecificTypeNone) |
+{ |
+} |
+ |
+double UnrestrictedDoubleOrString::getAsUnrestrictedDouble() const |
+{ |
+ ASSERT(isUnrestrictedDouble()); |
+ return m_unrestrictedDouble; |
+} |
+ |
+void UnrestrictedDoubleOrString::setUnrestrictedDouble(double value) |
+{ |
+ ASSERT(isNull()); |
+ m_unrestrictedDouble = value; |
+ m_type = SpecificTypeUnrestrictedDouble; |
+} |
+ |
+UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromUnrestrictedDouble(double value) |
+{ |
+ UnrestrictedDoubleOrString container; |
+ container.setUnrestrictedDouble(value); |
+ return container; |
+} |
+ |
+String UnrestrictedDoubleOrString::getAsString() const |
+{ |
+ ASSERT(isString()); |
+ return m_string; |
+} |
+ |
+void UnrestrictedDoubleOrString::setString(String value) |
+{ |
+ ASSERT(isNull()); |
+ m_string = value; |
+ m_type = SpecificTypeString; |
+} |
+ |
+UnrestrictedDoubleOrString UnrestrictedDoubleOrString::fromString(String value) |
+{ |
+ UnrestrictedDoubleOrString container; |
+ container.setString(value); |
+ return container; |
+} |
+ |
+void V8UnrestrictedDoubleOrString::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, UnrestrictedDoubleOrString& impl, ExceptionState& exceptionState) |
+{ |
+ if (v8Value.IsEmpty()) |
+ return; |
+ |
+ if (v8Value->IsNumber()) { |
+ TONATIVE_VOID_EXCEPTIONSTATE(double, cppValue, toDouble(v8Value, exceptionState), exceptionState); |
+ impl.setUnrestrictedDouble(cppValue); |
+ return; |
+ } |
+ |
+ { |
+ TOSTRING_VOID_EXCEPTIONSTATE(V8StringResource<>, cppValue, v8Value, exceptionState); |
+ impl.setString(cppValue); |
+ return; |
+ } |
+ |
+} |
+ |
+v8::Local<v8::Value> toV8(const UnrestrictedDoubleOrString& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
+{ |
+ switch (impl.m_type) { |
+ case UnrestrictedDoubleOrString::SpecificTypeNone: |
+ return v8::Null(isolate); |
+ case UnrestrictedDoubleOrString::SpecificTypeUnrestrictedDouble: |
+ return v8::Number::New(isolate, impl.getAsUnrestrictedDouble()); |
+ case UnrestrictedDoubleOrString::SpecificTypeString: |
+ return v8String(isolate, impl.getAsString()); |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ } |
+ return v8::Local<v8::Value>(); |
+} |
+ |
+UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
+{ |
+ UnrestrictedDoubleOrString impl; |
+ V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, exceptionState); |
+ return impl; |
+} |
+ |
+} // namespace blink |