20 #define QX_FLAGS_ENUM_CLASS(enumName) \
21 inline qx::flags<enumName> operator|(enumName left, enumName right) \
23 return qx::flags(left) | right; \
25 inline qx::flags<enumName> operator&(enumName left, enumName right) \
27 return qx::flags(left) & right; \
29 inline qx::flags<enumName> operator^(enumName left, enumName right) \
31 return qx::flags(left) ^ right; \
58 template<enumeration_c enum_t>
61 using underlying_type = std::underlying_type_t<enum_t>;
66 constexpr
flags() noexcept =
default;
71 constexpr
void reverse() noexcept;
77 constexpr
void shift_left(
size_t nShift) noexcept;
85 constexpr
flags operator~()
const noexcept;
87 constexpr
flags& operator<<=(
size_t nShift) noexcept;
88 constexpr
flags& operator>>=(
size_t nShift) noexcept;
90 constexpr
flags operator<<(
size_t nShift)
const noexcept;
91 constexpr
flags operator>>(
size_t nShift)
const noexcept;
100 constexpr
flags(enum_t eFlag) noexcept;
107 template<
class... args_t>
108 requires(
sizeof...(args_t) >= 2 && are_specific_v<enum_t, args_t...>)
116 template<
class... args_t>
117 requires(
sizeof...(args_t) >= 1 && are_specific_v<enum_t, args_t...>)
118 constexpr
void add(args_t...
flags) noexcept;
125 template<
class... args_t>
126 requires(
sizeof...(args_t) >= 1 && are_specific_v<enum_t, args_t...>)
134 template<
class... args_t>
135 requires(
sizeof...(args_t) >= 1 && are_specific_v<enum_t, args_t...>)
136 constexpr
void xor_(args_t...
flags) noexcept;
138 constexpr
auto operator<=>(enum_t eFlag)
const noexcept;
139 constexpr
flags& operator=(enum_t eFlag) noexcept;
141 constexpr
flags& operator|=(enum_t eFlag) noexcept;
142 constexpr
flags& operator&=(enum_t eFlag) noexcept;
143 constexpr
flags& operator^=(enum_t eFlag) noexcept;
145 constexpr
flags operator|(enum_t eFlag)
const noexcept;
146 constexpr
flags operator&(enum_t eFlag)
const noexcept;
147 constexpr
flags operator^(enum_t eFlag)
const noexcept;
151 QX_COPYMOVABLE(
flags);
171 constexpr
auto operator<=>(
const flags&)
const noexcept =
default;
173 constexpr
flags& operator|=(
flags flags_) noexcept;
174 constexpr
flags& operator&=(
flags flags_) noexcept;
175 constexpr
flags& operator^=(
flags flags_) noexcept;
177 constexpr
flags operator|(
flags flags_)
const noexcept;
178 constexpr
flags operator&(
flags flags_)
const noexcept;
179 constexpr
flags operator^(
flags flags_)
const noexcept;
188 constexpr
bool contains(enum_t eFlag)
const noexcept;
196 template<
class... args_t>
197 requires(
sizeof...(args_t) >= 2 && are_specific_v<enum_t, args_t...>)
198 constexpr
bool contains_all(args_t...
flags)
const noexcept;
206 template<
class... args_t>
207 requires(
sizeof...(args_t) >= 2 && are_specific_v<enum_t, args_t...>)
217 underlying_type m_EnumFlags = 0;
222 #include <qx/containers/flags.inl>
Wrapper for enumerations to be used as a list of flags.
requires(sizeof...(args_t) >=1 &&are_specific_v< enum_t, args_t... >) const expr void add(args_t... flags) noexcept
Add all the flags specified.
requires(sizeof...(args_t) >=2 &&are_specific_v< enum_t, args_t... >) const expr flags(args_t... flags) noexcept
flags object constructor
constexpr void remove(flags flags_) noexcept
Remove all the flags specified.
constexpr void shift_left(size_t nShift) noexcept
Shift bits to the left.
constexpr bool contains(enum_t eFlag) const noexcept
Check if flag is present.
constexpr void xor_(flags flags_) noexcept
Apply a bitwise XOR to a flags value.
requires(sizeof...(args_t) >=1 &&are_specific_v< enum_t, args_t... >) const expr void xor_(args_t... flags) noexcept
Apply a bitwise XOR to a flags value.
constexpr void add(flags flags_) noexcept
Add all the flags specified.
requires(sizeof...(args_t) >=1 &&are_specific_v< enum_t, args_t... >) const expr void remove(args_t... flags) noexcept
Remove all the flags specified.
constexpr void reverse() noexcept
Reverse (or logically negotiate) all bits.
constexpr void shift_right(size_t nShift) noexcept
Shift bits to the right.
requires(sizeof...(args_t) >=2 &&are_specific_v< enum_t, args_t... >) const expr bool contains_all(args_t... flags) const noexcept
Check if all the specified flags are present.
requires(sizeof...(args_t) >=2 &&are_specific_v< enum_t, args_t... >) const expr bool contains_any(args_t... flags) const noexcept
Check if any of the specified flags is present.
constexpr underlying_type to_integer() const noexcept
Convert to the corresponding integer value.
constexpr bool contains_any(where_fwd_it_t itWhereBegin, where_fwd_it_t itWhereEnd, what_fwd_it_t itWhatBegin, what_fwd_it_t itWhatEnd)
Check that at least one element from the first range is equal to at least one element from the second...