Add helper methods to FlagsEnum where I can make sure that it actually works forsenT
This commit is contained in:
+12
-1
@@ -12,7 +12,7 @@ class FlagsEnum
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FlagsEnum()
|
FlagsEnum()
|
||||||
: value((T)0)
|
: value(static_cast<T>(0))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,18 @@ public:
|
|||||||
return (T &)((Q &)this->value ^= (Q)a);
|
return (T &)((Q &)this->value ^= (Q)a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnableFlag(T flag)
|
||||||
|
{
|
||||||
|
reinterpret_cast<Q &>(this->value) |= static_cast<Q>(flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HasFlag(Q flag) const
|
||||||
|
{
|
||||||
|
return (this->value & flag) == flag;
|
||||||
|
}
|
||||||
|
|
||||||
T value;
|
T value;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
Reference in New Issue
Block a user