Emergency 20 Dokumentation  4.2.0
FireMaterialManager.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2018 Promotion Software GmbH
2 
3 
4 //[-------------------------------------------------------]
5 //[ Header guard ]
6 //[-------------------------------------------------------]
7 #pragma once
8 
9 
10 //[-------------------------------------------------------]
11 //[ Includes ]
12 //[-------------------------------------------------------]
13 #include "em5/Export.h"
14 #include "em5/fire/FireMaterial.h"
15 
17 
18 #include <boost/signals2.hpp>
19 
20 
21 //[-------------------------------------------------------]
22 //[ Forward declarations ]
23 //[-------------------------------------------------------]
24 namespace qsf
25 {
26  class AssetSystem;
27 }
28 
29 
30 //[-------------------------------------------------------]
31 //[ Namespace ]
32 //[-------------------------------------------------------]
33 namespace em5
34 {
35 
36 
37  //[-------------------------------------------------------]
38  //[ Classes ]
39  //[-------------------------------------------------------]
47  class EM5_API_EXPORT FireMaterialManager : public qsf::ElementManager<uint32, FireMaterial>
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Public Boost signals ]
53  //[-------------------------------------------------------]
54  public:
55  boost::signals2::signal<void ()> FireMaterialsChanged;
56 
57 
58  //[-------------------------------------------------------]
59  //[ Public methods ]
60  //[-------------------------------------------------------]
61  public:
67 
72  virtual ~FireMaterialManager();
73 
78  void loadAssets();
79 
84  void saveAssets();
85 
93  bool loadByFilename(const std::string& filename);
94 
102  bool saveByFilename(const std::string& filename);
103 
114  const FireMaterial* getFireMaterialByName(const std::string& name);
115 
129  std::string findUniqueNameForMaterial(const std::string& name);
130 
132  inline bool getContentHasChanged() const;
133 
141  inline void setContentHasChanged(bool contentHasChanged);
142 
150  const FireMaterial* getOrCreateDefaultMaterial();
151 
164  inline void setIsEditing(bool isEditing, qsf::AssetRevision assetRevision = -1);
165 
166 
167  //[-------------------------------------------------------]
168  //[ Protected virtual qsf::ElementManager methods ]
169  //[-------------------------------------------------------]
170  protected:
171  virtual void onElementInsertion(const uint32& key, FireMaterial& element) override;
172  virtual void onElementRemoval(const uint32& key, FireMaterial& element) override;
173 
174 
175  //[-------------------------------------------------------]
176  //[ Private methods ]
177  //[-------------------------------------------------------]
178  private:
179  std::string createUniqueNameForMaterial(const std::string& name) const;
180 
181  void onAssetsMounted(const qsf::Assets& assets);
182  void onAssetsUnmounted(const qsf::Assets& assets);
183 
184 
185  //[-------------------------------------------------------]
186  //[ Private data ]
187  //[-------------------------------------------------------]
188  private:
189  bool mContentHasChanged;
190  bool mIsEditing;
191  qsf::AssetRevision mAssetRevision;
192  qsf::AssetSystem& mAssetSystem;
193 
194 
195  };
196 
197 
198 //[-------------------------------------------------------]
199 //[ Namespace ]
200 //[-------------------------------------------------------]
201 } // em5
202 
203 
204 //[-------------------------------------------------------]
205 //[ Implementation ]
206 //[-------------------------------------------------------]
Definition: ActionPriority.h:13
Definition: GameplayAssets.h:25
unsigned int uint32
Definition: PlatformTypes.h:181
#define EM5_API_EXPORT
Definition: Export.h:28
Manager contains all fire materials.
Definition: FireMaterialManager.h:47
Asset system class.
Definition: AssetSystem.h:57
Element manager class template.
Definition: ElementManager.h:71
Fire material class.
Definition: FireMaterial.h:40
Definition: PickupPersonByParamedicAction.h:21
std::vector< Asset * > Assets
Definition: AssetSystemTypes.h:39
int AssetRevision
Definition: AssetSystemTypes.h:38
boost::signals2::signal< void()> FireMaterialsChanged
This Boost signal is emitted after the asset of the fire materials got changed (updated/deleted) ...
Definition: FireMaterialManager.h:55