Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: Source/bindings/tests/results/core/BooleanOrStringOrUnrestrictedDouble.cpp

Issue 953123003: IDL: Put generated union type containers in separate files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/tests/results/core/BooleanOrStringOrUnrestrictedDouble.cpp
diff --git a/Source/bindings/tests/results/core/BooleanOrStringOrUnrestrictedDouble.cpp b/Source/bindings/tests/results/core/BooleanOrStringOrUnrestrictedDouble.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f859f0459f6cbb90ec5662c2b8f35ad00a165921
--- /dev/null
+++ b/Source/bindings/tests/results/core/BooleanOrStringOrUnrestrictedDouble.cpp
@@ -0,0 +1,126 @@
+// 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 "BooleanOrStringOrUnrestrictedDouble.h"
+
+
+namespace blink {
+
+BooleanOrStringOrUnrestrictedDouble::BooleanOrStringOrUnrestrictedDouble()
+ : m_type(SpecificTypeNone)
+{
+}
+
+bool BooleanOrStringOrUnrestrictedDouble::getAsBoolean() const
+{
+ ASSERT(isBoolean());
+ return m_boolean;
+}
+
+void BooleanOrStringOrUnrestrictedDouble::setBoolean(bool value)
+{
+ ASSERT(isNull());
+ m_boolean = value;
+ m_type = SpecificTypeBoolean;
+}
+
+BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromBoolean(bool value)
+{
+ BooleanOrStringOrUnrestrictedDouble container;
+ container.setBoolean(value);
+ return container;
+}
+
+String BooleanOrStringOrUnrestrictedDouble::getAsString() const
+{
+ ASSERT(isString());
+ return m_string;
+}
+
+void BooleanOrStringOrUnrestrictedDouble::setString(String value)
+{
+ ASSERT(isNull());
+ m_string = value;
+ m_type = SpecificTypeString;
+}
+
+BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromString(String value)
+{
+ BooleanOrStringOrUnrestrictedDouble container;
+ container.setString(value);
+ return container;
+}
+
+double BooleanOrStringOrUnrestrictedDouble::getAsUnrestrictedDouble() const
+{
+ ASSERT(isUnrestrictedDouble());
+ return m_unrestrictedDouble;
+}
+
+void BooleanOrStringOrUnrestrictedDouble::setUnrestrictedDouble(double value)
+{
+ ASSERT(isNull());
+ m_unrestrictedDouble = value;
+ m_type = SpecificTypeUnrestrictedDouble;
+}
+
+BooleanOrStringOrUnrestrictedDouble BooleanOrStringOrUnrestrictedDouble::fromUnrestrictedDouble(double value)
+{
+ BooleanOrStringOrUnrestrictedDouble container;
+ container.setUnrestrictedDouble(value);
+ return container;
+}
+
+void V8BooleanOrStringOrUnrestrictedDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, BooleanOrStringOrUnrestrictedDouble& impl, ExceptionState& exceptionState)
+{
+ if (v8Value.IsEmpty())
+ return;
+
+ if (v8Value->IsBoolean()) {
+ impl.setBoolean(v8Value->ToBoolean()->Value());
+ 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 BooleanOrStringOrUnrestrictedDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ switch (impl.m_type) {
+ case BooleanOrStringOrUnrestrictedDouble::SpecificTypeNone:
+ return v8::Null(isolate);
+ case BooleanOrStringOrUnrestrictedDouble::SpecificTypeBoolean:
+ return v8Boolean(impl.getAsBoolean(), isolate);
+ case BooleanOrStringOrUnrestrictedDouble::SpecificTypeString:
+ return v8String(isolate, impl.getAsString());
+ case BooleanOrStringOrUnrestrictedDouble::SpecificTypeUnrestrictedDouble:
+ return v8::Number::New(isolate, impl.getAsUnrestrictedDouble());
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ return v8::Local<v8::Value>();
+}
+
+BooleanOrStringOrUnrestrictedDouble NativeValueTraits<BooleanOrStringOrUnrestrictedDouble>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
+{
+ BooleanOrStringOrUnrestrictedDouble impl;
+ V8BooleanOrStringOrUnrestrictedDouble::toImpl(isolate, value, impl, exceptionState);
+ return impl;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698