13 #ifndef OGLPLUS_ENUMERATIONS_1107121519_HPP
14 #define OGLPLUS_ENUMERATIONS_1107121519_HPP
16 #include <oglplus/config/compiler.hpp>
17 #include <oglplus/config/enums.hpp>
20 #include <oglplus/detail/enum_class.hpp>
21 #include <oglplus/detail/base_range.hpp>
26 #if OGLPLUS_DOCUMENTATION_ONLY
55 template <
typename Enumeration>
62 template <
typename Enum>
68 inline StrCRef ValueName_(GLenum*, GLenum)
73 template <
typename EnumType>
76 #if !OGLPLUS_NO_ENUM_VALUE_NAMES
77 typedef typename EnumBaseType<EnumType>::Type BaseType;
83 OGLPLUS_FAKE_USE(enum_value);
88 template <
typename EnumType>
89 inline aux::CastIterRange<
90 const typename EnumBaseType<EnumType>::Type*,
94 #if !OGLPLUS_NO_ENUM_VALUE_RANGES
95 return ValueRange_((EnumType*)
nullptr);
97 const typename EnumBaseType<EnumType>::Type *x =
nullptr;
98 return aux::CastIterRange<
99 const typename EnumBaseType<EnumType>::Type*,
112 template <
typename Enum,
bool Copy>
116 template <
typename Enum>
117 class EnumArray<Enum, false>
121 const GLenum* _enums;
127 , _enums(reinterpret_cast<const GLenum*>(enums))
130 std::size_t Count(
void)
const
135 const GLenum* Values(
void)
const
141 template <
typename Enum>
142 class EnumArray<Enum, true>
145 std::vector<GLenum> _enums;
152 for(std::size_t i=0; i!=count; ++i)
154 _enums[i] = GLenum(enums[i]);
158 std::size_t Count(
void)
const
160 return _enums.size();
163 const GLenum* Values(
void)
const
165 return _enums.data();
178 template <
typename Enum>
180 :
public aux::EnumArray<Enum, sizeof(Enum) != sizeof(GLenum)>
183 typedef aux::EnumArray<Enum, sizeof(Enum) != sizeof(GLenum)> Base_;
185 template <std::
size_t N>
186 EnumArray(
const Enum (&enums)[N])
190 EnumArray(
const std::vector<Enum>& enums)
191 : Base_(enums.size(), enums.data())
194 EnumArray(std::size_t count,
const Enum* enums)
195 : Base_(count, enums)
199 #endif // OGLPLUS_DOCUMENTATION_ONLY
203 #endif // include guard
StrCRef EnumValueName(Enum enum_value)
Returns the name of the GL enumerated value for an OGLplus enum value.
String type definition and related functions.
Range< Enum > EnumValueRange(void)
Returns a Range of values in an Enumeration.
String const reference wrapper template.
Definition: ref_tpl.hpp:72
StrCRefTpl< GLchar > StrCRef
String const reference wrapper.
Definition: ref.hpp:21