Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkEnumBitMask< E > Class Template Reference

#include <SkEnumBitMask.h>

Public Member Functions

SK_ALWAYS_INLINE constexpr SkEnumBitMask (E e)
 
SK_ALWAYS_INLINE constexpr operator bool () const
 
SK_ALWAYS_INLINE constexpr int value () const
 
SK_ALWAYS_INLINE constexpr bool operator== (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr bool operator!= (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator| (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator& (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator^ (SkEnumBitMask m) const
 
SK_ALWAYS_INLINE constexpr SkEnumBitMask operator~ () const
 
SK_ALWAYS_INLINE SkEnumBitMaskoperator|= (SkEnumBitMask m)
 
SK_ALWAYS_INLINE SkEnumBitMaskoperator&= (SkEnumBitMask m)
 
SK_ALWAYS_INLINE SkEnumBitMaskoperator^= (SkEnumBitMask m)
 

Detailed Description

template<typename E>
class SkEnumBitMask< E >

Wraps an enum that is used for flags, and enables masking with type safety. Example:

enum class MyFlags { kNone = 0, kA = 1, kB = 2, kC = 4, };

SK_MAKE_BITMASK_OPS(MyFlags)

...

SkEnumBitMask<MyFlags> flags = MyFlags::kA | MyFlags::kB;

if (flags & MyFlags::kB) {}

...

Definition at line 34 of file SkEnumBitMask.h.

Constructor & Destructor Documentation

◆ SkEnumBitMask()

template<typename E >
SK_ALWAYS_INLINE constexpr SkEnumBitMask< E >::SkEnumBitMask ( E  e)
inlineconstexpr

Definition at line 36 of file SkEnumBitMask.h.

36: SkEnumBitMask((int)e) {}
SK_ALWAYS_INLINE constexpr SkEnumBitMask(E e)
Definition: SkEnumBitMask.h:36

Member Function Documentation

◆ operator bool()

template<typename E >
SK_ALWAYS_INLINE constexpr SkEnumBitMask< E >::operator bool ( ) const
inlineexplicitconstexpr

Definition at line 38 of file SkEnumBitMask.h.

38{ return fValue; }

◆ operator!=()

template<typename E >
SK_ALWAYS_INLINE constexpr bool SkEnumBitMask< E >::operator!= ( SkEnumBitMask< E m) const
inlineconstexpr

Definition at line 42 of file SkEnumBitMask.h.

42{ return fValue != m.fValue; }

◆ operator&()

template<typename E >
SK_ALWAYS_INLINE constexpr SkEnumBitMask SkEnumBitMask< E >::operator& ( SkEnumBitMask< E m) const
inlineconstexpr

Definition at line 47 of file SkEnumBitMask.h.

47 {
48 return SkEnumBitMask(fValue & m.fValue);
49 }

◆ operator&=()

template<typename E >
SK_ALWAYS_INLINE SkEnumBitMask & SkEnumBitMask< E >::operator&= ( SkEnumBitMask< E m)
inline

Definition at line 56 of file SkEnumBitMask.h.

56{ return *this = *this & m; }

◆ operator==()

template<typename E >
SK_ALWAYS_INLINE constexpr bool SkEnumBitMask< E >::operator== ( SkEnumBitMask< E m) const
inlineconstexpr

Definition at line 41 of file SkEnumBitMask.h.

41{ return fValue == m.fValue; }

◆ operator^()

template<typename E >
SK_ALWAYS_INLINE constexpr SkEnumBitMask SkEnumBitMask< E >::operator^ ( SkEnumBitMask< E m) const
inlineconstexpr

Definition at line 50 of file SkEnumBitMask.h.

50 {
51 return SkEnumBitMask(fValue ^ m.fValue);
52 }

◆ operator^=()

template<typename E >
SK_ALWAYS_INLINE SkEnumBitMask & SkEnumBitMask< E >::operator^= ( SkEnumBitMask< E m)
inline

Definition at line 57 of file SkEnumBitMask.h.

57{ return *this = *this ^ m; }

◆ operator|()

template<typename E >
SK_ALWAYS_INLINE constexpr SkEnumBitMask SkEnumBitMask< E >::operator| ( SkEnumBitMask< E m) const
inlineconstexpr

Definition at line 44 of file SkEnumBitMask.h.

44 {
45 return SkEnumBitMask(fValue | m.fValue);
46 }

◆ operator|=()

template<typename E >
SK_ALWAYS_INLINE SkEnumBitMask & SkEnumBitMask< E >::operator|= ( SkEnumBitMask< E m)
inline

Definition at line 55 of file SkEnumBitMask.h.

55{ return *this = *this | m; }

◆ operator~()

template<typename E >
SK_ALWAYS_INLINE constexpr SkEnumBitMask SkEnumBitMask< E >::operator~ ( ) const
inlineconstexpr

Definition at line 53 of file SkEnumBitMask.h.

53{ return SkEnumBitMask(~fValue); }

◆ value()

template<typename E >
SK_ALWAYS_INLINE constexpr int SkEnumBitMask< E >::value ( ) const
inlineconstexpr

Definition at line 39 of file SkEnumBitMask.h.

39{ return fValue; }

The documentation for this class was generated from the following files: