Emergency 20 Dokumentation  4.2.0
Mod.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 
15 #include <qsf/forward/BoostPTree.h>
16 
17 #include <boost/noncopyable.hpp>
18 
19 #include <string>
20 #include <vector>
21 
22 
23 //[-------------------------------------------------------]
24 //[ Forward declarations ]
25 //[-------------------------------------------------------]
26 namespace qsf
27 {
28  class Project;
29  class NamedIdentifier;
30 }
31 
32 
33 //[-------------------------------------------------------]
34 //[ Namespace ]
35 //[-------------------------------------------------------]
36 namespace em5
37 {
38 
39 
40  //[-------------------------------------------------------]
41  //[ Classes ]
42  //[-------------------------------------------------------]
47  class EM5_API_EXPORT Mod : public boost::noncopyable
48  {
49 
50 
51  //[-------------------------------------------------------]
52  //[ Friends ]
53  //[-------------------------------------------------------]
54  friend class ModSystem;
55 
56 
57  //[-------------------------------------------------------]
58  //[ Public definitions ]
59  //[-------------------------------------------------------]
60  public:
62  {
63  MOD_OKAY, // Everything okay, mod is supported
64  MOD_PLUGINS_UNSUPPORTED // Mod can't be enabled because it has plugins that are unsupported on current platform
65  };
66 
67 
68  //[-------------------------------------------------------]
69  //[ Public methods ]
70  //[-------------------------------------------------------]
71  public:
76  inline explicit Mod(uint32);
77 
82  inline ~Mod();
83 
84  // Getters
85  inline const std::string& getName() const;
86  inline const std::string& getDisplayName() const;
87  inline const std::string& getIconFilename() const;
88 
89  inline qsf::Project& getProject() const;
90 
91  inline uint32 getOrderingIndex() const;
92  inline void setOrderingIndex(uint32 index);
93 
94  EnableCheckResult canBeEnabled();
95 
96  inline bool isEnabled() const;
97  inline void setEnabled(bool enabled);
98 
99  inline bool isMounted() const;
100 
101 
102  //[-------------------------------------------------------]
103  //[ Protected methods ]
104  //[-------------------------------------------------------]
105  protected:
106  void initialize(qsf::Project& project, uint32 index = 0);
107 
108  void mount();
109  void unmount();
110 
111  void loadPlugins(const std::vector<qsf::NamedIdentifier>& applicationTags);
112 
113 
114  //[-------------------------------------------------------]
115  //[ Private data ]
116  //[-------------------------------------------------------]
117  private:
118  qsf::Project* mProject;
119  uint32 mOrderingIndex;
120 
121  // Mod metadata
122  std::string mName;
123  std::string mIconFilename;
124 
125  // State
126  bool mIsEnabled;
127  bool mIsMounted;
128 
129 
130  };
131 
132 
133 //[-------------------------------------------------------]
134 //[ Namespace ]
135 //[-------------------------------------------------------]
136 } // em5
137 
138 
139 //[-------------------------------------------------------]
140 //[ Implementation ]
141 //[-------------------------------------------------------]
142 #include "em5/modding/Mod-inl.h"
Definition: ActionPriority.h:13
unsigned int uint32
Definition: PlatformTypes.h:181
EMERGENCY 5 mod class.
Definition: Mod.h:47
#define EM5_API_EXPORT
Definition: Export.h:28
Definition: Mod.h:63
EnableCheckResult
Definition: Mod.h:61
Definition: PickupPersonByParamedicAction.h:21
EMERGENCY 5 mod system.
Definition: ModSystem.h:55
Project class.
Definition: Project.h:40