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

Side by Side Diff: Source/bindings/tests/results/core/StringOrDouble.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 StringOrDouble_h
8 #define StringOrDouble_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 StringOrDouble final {
18 ALLOW_ONLY_INLINE_ALLOCATION();
19 public:
20 StringOrDouble();
21 bool isNull() const { return m_type == SpecificTypeNone; }
22
23 bool isString() const { return m_type == SpecificTypeString; }
24 String getAsString() const;
25 void setString(String);
26 static StringOrDouble fromString(String);
27
28 bool isDouble() const { return m_type == SpecificTypeDouble; }
29 double getAsDouble() const;
30 void setDouble(double);
31 static StringOrDouble fromDouble(double);
32
33 private:
34 enum SpecificTypes {
35 SpecificTypeNone,
36 SpecificTypeString,
37 SpecificTypeDouble,
38 };
39 SpecificTypes m_type;
40
41 String m_string;
42 double m_double;
43
44 friend v8::Local<v8::Value> toV8(const StringOrDouble&, v8::Local<v8::Object >, v8::Isolate*);
45 };
46
47 class V8StringOrDouble final {
48 public:
49 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrDouble&, Exce ptionState&);
50 };
51
52 v8::Local<v8::Value> toV8(const StringOrDouble&, v8::Local<v8::Object>, v8::Isol ate*);
53
54 template <class CallbackInfo>
55 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrDouble& i mpl)
56 {
57 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
58 }
59
60 template <>
61 struct NativeValueTraits<StringOrDouble> {
62 static StringOrDouble nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
63 };
64
65 } // namespace blink
66
67 #endif // StringOrDouble_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698