219 typedef long long FlagCastType;
223 typedef long FlagCastType;
226 static_assert((
sizeof(T) <=
sizeof(FlagCastType)),
"Flags type may overflow.");
227 static_assert((std::is_enum<T>::value),
"Flags accept only enumeration types.");
234 inline Flags() : m_data{ static_cast<T>(0) } {};
238 inline Flags(T _initialData) : m_data{ _initialData } {}
246 inline Flags(
Flags&& _other) noexcept : m_data(std::move(_other.m_data)) {};
249 inline T
data(
void)
const {
return m_data; };
253 inline void set(T _data) { m_data = _data; };
257 inline void setFlag(T _flag) { m_data = m_data | _flag; };
262 inline void setFlag(T _flag,
bool _flagIsSet) {
263 if (_flagIsSet) { m_data = m_data | _flag; }
264 else { m_data = m_data & (~_flag); }
269 inline void removeFlag(T _flag) { m_data = m_data & (~_flag); };
273 inline bool flagIsSet(T _flag)
const {
return (m_data & _flag); };
276 inline operator T(
void)
const {
return m_data; };
279 inline operator bool(
void)
const {
return (
bool)m_data; };
281 inline Flags<T>& operator = (T _flag) { m_data = _flag;
return *
this; };
282 inline Flags<T>& operator = (
const Flags<T>& _other) { m_data = _other.m_data;
return *
this; };
283 inline Flags<T>& operator = (
Flags<T>&& _other) { m_data = std::move(_other.m_data);
return *
this; };
291 inline Flags<T>& operator |= (T _flag) { m_data = m_data | _flag;
return *
this; };
292 inline Flags<T>& operator |= (
const Flags<T>& _other) { m_data = m_data | _other.m_data;
return *
this; };
294 inline Flags<T>& operator &= (T _flag) { m_data = m_data & _flag;
return *
this; };
295 inline Flags<T>& operator &= (
const Flags<T>& _other) { m_data = m_data & _other.m_data;
return *
this; };
299 inline bool operator == (T _flag)
const {
return m_data == _flag; };
302 inline bool operator != (T _flag)
const {
return m_data != _flag; };
303 inline bool operator != (
const Flags<T>& _other)
const {
return m_data != _other.m_data; };