glbinding  2.1.1.000000000000
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
5#include <ostream>
6
7
8namespace
9{
10
11
12template <typename... Arguments>
13struct ValueAdder;
14
15template <>
16struct ValueAdder<>
17{
18 static void add(std::vector<glbinding::AbstractValue*> &)
19 {
20 }
21};
22
23template <typename Argument, typename... Arguments>
24struct ValueAdder<Argument, Arguments...>
25{
26 static void add(std::vector<glbinding::AbstractValue*> & values, Argument value, Arguments&&... rest)
27 {
28 values.push_back(glbinding::createValue<Argument>(value));
29 ValueAdder<Arguments...>::add(values, std::forward<Arguments>(rest)...);
30 }
31};
32
33template <typename... Arguments>
34void addValuesTo(std::vector<glbinding::AbstractValue*> & values, Arguments&&... arguments)
35{
36 ValueAdder<Arguments...>::add(values, std::forward<Arguments>(arguments)...);
37}
38
39
40} // namespace
41
42
43namespace glbinding
44{
45
46
47template <typename T>
49: value(_value)
50{
51}
52
53template <typename T>
54void Value<T>::printOn(std::ostream & stream) const
55{
56 stream << value;
57}
58
59template <typename Argument>
64
65template <typename... Arguments>
66std::vector<AbstractValue*> createValues(Arguments&&... arguments)
67{
68 auto values = std::vector<AbstractValue*>{};
69 addValuesTo(values, std::forward<Arguments>(arguments)...);
70 return values;
71}
72
73
74} // namespace glbinding
The AbstractValue class represents the superclass of a printable wrapper around an OpenGL data type.
Definition AbstractValue.h:21
Value(const T &value)
Constructor.
Definition Value.inl:48
virtual void printOn(std::ostream &stream) const override
Prints the contents of this Value on a stream.
Definition Value.inl:54
Contains all the classes of glbinding.
std::vector< AbstractValue * > createValues(Arguments &&... arguments)
A wrapper around the creation of a vector of arguments.
Definition Value.inl:66
AbstractValue * createValue(const Argument &argument)
A wrapper around the type deduction and memory allocation of a specific argument.
Definition Value.inl:60