Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #ifndef UnionType_h | |
|
kojih
2013/05/15 09:28:26
I don't confident where to place this file.
Do you
| |
| 2 #define UnionType_h | |
| 3 | |
| 4 namespace WTF { | |
| 5 | |
| 6 template<typename Type0, typename Type1> | |
| 7 class UnionType2 { | |
| 8 public: | |
| 9 UnionType2() | |
| 10 { | |
| 11 } | |
| 12 UnionType2(PassRefPtr<Type0> value) | |
| 13 { | |
| 14 value0 = value; | |
| 15 } | |
| 16 UnionType2(PassRefPtr<Type1> value) | |
| 17 { | |
| 18 value1 = value; | |
| 19 } | |
| 20 bool isNull() const | |
| 21 { | |
| 22 return !value0 && !value1; | |
| 23 } | |
| 24 bool isValue0Enabled() const | |
| 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; | |
| 42 RefPtr<Type1> value1; | |
| 43 }; | |
| 44 | |
| 45 | |
| 46 } // namespace WTF | |
| 47 | |
| 48 #endif // UnionType_h | |
| OLD | NEW |