Module: wine Branch: master Commit: 912f040748a39e2a2a83f22f81e4cd1204da870a URL: http://source.winehq.org/git/wine.git/?a=commit;h=912f040748a39e2a2a83f22f81...
Author: Maarten Lankhorst m.b.lankhorst@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