13 #ifndef OGLPLUS_BITFIELD_1107121519_HPP
14 #define OGLPLUS_BITFIELD_1107121519_HPP
16 #include <oglplus/config/compiler.hpp>
18 #include <type_traits>
20 #if !OGLPLUS_NO_INITIALIZER_LISTS
21 #include <initializer_list>
27 template <
typename Enum>
30 template <
typename Enum>
33 typedef std::false_type Type;
55 template <
typename Bit>
59 typedef typename enums::EnumBaseType<Bit>::Type BF;
78 : _bits(BF(_bit_a) | BF(_bit_b))
81 #if OGLPLUS_DOCUMENTATION_ONLY
82 template <
typename Iter>
86 template <
typename Iter>
98 #if OGLPLUS_DOCUMENTATION_ONLY || !OGLPLUS_NO_INITIALIZER_LISTS
99 Bitfield(
const std::initializer_list<Bit>& bits)
103 for(
auto i=bits.begin(),e=bits.end(); i!=e; ++i)
118 this->_bits |= BF(b);
125 return (this->_bits & BF(b)) == BF(b);
128 OGLPLUS_EXPLICIT
operator BF (
void)
const
135 #define OGLPLUS_MAKE_BITFIELD(BITS) \
137 template <> struct EnumBaseType<BITS> { typedef GLbitfield Type; }; \
138 template <> struct IsBitfieldBit<BITS> { typedef std::true_type Type; }; \
140 inline oglplus::Bitfield<BITS> operator | (BITS b1, BITS b2) \
142 return Bitfield<BITS>(b1, b2); \
148 #endif // include guard
Bitfield(Bit _bit)
Construct a bitfield from a single strongly-typed enumeration value.
Definition: bitfield.hpp:73
This template serves as a wrapper for OpenGL bitfields.
Definition: bitfield.hpp:56
Bitfield & operator|=(Bit b)
Bitwise or operator for combining enumeration values into a bitfield.
Definition: bitfield.hpp:116
friend Bitfield operator|(Bitfield bf, Bit b)
Bitwise or operator for combining enumeration values into a bitfield.
Definition: bitfield.hpp:109
Bitfield(void)
Constructs an empty bitfield.
Definition: bitfield.hpp:63
bool Test(Bit b) const
Test if a specified bit is set.
Definition: bitfield.hpp:123
Bitfield(BF bits)
Construct a bitfield from the underlying type.
Definition: bitfield.hpp:68