globjects  2.0.0.4363356ae2ef
Strict OpenGL objects wrapper.
Loading...
Searching...
No Matches
NamedString.h
Go to the documentation of this file.
1
2#pragma once
3
4
5#include <string>
6#include <memory>
7#include <set>
8
9#include <glbinding/gl/types.h>
10
12
13#include <globjects/globjects_api.h>
14
15
16namespace globjects
17{
18
19
20class AbstractStringSource;
21
22
23class GLOBJECTS_API NamedString : public Instantiator<NamedString>
24{
25public:
26 NamedString(const std::string & name, AbstractStringSource * source);
27 NamedString(const std::string & name, AbstractStringSource * source, gl::GLenum type);
28
29 virtual ~NamedString();
30
31 static bool isNamedString(const std::string & name);
32 static NamedString * getFromRegistry(const std::string & name);
33
34
35public:
36 const std::string & name() const;
37 std::string string() const;
38 gl::GLenum type() const;
39
41
42 gl::GLint getParameter(gl::GLenum pname) const;
43
44 virtual void notifyChanged(const AbstractStringSource * changeable);
45
47 virtual void removeSubject(AbstractStringSource * subject);
48
49
50protected:
51 static bool hasNativeSupport();
52
53
54protected:
56
59
62
63
64protected:
65 std::set<AbstractStringSource*> m_sourceSubjects;
66
67 std::string m_name;
68
70 gl::GLenum m_type;
71};
72
73
74} // namespace globjects
Superclass for all types of static and dynamic strings, e.g. for the use as Shader code.
Definition: AbstractStringSource.h:27
CRTP for creating objects similar to std::make_unique.
Definition: Instantiator.h:22
Definition: NamedString.h:24
const std::string & name() const
std::string string() const
gl::GLenum m_type
Definition: NamedString.h:70
gl::GLint getParameter(gl::GLenum pname) const
void addSubject(AbstractStringSource *subject)
virtual void notifyChanged(const AbstractStringSource *changeable)
gl::GLenum type() const
static bool hasNativeSupport()
NamedString(const std::string &name, AbstractStringSource *source, gl::GLenum type)
virtual void removeSubject(AbstractStringSource *subject)
std::string m_name
Definition: NamedString.h:67
static bool isNamedString(const std::string &name)
AbstractStringSource * stringSource() const
std::set< AbstractStringSource * > m_sourceSubjects
Definition: NamedString.h:65
NamedString(const std::string &name, AbstractStringSource *source)
AbstractStringSource * m_source
Definition: NamedString.h:69
static NamedString * getFromRegistry(const std::string &name)
Contains all the classes that wrap OpenGL functionality.