| Index: Source/bindings/tests/results/core/StringOrDouble.cpp
|
| diff --git a/Source/bindings/tests/results/core/StringOrDouble.cpp b/Source/bindings/tests/results/core/StringOrDouble.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..abdc6535f56dee0c21d7d80ca63a5945acd0b51d
|
| --- /dev/null
|
| +++ b/Source/bindings/tests/results/core/StringOrDouble.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 "StringOrDouble.h"
|
| +
|
| +
|
| +namespace blink {
|
| +
|
| +StringOrDouble::StringOrDouble()
|
| + : m_type(SpecificTypeNone)
|
| +{
|
| +}
|
| +
|
| +String StringOrDouble::getAsString() const
|
| +{
|
| + ASSERT(isString());
|
| + return m_string;
|
| +}
|
| +
|
| +void StringOrDouble::setString(String value)
|
| +{
|
| + ASSERT(isNull());
|
| + m_string = value;
|
| + m_type = SpecificTypeString;
|
| +}
|
| +
|
| +StringOrDouble StringOrDouble::fromString(String value)
|
| +{
|
| + StringOrDouble container;
|
| + container.setString(value);
|
| + return container;
|
| +}
|
| +
|
| +double StringOrDouble::getAsDouble() const
|
| +{
|
| + ASSERT(isDouble());
|
| + return m_double;
|
| +}
|
| +
|
| +void StringOrDouble::setDouble(double value)
|
| +{
|
| + ASSERT(isNull());
|
| + m_double = value;
|
| + m_type = SpecificTypeDouble;
|
| +}
|
| +
|
| +StringOrDouble StringOrDouble::fromDouble(double value)
|
| +{
|
| + StringOrDouble container;
|
| + container.setDouble(value);
|
| + return container;
|
| +}
|
| +
|
| +void V8StringOrDouble::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, StringOrDouble& 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);
|
| + impl.setString(cppValue);
|
| + return;
|
| + }
|
| +
|
| +}
|
| +
|
| +v8::Local<v8::Value> toV8(const StringOrDouble& impl, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| +{
|
| + switch (impl.m_type) {
|
| + case StringOrDouble::SpecificTypeNone:
|
| + return v8::Null(isolate);
|
| + case StringOrDouble::SpecificTypeString:
|
| + return v8String(isolate, impl.getAsString());
|
| + case StringOrDouble::SpecificTypeDouble:
|
| + return v8::Number::New(isolate, impl.getAsDouble());
|
| + default:
|
| + ASSERT_NOT_REACHED();
|
| + }
|
| + return v8::Local<v8::Value>();
|
| +}
|
| +
|
| +StringOrDouble NativeValueTraits<StringOrDouble>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState)
|
| +{
|
| + StringOrDouble impl;
|
| + V8StringOrDouble::toImpl(isolate, value, impl, exceptionState);
|
| + return impl;
|
| +}
|
| +
|
| +} // namespace blink
|
|
|