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_>
35 using MaskType =
typename std::underlying_type<EnumType>::type;
37 constexpr Mask() =
default;
50 explicit constexpr operator MaskType()
const {
return mask_; }
52 explicit constexpr operator bool()
const {
return !!mask_; }
107 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
109 const EnumType& rhs) {
115 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
117 const EnumType& rhs) {
123 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
125 const EnumType& rhs) {
131 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
138 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
146 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
154 typename std::enable_if<MaskTraits<EnumType>::kIsMask,
bool>
::type =
true>
162template <
typename EnumType,
163 typename std::enable_if_t<MaskTraits<EnumType>::kIsMask,
bool> =
true>
constexpr Mask< EnumType > operator~(const EnumType &other)
constexpr Mask< EnumType > operator|(const EnumType &lhs, const EnumType &rhs)
constexpr Mask< EnumType > operator&(const EnumType &lhs, const EnumType &rhs)
constexpr auto operator<=>(const EnumType &lhs, const Mask< EnumType > &rhs)
constexpr Mask< EnumType > operator^(const EnumType &lhs, const EnumType &rhs)
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
constexpr Mask< EnumType > & operator=(Mask< EnumType > &&)=default
constexpr Mask< EnumType > & operator|=(const Mask< EnumType > &other)
constexpr Mask(Mask< EnumType > &&other)=default
constexpr auto operator<=>(const Mask< EnumType > &other) const =default
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)
typename std::underlying_type< EnumType >::type MaskType
constexpr Mask< EnumType > operator&(const Mask< EnumType > &other) const
static constexpr bool kIsMask