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 BooleanOrStringOrUnrestrictedDouble_h |
| 8 #define BooleanOrStringOrUnrestrictedDouble_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 BooleanOrStringOrUnrestrictedDouble final { |
| 18 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 19 public: |
| 20 BooleanOrStringOrUnrestrictedDouble(); |
| 21 bool isNull() const { return m_type == SpecificTypeNone; } |
| 22 |
| 23 bool isBoolean() const { return m_type == SpecificTypeBoolean; } |
| 24 bool getAsBoolean() const; |
| 25 void setBoolean(bool); |
| 26 static BooleanOrStringOrUnrestrictedDouble fromBoolean(bool); |
| 27 |
| 28 bool isString() const { return m_type == SpecificTypeString; } |
| 29 String getAsString() const; |
| 30 void setString(String); |
| 31 static BooleanOrStringOrUnrestrictedDouble fromString(String); |
| 32 |
| 33 bool isUnrestrictedDouble() const { return m_type == SpecificTypeUnrestricte
dDouble; } |
| 34 double getAsUnrestrictedDouble() const; |
| 35 void setUnrestrictedDouble(double); |
| 36 static BooleanOrStringOrUnrestrictedDouble fromUnrestrictedDouble(double); |
| 37 |
| 38 private: |
| 39 enum SpecificTypes { |
| 40 SpecificTypeNone, |
| 41 SpecificTypeBoolean, |
| 42 SpecificTypeString, |
| 43 SpecificTypeUnrestrictedDouble, |
| 44 }; |
| 45 SpecificTypes m_type; |
| 46 |
| 47 bool m_boolean; |
| 48 String m_string; |
| 49 double m_unrestrictedDouble; |
| 50 |
| 51 friend v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble&,
v8::Local<v8::Object>, v8::Isolate*); |
| 52 }; |
| 53 |
| 54 class V8BooleanOrStringOrUnrestrictedDouble final { |
| 55 public: |
| 56 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, BooleanOrStringOrUnre
strictedDouble&, ExceptionState&); |
| 57 }; |
| 58 |
| 59 v8::Local<v8::Value> toV8(const BooleanOrStringOrUnrestrictedDouble&, v8::Local<
v8::Object>, v8::Isolate*); |
| 60 |
| 61 template <class CallbackInfo> |
| 62 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, BooleanOrStringOr
UnrestrictedDouble& impl) |
| 63 { |
| 64 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 65 } |
| 66 |
| 67 template <> |
| 68 struct NativeValueTraits<BooleanOrStringOrUnrestrictedDouble> { |
| 69 static BooleanOrStringOrUnrestrictedDouble nativeValue(const v8::Local<v8::V
alue>&, v8::Isolate*, ExceptionState&); |
| 70 }; |
| 71 |
| 72 } // namespace blink |
| 73 |
| 74 #endif // BooleanOrStringOrUnrestrictedDouble_h |
OLD | NEW |