Maarten Lankhorst : include: Add DEFINE_ENUM_FLAG_OPERATORS to winnt.h.
Alexandre Julliard
julliard at winehq.org
Thu Nov 12 10:22:07 CST 2009
Module: wine
Branch: master
Commit: 912f040748a39e2a2a83f22f81e4cd1204da870a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=912f040748a39e2a2a83f22f81e4cd1204da870a
Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date: Wed Nov 11 12:34:46 2009 +0100
include: Add DEFINE_ENUM_FLAG_OPERATORS to winnt.h.
---
include/winnt.h | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/include/winnt.h b/include/winnt.h
index 032e9c1..a77a607 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -309,6 +309,21 @@ extern "C" {
#define ERROR_SEVERITY_WARNING 0x80000000
#define ERROR_SEVERITY_ERROR 0xC0000000
+#ifdef __cplusplus
+#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
+extern "C++" { \
+ inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
+ inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
+ inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
+ inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
+ inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
+ inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
+ inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
+}
+#else
+#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
+#endif
+
/* Microsoft's macros for declaring functions */
#ifdef __cplusplus
More information about the wine-cvs
mailing list