TachyonUI
0.1.0
High-performance UI for building tools.
Toggle main menu visibility
Loading...
Searching...
No Matches
gui_enum_operators.h
Go to the documentation of this file.
1
// This header defines TACHYON_ENUM_OPERATORS for enum class bitwise ops
2
3
#pragma once
4
5
// Macro to enable bitwise operators for enum classes
6
#define TACHYON_ENUM_OPERATORS(EnumType) \
7
inline static EnumType operator|(EnumType a, EnumType b) { return static_cast<EnumType>(static_cast<std::underlying_type_t<EnumType>>(a) | static_cast<std::underlying_type_t<EnumType>>(b)); } \
8
inline static EnumType operator&(EnumType a, EnumType b) { return static_cast<EnumType>(static_cast<std::underlying_type_t<EnumType>>(a) & static_cast<std::underlying_type_t<EnumType>>(b)); } \
9
inline static EnumType operator^(EnumType a, EnumType b) { return static_cast<EnumType>(static_cast<std::underlying_type_t<EnumType>>(a) ^ static_cast<std::underlying_type_t<EnumType>>(b)); } \
10
inline static EnumType operator~(EnumType a) { return static_cast<EnumType>(~static_cast<std::underlying_type_t<EnumType>>(a)); } \
11
inline static bool operator!(EnumType a) { return static_cast<std::underlying_type_t<EnumType>>(a) == 0; } \
12
inline static bool operator==(EnumType a, EnumType b) { return static_cast<std::underlying_type_t<EnumType>>(a) == static_cast<std::underlying_type_t<EnumType>>(b); } \
13
inline static bool operator!=(EnumType a, EnumType b) { return static_cast<std::underlying_type_t<EnumType>>(a) != static_cast<std::underlying_type_t<EnumType>>(b); } \
14
inline static EnumType& operator|=(EnumType& a, EnumType b) { a = a | b; return a; } \
15
inline static EnumType& operator&=(EnumType& a, EnumType b) { a = a & b; return a; } \
16
inline static EnumType& operator^=(EnumType& a, EnumType b) { a = a ^ b; return a; }
gui_core
gui_enum_operators.h
Generated by
1.18.0