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

Side by Side Diff: Source/wtf/UnionType.h

Issue 15076011: Support union return type for anonymous named/indexed getter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 7 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
OLDNEW
(Empty)
1 #ifndef UnionType_h
haraken 2013/05/15 10:56:25 You need to add a copyright.
2 #define UnionType_h
3
4 namespace WTF {
5
6 template<typename Type0, typename Type1>
7 class UnionType2 {
haraken 2013/05/15 10:56:25 Let's name it UnionMemberType, per the Web IDL spe
8 public:
9 UnionType2()
10 {
11 }
12 UnionType2(PassRefPtr<Type0> value)
haraken 2013/05/15 10:56:25 Please add 'explicit'.
13 {
14 value0 = value;
15 }
16 UnionType2(PassRefPtr<Type1> value)
haraken 2013/05/15 10:56:25 Ditto.
17 {
18 value1 = value;
19 }
20 bool isNull() const
21 {
22 return !value0 && !value1;
23 }
24 bool isValue0Enabled() const
haraken 2013/05/15 10:56:25 How about just adding enabledValue()? Then neither
25 {
26 return !value0;
27 }
28 PassRefPtr<Type0> getValue0() const
29 {
30 return value0;
31 }
32 bool isValue1Enabled() const
33 {
34 return !value1;
35 }
36 PassRefPtr<Type1> getValue1() const
37 {
38 return value1;
39 }
40 private:
41 RefPtr<Type0> value0;
haraken 2013/05/15 10:56:25 m_value0
42 RefPtr<Type1> value1;
haraken 2013/05/15 10:56:25 m_value1
43 };
44
45
46 } // namespace WTF
47
48 #endif // UnionType_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698