globjects  1.0.0.000000000000
Strict OpenGL objects wrapper.
NamedString.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <string>
5 
6 #include <glbinding/gl/types.h>
7 
11 
12 #include <globjects/globjects_api.h>
13 
14 
15 namespace globjects
16 {
17 
18 
19 class AbstractStringSource;
20 
21 class GLOBJECTS_API NamedString : public Referenced, protected ChangeListener
22 {
23 public:
24  static NamedString * create(const std::string & name, AbstractStringSource * string);
25  static NamedString * create(const std::string & name, const std::string & string);
26 
27  static bool isNamedString(const std::string & name);
28  static NamedString * obtain(const std::string & name);
29 
30 public:
31  const std::string & name() const;
32  std::string string() const;
33  gl::GLenum type() const;
34 
35  AbstractStringSource * stringSource() const;
36 
37  gl::GLint getParameter(gl::GLenum pname) const;
38 
39  virtual void notifyChanged(const Changeable * changeable) override;
40 
41 protected:
42  static bool hasNativeSupport();
43 
44  static NamedString * create(const std::string & name, AbstractStringSource * string, gl::GLenum type);
45  static NamedString * create(const std::string & name, const std::string & string, gl::GLenum type);
46 
47 protected:
48  void updateString();
49 
50  void createNamedString();
51  void deleteNamedString();
52 
53  NamedString(const std::string & name, AbstractStringSource * source, gl::GLenum type);
54 
55  virtual ~NamedString();
56 
57  void registerNamedString();
58  void deregisterNamedString();
59 
60 protected:
61  std::string m_name;
62 
64  gl::GLenum m_type;
65 };
66 
67 
68 } // namespace globjects
std::string m_name
Definition: NamedString.h:61
The ref_ptr class provides the interface for a reference pointer.
Definition: LogMessageBuilder.h:20
Contains all the classes that wrap OpenGL functionality.
ref_ptr< AbstractStringSource > m_source
Definition: NamedString.h:63
gl::GLenum m_type
Definition: NamedString.h:64
Superclass of all objects that want others to signal that they have changed.
Definition: Changeable.h:22
Allows listening to any Changeable.
Definition: ChangeListener.h:22
Definition: NamedString.h:21
Superclass for all types of static and dynamic strings, e.g. for the use as Shader code...
Definition: AbstractStringSource.h:25
Superclass for all classes that use reference counting in globjects.
Definition: Referenced.h:22