glbinding  2.1.1.000000000000
A C++ binding for the OpenGL API, generated using the gl.xml specification.
SharedBitfield.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <type_traits>
5
6
7namespace glbinding
8{
9
17template <typename... Types>
19
20// intersection
21
33template<typename T, typename... Types>
35{
36 static const bool value = false;
37};
38
50template<typename T, typename U, typename... Types>
51struct is_member_of_SharedBitfield<T, U, Types...>
52{
53 static const bool value = std::conditional<std::is_same<T, U>::value, std::true_type, is_member_of_SharedBitfield<T, Types...>>::type::value;
54};
55
62template<typename, typename>
64{
65};
66
76template<typename T, typename... Types>
78{
79 using type = SharedBitfield<T, Types...>;
80};
81
86template<typename, typename>
88{
90};
91
103template<typename T, typename... Types, typename... OtherTypes>
104struct intersect_SharedBitfield<SharedBitfield<T, Types...>, SharedBitfield<OtherTypes...>>
105{
106 using type = typename std::conditional<!is_member_of_SharedBitfield<T, OtherTypes...>::value, typename intersect_SharedBitfield<SharedBitfield<Types...>, SharedBitfield<OtherTypes...>>::type, typename prepend_to_SharedBitfield<T, typename intersect_SharedBitfield<SharedBitfield<Types...>, SharedBitfield<OtherTypes...>>::type>::type>::type;
107};
108
109
110// implementation
111
112
120template <typename T>
122{
123public:
124 using UnderlyingType = T;
125
133 SharedBitfieldBase(T value);
134
142 explicit operator T() const;
143protected:
145};
146
151template <>
153{};
154
163template <typename Type>
164class SharedBitfield<Type> : public SharedBitfieldBase<typename std::underlying_type<Type>::type>
165{
166public:
168
178 template <typename ConstructionType>
179 SharedBitfield(ConstructionType value);
180
188 SharedBitfield(typename std::underlying_type<Type>::type value);
189
197 operator Type() const;
198
211 template <typename... T>
212 auto operator|(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;
213
223 template <typename... T>
224 auto operator|=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;
225
238 template <typename... T>
239 auto operator&(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;
240
250 template <typename... T>
251 auto operator&=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;
252
265 template <typename... T>
266 auto operator^(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;
267
277 template <typename... T>
278 auto operator^=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;
279
292 template <typename... T>
293 auto operator==(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, bool>::type;
294
309 template <typename T>
310 auto operator==(T other) const -> typename std::enable_if<is_member_of_SharedBitfield<T, Type>::value, bool>::type;
311};
312
322template <typename Type, typename... Types>
323class SharedBitfield<Type, Types...> : public SharedBitfield<Types...>
324{
325public:
326 using UnderlyingType = typename SharedBitfield<Types...>::UnderlyingType;
327
337 template <typename ConstructionType>
338 SharedBitfield(ConstructionType value);
339
347 SharedBitfield(typename std::underlying_type<Type>::type value);
348
356 operator Type() const;
357
370 template <typename... T>
371 auto operator|(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;
372
382 template <typename... T>
383 auto operator|=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;
384
397 template <typename... T>
398 auto operator&(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;
399
409 template <typename... T>
410 auto operator&=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;
411
424 template <typename... T>
425 auto operator^(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type>::type;
426
436 template <typename... T>
437 auto operator^=(SharedBitfield<T...> other) -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, SharedBitfield &>::type;
438
451 template <typename... T>
452 auto operator==(SharedBitfield<T...> other) const -> typename std::enable_if<!std::is_same<typename intersect_SharedBitfield<SharedBitfield, SharedBitfield<T...>>::type, SharedBitfield<>>::value, bool>::type;
453
468 template <typename T>
469 auto operator==(T other) const -> typename std::enable_if<is_member_of_SharedBitfield<T, Type, Types...>::value, bool>::type;
470};
471
472
473// operators
474
475
494template <typename Enum, typename ConvertibleEnum>
495typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
496operator|(Enum a, ConvertibleEnum b);
497
516template <typename ConvertibleEnum, typename Enum>
517typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
518operator|(ConvertibleEnum a, Enum b);
519
538template <typename Enum, typename ConvertibleEnum>
539typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
540operator|=(Enum & a, ConvertibleEnum b);
541
560template <typename Enum, typename ConvertibleEnum>
561typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
562operator&(Enum a, ConvertibleEnum b);
563
582template <typename ConvertibleEnum, typename Enum>
583typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
584operator&(ConvertibleEnum a, Enum b);
585
604template <typename Enum, typename ConvertibleEnum>
605typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
606operator&=(Enum & a, ConvertibleEnum b);
607
626template <typename Enum, typename ConvertibleEnum>
627typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
628operator^(Enum a, ConvertibleEnum b);
629
648template <typename ConvertibleEnum, typename Enum>
649typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
650operator^(ConvertibleEnum a, Enum b);
651
670template <typename Enum, typename ConvertibleEnum>
671typename std::enable_if<std::is_base_of<SharedBitfieldBase<typename std::underlying_type<typename std::enable_if<std::is_enum<Enum>::value, Enum>::type>::type>, ConvertibleEnum>::value, Enum>::type
672operator^=(Enum & a, ConvertibleEnum b);
673
674
675} // namespace glbinding
676
677
typename SharedBitfield< Types... >::UnderlyingType UnderlyingType
inherit UnderlyingType declaration
Definition: SharedBitfield.h:326
typename SharedBitfieldBase< typename std::underlying_type< Type >::type >::UnderlyingType UnderlyingType
inherit UnderlyingType declaration
Definition: SharedBitfield.h:167
Invalid SharedBitfield class as it contains no valid bitfield types.
Definition: SharedBitfield.h:153
The base class of a SharedBitfield, containing the actual (and convertible) bitfield value.
Definition: SharedBitfield.h:122
SharedBitfieldBase(T value)
Constructor.
Definition: SharedBitfield.inl:10
T UnderlyingType
Propagate underlying type.
Definition: SharedBitfield.h:124
T m_value
The value of the SharedBitfield.
Definition: SharedBitfield.h:144
A representation of a bitfield value that could be member of multiple bitfield types as allowed in Op...
Definition: SharedBitfield.h:18
Contains all the classes of glbinding.
GLBINDING_API CallbackMask operator^(CallbackMask a, CallbackMask b)
External operator for bit-wise 'xor' of CallbackMasks.
GLBINDING_API CallbackMask & operator|=(CallbackMask &a, CallbackMask b)
External operator for bit-wise 'or' assignment of CallbackMasks.
GLBINDING_API CallbackMask & operator^=(CallbackMask &a, CallbackMask b)
External operator for bit-wise 'xor' assignment of CallbackMasks.
GLBINDING_API CallbackMask operator&(CallbackMask a, CallbackMask b)
External operator for bit-wise 'and' of CallbackMasks.
GLBINDING_API CallbackMask operator|(CallbackMask a, CallbackMask b)
External operator for bit-wise 'or' of CallbackMasks.
GLBINDING_API CallbackMask & operator&=(CallbackMask &a, CallbackMask b)
External operator for bit-wise 'and' assignment of CallbackMasks.
typename std::conditional<!is_member_of_SharedBitfield< T, OtherTypes... >::value, typename intersect_SharedBitfield< SharedBitfield< Types... >, SharedBitfield< OtherTypes... > >::type, typename prepend_to_SharedBitfield< T, typename intersect_SharedBitfield< SharedBitfield< Types... >, SharedBitfield< OtherTypes... > >::type >::type >::type type
Result of the intersection.
Definition: SharedBitfield.h:106
Break condition for the SharedBitfield intersection.
Definition: SharedBitfield.h:88
SharedBitfield<> type
Result of the intersection; always empty for non-overlapping SharedBitfield type lists.
Definition: SharedBitfield.h:89
Break condition for the is_member_of_SharedBitfield metaprogramming.
Definition: SharedBitfield.h:35
static const bool value
result of the inclusion test; always false since the list of types to test against is empty
Definition: SharedBitfield.h:36
Break condition for the SharedBitfield type concatenation.
Definition: SharedBitfield.h:64