GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
PlatformManager.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 
7 #if defined(GD_IDE_ONLY)
8 #ifndef PLATFORMMANAGER_H
9 #define PLATFORMMANAGER_H
10 #include <memory>
11 #include <vector>
12 #include "GDCore/Extensions/Platform.h"
13 
14 namespace gd {
15 
25 class GD_CORE_API PlatformManager {
26  public:
30  bool AddPlatform(std::shared_ptr<gd::Platform> newPlatform);
31 
37  gd::Platform *GetPlatform(const gd::String &platformName) const;
38 
42  const std::vector<std::shared_ptr<gd::Platform> > &GetAllPlatforms() const {
43  return platformsLoaded;
44  };
45 
46  static PlatformManager *Get() {
47  if (NULL == _singleton) {
48  _singleton = new PlatformManager;
49  }
50 
51  return (static_cast<PlatformManager *>(_singleton));
52  }
53 
60  static void DestroySingleton() {
61  if (NULL != _singleton) {
62  delete _singleton;
63  _singleton = NULL;
64  }
65  }
66 
67  private:
68  std::vector<std::shared_ptr<gd::Platform> > platformsLoaded;
69 
71  virtual ~PlatformManager();
72  static PlatformManager *_singleton;
73 };
74 
75 } // namespace gd
76 #endif // PLATFORMMANAGER_H
77 #endif
Base class for implementing a platform.
Definition: Platform.h:42
Singleton class managing all the platforms available.
Definition: PlatformManager.h:25
static void DestroySingleton()
Destroy the global platform manager.
Definition: PlatformManager.h:60
const std::vector< std::shared_ptr< gd::Platform > > & GetAllPlatforms() const
Get a list of all platforms available.
Definition: PlatformManager.h:42
String represents an UTF8 encoded string.
Definition: String.h:33
Definition: CommonTools.h:24