save state
This commit is contained in:
23
designer/src/platform_singleton.cpp
Normal file
23
designer/src/platform_singleton.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// D:\Dev\Mosis\MosisService\designer\src\platform_singleton.cpp
|
||||
// Platform singleton implementation for desktop
|
||||
|
||||
#include "platform.h"
|
||||
#include <stdexcept>
|
||||
|
||||
namespace mosis {
|
||||
|
||||
// Platform singleton
|
||||
static std::unique_ptr<IPlatform> g_platform;
|
||||
|
||||
IPlatform& GetPlatform() {
|
||||
if (!g_platform) {
|
||||
throw std::runtime_error("Platform not initialized. Call SetPlatform first.");
|
||||
}
|
||||
return *g_platform;
|
||||
}
|
||||
|
||||
void SetPlatform(std::unique_ptr<IPlatform> platform) {
|
||||
g_platform = std::move(platform);
|
||||
}
|
||||
|
||||
} // namespace mosis
|
||||
Reference in New Issue
Block a user