6 template<
class MaskT,
class FlagT, MaskT Mask = ~(MaskT())>
19 bitmask(
const FlagT &flag) :
24 bitmask(
const bitmask &other) :
29 inline bool has(
const FlagT &flag)
const
31 return 0 != (value() & flag);
34 inline bool has(
const bitmask &mask)
const
36 return 0 != (value() & mask);
39 inline bitmask& set(
const FlagT &flag)
45 inline bitmask& set(
const bitmask &mask)
51 inline bitmask& reset(
const FlagT &flag)
57 inline bitmask& reset(
const bitmask &mask)
59 _val &= ~mask.value();
63 inline bitmask& keep(
const FlagT &flag)
69 inline bitmask& keep(
const bitmask &mask)
75 inline bitmask& flip(
const FlagT &flag)
81 inline bitmask& flip(
const bitmask &mask)
87 inline bitmask operator|(
const FlagT &flag)
const
89 return *
this | bitmask(flag);
92 inline bitmask operator|(
const bitmask &mask)
const
94 return value() | mask.value();
97 inline bitmask operator&(
const FlagT &flag)
const
99 return *
this & bitmask(flag);
102 inline bitmask operator&(
const bitmask &mask)
const
104 return value() & mask.value();
107 inline bitmask operator^(
const FlagT &flag)
const
109 return *
this ^ bitmask(flag);
112 inline bitmask operator^(
const bitmask &mask)
const
114 return value() ^ mask.value();
117 inline bitmask& operator=(
const FlagT &flag)
119 *
this = bitmask(flag);
123 inline bitmask& operator=(
const bitmask &other)
125 _val = other.value();
129 inline bitmask& operator|=(
const FlagT &flag)
134 inline bitmask& operator|=(
const bitmask &other)
139 inline bitmask& operator&=(
const FlagT &flag)
144 inline bitmask& operator&=(
const bitmask &other)
149 inline bitmask& operator^=(
const FlagT &flag)
154 inline bitmask& operator^=(
const bitmask &other)
159 inline bool operator==(
const FlagT &flag)
const
161 return value() == flag;
164 inline bool operator==(
const bitmask &other)
const
166 return value() == other.value();
169 inline bool operator!=(
const FlagT &flag)
const
171 return value() != flag;
174 inline bool operator!=(
const bitmask &other)
const
176 return value() != other.value();
179 inline bool operator<(
const bitmask &other)
const
181 return value() < other.value();
184 inline bool operator>(
const bitmask &other)
const
186 return value() > other.value();
189 inline operator MaskT()
const
198 MaskT value()
const {
return _val & Mask; }
204template<
class MaskT,
class FlagT, MaskT Mask>
205inline cppbitmasks::bitmask<MaskT, FlagT, Mask> operator|(
const FlagT &flag,
const cppbitmasks::bitmask<MaskT, FlagT, Mask> &mask)
210template<
class MaskT,
class FlagT, MaskT Mask>
211inline cppbitmasks::bitmask<MaskT, FlagT, Mask> operator&(
const FlagT &flag,
const cppbitmasks::bitmask<MaskT, FlagT, Mask> &mask)
216template<
class MaskT,
class FlagT, MaskT Mask>
217inline cppbitmasks::bitmask<MaskT, FlagT, Mask> operator^(
const FlagT &flag,
const cppbitmasks::bitmask<MaskT, FlagT, Mask> &mask)
222template<
class MaskT,
class FlagT, MaskT Mask>
223inline cppbitmasks::bitmask<MaskT, FlagT, Mask> operator==(
const FlagT &flag,
const cppbitmasks::bitmask<MaskT, FlagT, Mask> &mask)
228template<
class MaskT,
class FlagT, MaskT Mask>
229inline cppbitmasks::bitmask<MaskT, FlagT, Mask> operator!=(
const FlagT &flag,
const cppbitmasks::bitmask<MaskT, FlagT, Mask> &mask)