OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef Nullable_h | 5 #ifndef Nullable_h |
6 #define Nullable_h | 6 #define Nullable_h |
7 | 7 |
8 #include "wtf/Assertions.h" | 8 #include "wtf/Assertions.h" |
9 | 9 |
10 namespace WebCore { | 10 namespace blink { |
11 | 11 |
12 template <typename T> | 12 template <typename T> |
13 class Nullable { | 13 class Nullable { |
14 public: | 14 public: |
15 Nullable() | 15 Nullable() |
16 : m_value() | 16 : m_value() |
17 , m_isNull(true) { } | 17 , m_isNull(true) { } |
18 | 18 |
19 Nullable(const T& value) | 19 Nullable(const T& value) |
20 : m_value(value) | 20 : m_value(value) |
(...skipping 18 matching lines...) Expand all Loading... |
39 bool operator==(const Nullable& other) const | 39 bool operator==(const Nullable& other) const |
40 { | 40 { |
41 return (m_isNull && other.m_isNull) || (!m_isNull && !other.m_isNull &&
m_value == other.m_value); | 41 return (m_isNull && other.m_isNull) || (!m_isNull && !other.m_isNull &&
m_value == other.m_value); |
42 } | 42 } |
43 | 43 |
44 private: | 44 private: |
45 T m_value; | 45 T m_value; |
46 bool m_isNull; | 46 bool m_isNull; |
47 }; | 47 }; |
48 | 48 |
49 } // namespace WebCore | 49 } // namespace blink |
50 | 50 |
51 #endif // Nullable_h | 51 #endif // Nullable_h |
OLD | NEW |