AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
EnumFlag< T > Class Template Reference

#include "EnumFlag.h"

Public Member Functions

constexpr EnumFlag (T value)
 
constexpr EnumFlagoperator&= (EnumFlag right)
 
constexpr EnumFlagoperator|= (EnumFlag right)
 
constexpr EnumFlag operator~ () const
 
constexpr void RemoveFlag (EnumFlag flag)
 
constexpr bool HasFlag (T flag) const
 
constexpr bool HasAllFlags (T flags) const
 
constexpr operator T () const
 
constexpr std::underlying_type_t< T > AsUnderlyingType () const
 

Private Attributes

_value
 

Friends

constexpr friend EnumFlag operator& (EnumFlag left, EnumFlag right)
 
constexpr friend EnumFlag operator| (EnumFlag left, EnumFlag right)
 

Detailed Description

template<typename T>
class EnumFlag< T >

Constructor & Destructor Documentation

◆ EnumFlag()

template<typename T >
constexpr EnumFlag< T >::EnumFlag ( value)
inlineconstexpr
70 : _value(value)
71 {
72 }
T _value
Definition: EnumFlag.h:128

Member Function Documentation

◆ AsUnderlyingType()

template<typename T >
constexpr std::underlying_type_t< T > EnumFlag< T >::AsUnderlyingType ( ) const
inlineconstexpr
123 {
124 return static_cast<std::underlying_type_t<T>>(_value);
125 }

References EnumFlag< T >::_value.

◆ HasAllFlags()

template<typename T >
constexpr bool EnumFlag< T >::HasAllFlags ( flags) const
inlineconstexpr
113 {
114 return (_value & flags) == flags;
115 }

References EnumFlag< T >::_value.

◆ HasFlag()

template<typename T >
constexpr bool EnumFlag< T >::HasFlag ( flag) const
inlineconstexpr
107 {
108 using i = std::underlying_type_t<T>;
109 return static_cast<i>(_value & flag) != static_cast<i>(0);
110 }

References EnumFlag< T >::_value.

Referenced by SmartScript::ProcessAction().

◆ operator T()

template<typename T >
constexpr EnumFlag< T >::operator T ( ) const
inlineconstexpr
118 {
119 return _value;
120 }

References EnumFlag< T >::_value.

◆ operator&=()

template<typename T >
constexpr EnumFlag & EnumFlag< T >::operator&= ( EnumFlag< T >  right)
inlineconstexpr
75 {
76 _value &= right._value;
77 return *this;
78 }

References EnumFlag< T >::_value.

◆ operator|=()

template<typename T >
constexpr EnumFlag & EnumFlag< T >::operator|= ( EnumFlag< T >  right)
inlineconstexpr
86 {
87 _value |= right._value;
88 return *this;
89 }

References EnumFlag< T >::_value.

◆ operator~()

template<typename T >
constexpr EnumFlag EnumFlag< T >::operator~ ( ) const
inlineconstexpr
97 {
98 return static_cast<T>(~static_cast<std::underlying_type_t<T>>(_value));
99 }

References EnumFlag< T >::_value.

◆ RemoveFlag()

template<typename T >
constexpr void EnumFlag< T >::RemoveFlag ( EnumFlag< T >  flag)
inlineconstexpr
102 {
103 _value &= ~flag._value;
104 }

References EnumFlag< T >::_value.

Friends And Related Function Documentation

◆ operator&

template<typename T >
constexpr friend EnumFlag operator& ( EnumFlag< T >  left,
EnumFlag< T >  right 
)
friend
81 {
82 return left &= right;
83 }

◆ operator|

template<typename T >
constexpr friend EnumFlag operator| ( EnumFlag< T >  left,
EnumFlag< T >  right 
)
friend
92 {
93 return left |= right;
94 }

Member Data Documentation

◆ _value