Title: [141965] trunk/Source/WTF
- Revision
- 141965
- Author
- [email protected]
- Date
- 2013-02-05 20:30:28 -0800 (Tue, 05 Feb 2013)
Log Message
Fix EnumClass so that it can be used with switch statements.
https://bugs.webkit.org/show_bug.cgi?id=109004.
Reviewed by Sam Weinig.
* wtf/EnumClass.h:
(WTF::EnumClass::operator==):
(WTF::EnumClass::operator!=):
(WTF::EnumClass::operator<):
(WTF::EnumClass::operator<=):
(WTF::EnumClass::operator>):
(WTF::EnumClass::operator>=):
(EnumClass):
(WTF::EnumClass::operator Value):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (141964 => 141965)
--- trunk/Source/WTF/ChangeLog 2013-02-06 04:28:57 UTC (rev 141964)
+++ trunk/Source/WTF/ChangeLog 2013-02-06 04:30:28 UTC (rev 141965)
@@ -1,3 +1,20 @@
+2013-02-05 Mark Lam <[email protected]>
+
+ Fix EnumClass so that it can be used with switch statements.
+ https://bugs.webkit.org/show_bug.cgi?id=109004.
+
+ Reviewed by Sam Weinig.
+
+ * wtf/EnumClass.h:
+ (WTF::EnumClass::operator==):
+ (WTF::EnumClass::operator!=):
+ (WTF::EnumClass::operator<):
+ (WTF::EnumClass::operator<=):
+ (WTF::EnumClass::operator>):
+ (WTF::EnumClass::operator>=):
+ (EnumClass):
+ (WTF::EnumClass::operator Value):
+
2013-02-05 Oliver Hunt <[email protected]>
Disable TCMalloc hardening as it's breaking leaks.
Modified: trunk/Source/WTF/wtf/EnumClass.h (141964 => 141965)
--- trunk/Source/WTF/wtf/EnumClass.h 2013-02-06 04:28:57 UTC (rev 141964)
+++ trunk/Source/WTF/wtf/EnumClass.h 2013-02-06 04:30:28 UTC (rev 141965)
@@ -54,6 +54,7 @@
// Otherwise, it will use the EnumClass template below.
#if COMPILER_SUPPORTS(CXX_STRONG_ENUMS)
+
#define ENUM_CLASS(__enumName) \
enum class __enumName
@@ -100,6 +101,15 @@
ALWAYS_INLINE bool operator>(const EnumClass other) { return m_value > other.m_value; }
ALWAYS_INLINE bool operator>=(const EnumClass other) { return m_value >= other.m_value; }
+ ALWAYS_INLINE bool operator==(const Value value) { return m_value == value; }
+ ALWAYS_INLINE bool operator!=(const Value value) { return m_value != value; }
+ ALWAYS_INLINE bool operator<(const Value value) { return m_value < value; }
+ ALWAYS_INLINE bool operator<=(const Value value) { return m_value <= value; }
+ ALWAYS_INLINE bool operator>(const Value value) { return m_value > value; }
+ ALWAYS_INLINE bool operator>=(const Value value) { return m_value >= value; }
+
+ ALWAYS_INLINE operator Value() { return m_value; }
+
private:
Value m_value;
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes