Core/Flags: Add Clear methods

This commit is contained in:
Lynix
2019-11-09 13:37:40 +01:00
parent c668d02747
commit a4bff0968b
3 changed files with 31 additions and 0 deletions

View File

@@ -48,6 +48,9 @@ namespace Nz
constexpr Flags(BitField value = 0);
constexpr Flags(E enumVal);
void Clear();
void Clear(const Flags& flags);
constexpr bool Test(const Flags& flags) const;
explicit constexpr operator bool() const;

View File

@@ -39,9 +39,35 @@ namespace Nz
{
}
/*!
* \brief Clear all flags
*
* \see Test
*/
template<typename E>
void Flags<E>::Clear()
{
m_value = 0;
}
/*!
* \brief Clear some flags
*
* \param flags Flags to be cleared
*
* \see Test
*/
template<typename E>
void Flags<E>::Clear(const Flags& flags)
{
m_value &= ~flags;
}
/*!
* \brief Tests if all flags from a Flags object are enabled
* \return True if all tested flags are enabled.
*
* \see Clear
*/
template<typename E>
constexpr bool Flags<E>::Test(const Flags& flags) const