Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
propertymanager.h
1 #pragma once
2 
3 #include <list>
4 #include <memory>
5 #include <stdint.h>
6 #include <string>
7 
8 #include <glm/glm.hpp>
9 
10 #include <glow/Changeable.h>
11 #include <unordered_map>
12 #include <map>
13 
14 
15 class InputMapping;
16 
17 template<typename T> class PropertyImpl;
18 template<typename T> class PropertyCollection;
20 
27 class PropertyManager : public glow::Changeable {
28 public:
30  virtual ~PropertyManager();
31 
32  void load(const std::string& file, const std::string& prefix = "");
33 
34  template<typename T> PropertyImpl<T>* getImpl(const std::string& key);
35  template<typename T> PropertyImpl<T>* getImpl(const std::string& key, const T& defaultValue);
36 
37  static PropertyManager* instance();
38  static void reset();
39 
40  template<typename T> T get(const std::string& name);
41  template<typename T> T get(const std::string& name, const T& defaultValue);
42 
43 
44 protected:
45  template<typename T>
46  PropertyCollection<T>* getPropertyCollection();
47  template<typename T>
48  void addPropertyCollection(PropertyCollection<T>* collection);
49 
50  std::unordered_map<const std::type_info*, std::unique_ptr<AbstractPropertyCollection>> m_propertyCollections;
51 
52  static PropertyManager* s_instance;
53 };
54 
55 #include "propertymanager.inl"
Definition: propertycollection.h:20
Definition: inputmapping.h:16
Definition: propertymanager.h:27
Definition: propertycollection.h:11
Definition: property.h:6