OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 |
| 7 #ifndef TestEnumOrDouble_h |
| 8 #define TestEnumOrDouble_h |
| 9 |
| 10 #include "bindings/core/v8/Dictionary.h" |
| 11 #include "bindings/core/v8/ExceptionState.h" |
| 12 #include "bindings/core/v8/V8Binding.h" |
| 13 #include "platform/heap/Handle.h" |
| 14 |
| 15 namespace blink { |
| 16 |
| 17 class TestEnumOrDouble final { |
| 18 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 19 public: |
| 20 TestEnumOrDouble(); |
| 21 bool isNull() const { return m_type == SpecificTypeNone; } |
| 22 |
| 23 bool isTestEnum() const { return m_type == SpecificTypeTestEnum; } |
| 24 String getAsTestEnum() const; |
| 25 void setTestEnum(String); |
| 26 static TestEnumOrDouble fromTestEnum(String); |
| 27 |
| 28 bool isDouble() const { return m_type == SpecificTypeDouble; } |
| 29 double getAsDouble() const; |
| 30 void setDouble(double); |
| 31 static TestEnumOrDouble fromDouble(double); |
| 32 |
| 33 private: |
| 34 enum SpecificTypes { |
| 35 SpecificTypeNone, |
| 36 SpecificTypeTestEnum, |
| 37 SpecificTypeDouble, |
| 38 }; |
| 39 SpecificTypes m_type; |
| 40 |
| 41 String m_testEnum; |
| 42 double m_double; |
| 43 |
| 44 friend v8::Local<v8::Value> toV8(const TestEnumOrDouble&, v8::Local<v8::Obje
ct>, v8::Isolate*); |
| 45 }; |
| 46 |
| 47 class V8TestEnumOrDouble final { |
| 48 public: |
| 49 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestEnumOrDouble&, Ex
ceptionState&); |
| 50 }; |
| 51 |
| 52 v8::Local<v8::Value> toV8(const TestEnumOrDouble&, v8::Local<v8::Object>, v8::Is
olate*); |
| 53 |
| 54 template <class CallbackInfo> |
| 55 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestEnumOrDouble&
impl) |
| 56 { |
| 57 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 58 } |
| 59 |
| 60 template <> |
| 61 struct NativeValueTraits<TestEnumOrDouble> { |
| 62 static TestEnumOrDouble nativeValue(const v8::Local<v8::Value>&, v8::Isolate
*, ExceptionState&); |
| 63 }; |
| 64 |
| 65 } // namespace blink |
| 66 |
| 67 #endif // TestEnumOrDouble_h |
OLD | NEW |