Core/Flags: Add Clear methods
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user