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

Side by Side Diff: Source/bindings/tests/results/core/DoubleOrString.h

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 DoubleOrString_h
8 #define DoubleOrString_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 DoubleOrString final {
18 ALLOW_ONLY_INLINE_ALLOCATION();
19 public:
20 DoubleOrString();
21 bool isNull() const { return m_type == SpecificTypeNone; }
22
23 bool isDouble() const { return m_type == SpecificTypeDouble; }
24 double getAsDouble() const;
25 void setDouble(double);
26 static DoubleOrString fromDouble(double);
27
28 bool isString() const { return m_type == SpecificTypeString; }
29 String getAsString() const;
30 void setString(String);
31 static DoubleOrString fromString(String);
32
33 private:
34 enum SpecificTypes {
35 SpecificTypeNone,
36 SpecificTypeDouble,
37 SpecificTypeString,
38 };
39 SpecificTypes m_type;
40
41 double m_double;
42 String m_string;
43
44 friend v8::Local<v8::Value> toV8(const DoubleOrString&, v8::Local<v8::Object >, v8::Isolate*);
45 };
46
47 class V8DoubleOrString final {
48 public:
49 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, DoubleOrString&, Exce ptionState&);
50 };
51
52 v8::Local<v8::Value> toV8(const DoubleOrString&, v8::Local<v8::Object>, v8::Isol ate*);
53
54 template <class CallbackInfo>
55 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, DoubleOrString& i mpl)
56 {
57 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
58 }
59
60 template <>
61 struct NativeValueTraits<DoubleOrString> {
62 static DoubleOrString nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
63 };
64
65 class V8DoubleOrStringOrNull final {
66 public:
67 static void toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, Doubl eOrString& impl, ExceptionState& exceptionState)
68 {
69 if (isUndefinedOrNull(v8Value))
70 return;
71 V8DoubleOrString::toImpl(isolate, v8Value, impl, exceptionState);
72 }
73 };
74
75 } // namespace blink
76
77 #endif // DoubleOrString_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698