2015-07-26 21:39:49 +00:00
|
|
|
#ifndef ENUMUTIL
|
|
|
|
#define ENUMUTIL
|
|
|
|
|
2015-08-15 04:04:56 +00:00
|
|
|
#define DEFINE_ENUM_FLAGS(X) \
|
|
|
|
inline X operator|(const X& A, const X& B) { \
|
|
|
|
return (X) ((int) A | (int) B); \
|
|
|
|
} \
|
|
|
|
inline void operator|= (X& A, X& B) { \
|
|
|
|
A = A | B; \
|
|
|
|
} \
|
|
|
|
inline X operator|(const X& A, const int B) { \
|
|
|
|
return (X) ((int) A | B); \
|
|
|
|
} \
|
|
|
|
inline void operator|= (X& A, int B) { \
|
|
|
|
A = A | B; \
|
|
|
|
} \
|
|
|
|
inline X operator|(const X& A, const unsigned int B) { \
|
|
|
|
return (X) ((int) A | B); \
|
|
|
|
} \
|
|
|
|
inline void operator|= (X& A, unsigned int B) { \
|
|
|
|
A = A | B; \
|
|
|
|
} \
|
|
|
|
inline X operator&(const X& A, const X& B) { \
|
|
|
|
return (X) ((int) A & (int) B); \
|
|
|
|
} \
|
|
|
|
inline void operator&= (X& A, X& B) { \
|
|
|
|
A = A & B; \
|
|
|
|
} \
|
|
|
|
inline X operator&(const X& A, const int B) { \
|
|
|
|
return (X) ((int) A & B); \
|
|
|
|
} \
|
|
|
|
inline void operator&= (X& A, int B) { \
|
|
|
|
A = A & B; \
|
|
|
|
} \
|
|
|
|
inline X operator&(const X& A, const unsigned int B) { \
|
|
|
|
return (X) ((int) A & B); \
|
|
|
|
} \
|
|
|
|
inline void operator&= (X& A, unsigned int B) { \
|
|
|
|
A = A & B; \
|
2015-07-26 21:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // ENUMUTIL
|
|
|
|
|