globjects  2.0.0.630135941c42
Strict OpenGL objects wrapper.
Loading...
Searching...
No Matches
StringTemplate.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <string>
5#include <map>
6
7#include <globjects/globjects_api.h>
8
11
12
13namespace globjects
14{
15
16
17class GLOBJECTS_API StringTemplate : public AbstractStringSource, public Instantiator<StringTemplate>
18{
19public:
21 virtual ~StringTemplate();
22
23 virtual std::string string() const override;
24
25 void replace(const std::string & original, const std::string & str);
26 void replace(const std::string & original, int i);
27
29
30protected:
31 mutable std::string m_modifiedSource;
33
34 std::map<std::string, std::string> m_replacements;
35
36 void invalidate();
37 std::string modifiedSource() const;
38
39 virtual void notifyChanged(const AbstractStringSource * changeable) override;
40};
41
42
43} // 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 StringTemplate.h:18
void replace(const std::string &original, int i)
std::map< std::string, std::string > m_replacements
Definition StringTemplate.h:34
bool m_modifiedSourceValid
Definition StringTemplate.h:32
virtual std::string string() const override
std::string modifiedSource() const
StringTemplate(AbstractStringSource *source)
std::string m_modifiedSource
Definition StringTemplate.h:31
void replace(const std::string &original, const std::string &str)
virtual void notifyChanged(const AbstractStringSource *changeable) override
Contains all the classes that wrap OpenGL functionality.