glbinding  3.3.0.0
A C++ binding for the OpenGL API, generated using the gl.xml specification.
Loading...
Searching...
No Matches
Value.inl
Go to the documentation of this file.
1
2#pragma once
3
4
5namespace
6{
7
8
9template <typename... Arguments>
10struct ValueAdder;
11
12template <>
13struct ValueAdder<>
14{
15 inline static void add(std::vector<std::unique_ptr<glbinding::AbstractValue>> &)
16 {
17 }
18};
19
20template <typename Argument, typename... Arguments>
21struct ValueAdder<Argument, Arguments...>
22{
23 inline static void add(std::vector<std::unique_ptr<glbinding::AbstractValue>> & values, Argument value, Arguments&&... rest)
24 {
25 values.push_back(glbinding::createValue<Argument>(value));
26 ValueAdder<Arguments...>::add(values, std::forward<Arguments>(rest)...);
27 }
28};
29
30template <typename... Arguments>
31inline void addValuesTo(std::vector<std::unique_ptr<glbinding::AbstractValue>> & values, Arguments&&... arguments)
32{
33 ValueAdder<Arguments...>::add(values, std::forward<Arguments>(arguments)...);
34}
35
36
37} // namespace
38
39
40namespace glbinding
41{
42
43
44template <typename T>
45GLBINDING_CONSTEXPR Value<T>::Value(const T & value)
46: m_value(value)
47{
48}
49
50template <typename T>
51GLBINDING_CONSTEXPR T Value<T>::value() const
52{
53 return m_value;
54}
55
56
57template <typename Argument>
58std::unique_ptr<AbstractValue> createValue(const Argument & argument)
59{
60 return std::unique_ptr<Value<Argument>>(new Value<Argument>(argument));
61}
62
63template <typename... Arguments>
64std::vector<std::unique_ptr<AbstractValue>> createValues(Arguments&&... arguments)
65{
66 auto values = std::vector<std::unique_ptr<AbstractValue>>{};
67 addValuesTo(values, std::forward<Arguments>(arguments)...);
68 return values;
69}
70
71
72} // namespace glbinding
The Value class represents a printable wrapper around an OpenGL data type.
Definition Value.h:30
GLBINDING_CONSTEXPR Value(const T &value)
Constructor.
Definition Value.inl:45
GLBINDING_CONSTEXPR T value() const
Get the value.
Definition Value.inl:51
Contains all the classes of glbinding.
std::vector< std::unique_ptr< AbstractValue > > createValues(Arguments &&... arguments)
A wrapper around the creation of a vector of arguments.
Definition Value.inl:64
std::unique_ptr< AbstractValue > createValue(const Argument &argument)
A wrapper around the type deduction and memory allocation of a specific argument.
Definition Value.inl:58