5#ifndef FLUTTER_IMPELLER_BASE_MASK_H_
6#define FLUTTER_IMPELLER_BASE_MASK_H_
12template <
typename EnumType_>
21#define IMPELLER_ENUM_IS_MASK(enum_name) \
23 struct MaskTraits<enum_name> { \
24 static constexpr bool kIsMask = true; \
32template <
typename EnumType_>
37 constexpr Mask() =
default;
50 explicit constexpr operator MaskType()
const {
return mask_; }
52 explicit constexpr operator bool()
const {
return !!mask_; }
58 return mask_ < other.mask_;
62 return mask_ > other.mask_;
66 return mask_ >= other.mask_;
70 return mask_ <= other.mask_;
74 return mask_ == other.mask_;
78 return mask_ != other.mask_;
108 mask_ |= other.mask_;
113 mask_ &= other.mask_;
118 mask_ ^= other.mask_;
130 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
132 const EnumType& rhs) {
138 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
140 const EnumType& rhs) {
146 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
148 const EnumType& rhs) {
154 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
161 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
169 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
177 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
186template <
typename EnumType,
187 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
193template <
typename EnumType,
194 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
200template <
typename EnumType,
201 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
207template <
typename EnumType,
208 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
214template <
typename EnumType,
215 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
221template <
typename EnumType,
222 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
constexpr Mask< EnumType > operator~(const EnumType &other)
constexpr bool operator>=(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr bool operator>(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr Mask< EnumType > operator|(const EnumType &lhs, const EnumType &rhs)
constexpr Mask< EnumType > operator&(const EnumType &lhs, const EnumType &rhs)
constexpr bool operator<(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr bool operator==(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr bool operator<=(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr bool operator!=(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr Mask< EnumType > operator^(const EnumType &lhs, const EnumType &rhs)
static constexpr bool kIsMask
constexpr Mask< EnumType > & operator=(const Mask< EnumType > &)=default
constexpr Mask< EnumType > & operator&=(const Mask< EnumType > &other)
constexpr Mask< EnumType > operator|(const Mask< EnumType > &other) const
constexpr Mask< EnumType > operator~() const
constexpr Mask(const Mask< EnumType > &other)=default
constexpr bool operator<=(const Mask< EnumType > &other) const
constexpr bool operator!() const
constexpr Mask< EnumType > & operator=(Mask< EnumType > &&)=default
constexpr Mask< EnumType > & operator|=(const Mask< EnumType > &other)
constexpr bool operator>(const Mask< EnumType > &other) const
constexpr Mask(Mask< EnumType > &&other)=default
constexpr bool operator!=(const Mask< EnumType > &other) const
constexpr bool operator>=(const Mask< EnumType > &other) const
constexpr bool operator<(const Mask< EnumType > &other) const
constexpr Mask< EnumType > operator^(const Mask< EnumType > &other) const
constexpr Mask< EnumType > & operator^=(const Mask< EnumType > &other)
constexpr Mask(EnumType type)
constexpr Mask(MaskType mask)
constexpr bool operator==(const Mask< EnumType > &other) const
typename std::underlying_type< EnumType >::type MaskType
constexpr Mask< EnumType > operator&(const Mask< EnumType > &other) const