10 template <
typename BitType>
28 template <
typename BitType>
31 using MaskType =
typename std::underlying_type<BitType>::type;
58 explicit constexpr operator bool() const noexcept {
return !!
m_mask; }
67 template <
typename BitType>
73 template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask,
bool>::type =
true>
79 template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask,
bool>::type =
true>
85 template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask,
bool>::type =
true>
91 template <typename BitType, typename std::enable_if<FlagTraits<BitType>::isBitmask,
bool>::type =
true>
97 template <
typename BitType>
103 template <
typename BitType>
109 template <
typename BitType>
116 #define FCT_DECLARE_FLAGS(BitType) \
118 struct FCT::FlagTraits<BitType> \
120 static constexpr bool isBitmask = true; \
122 using BitType##s = FCT::Flags<BitType>;
124 #define FCT_DECLARE_FLAG(BitType,flags) \
126 struct FCT::FlagTraits<BitType> \
128 static constexpr bool isBitmask = true; \
130 using flags = FCT::Flags<BitType>;
131 #define FCT_TO_FLAG(name,translateBitFunc,FlagBitType,FlagType) \
132 inline auto name(FlagType flags) \
134 auto result = translateBitFunc(static_cast<FlagBitType>(0)) | translateBitFunc(static_cast<FlagBitType>(0)); \
135 for (uint32_t i = 0; i < 32; ++i) { \
136 FlagBitType singleFlag = static_cast<FlagBitType>(1u << i); \
137 if (flags & singleFlag) { \
138 result |= translateBitFunc(singleFlag); \
143 #define FCT_TO_FLAGS(name,translateBitFunc,FlagBitType) FCT_TO_FLAG(name, translateBitFunc, FlagBitType, FlagBitType##s)
145 #define FCT_TO_VK_FLAG_BIT_BEGIN(FlagBit) \
146 inline vk::##FlagBit##FlagBits ToVk##FlagBit(FlagBit bit) \
150 #define FCT_TO_VK_FLAG_BIT_CASE(FlagBit,value,Value) \
151 case FlagBit::value: \
152 return vk::##FlagBit##FlagBits::e##Value;
153 #define FCT_TO_VK_FLAG_BIT_END(FlagBit) \
155 return vk::##FlagBit##FlagBits(0); \
158 #define FCT_TO_VK_FLAGS(FlagBit) \
159 FCT_TO_FLAGS(ToVk##FlagBit##s,ToVk##FlagBit,FlagBit)
constexpr Flags(BitType bit) noexcept
constexpr Flags< BitType > operator~() const noexcept
constexpr Flags() noexcept
constexpr Flags< BitType > operator|(Flags< BitType > const &rhs) const noexcept
Flags< BitType > & operator|=(Flags< BitType > const &rhs) noexcept
constexpr Flags< BitType > operator&(Flags< BitType > const &rhs) const noexcept
constexpr bool operator!() const noexcept
constexpr bool operator>(Flags< BitType > const &rhs) const noexcept
Flags< BitType > & operator^=(Flags< BitType > const &rhs) noexcept
Flags< BitType > & operator=(BitType bit) noexcept
constexpr Flags< BitType > operator^(Flags< BitType > const &rhs) const noexcept
constexpr bool operator<(Flags< BitType > const &rhs) const noexcept
constexpr Flags(Flags< BitType > const &rhs) noexcept=default
typename std::underlying_type< BitType >::type MaskType
constexpr bool operator!=(Flags< BitType > const &rhs) const noexcept
constexpr bool operator<=(Flags< BitType > const &rhs) const noexcept
constexpr bool operator>=(Flags< BitType > const &rhs) const noexcept
Flags< BitType > & operator=(Flags< BitType > const &rhs) noexcept=default
Flags< BitType > & operator&=(Flags< BitType > const &rhs) noexcept
constexpr bool operator==(Flags< BitType > const &rhs) const noexcept
constexpr Flags(MaskType flags) noexcept
constexpr Flags< BitType > operator~(BitType bits) noexcept
constexpr Flags< BitType > operator^(BitType lhs, BitType rhs) noexcept
constexpr Flags< BitType > operator|(BitType lhs, BitType rhs) noexcept
constexpr Flags< BitType > operator&(BitType lhs, BitType rhs) noexcept
static constexpr bool isBitmask