ToolSystem.cpp 993 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include <Atomic/Core/Context.h>
  2. #include "Platform/PlatformWeb.h"
  3. #include "Net/CurlManager.h"
  4. #include "License/LicenseSystem.h"
  5. #include "ToolSystem.h"
  6. namespace ToolCore
  7. {
  8. ToolSystem::ToolSystem(Context* context) : Object(context)
  9. {
  10. context_->RegisterSubsystem(new CurlManager(context_));
  11. context_->RegisterSubsystem(new LicenseSystem(context_));
  12. // platform registration
  13. RegisterPlatform(new PlatformWeb(context));
  14. }
  15. ToolSystem::~ToolSystem()
  16. {
  17. }
  18. void ToolSystem::SetCurrentPlatform(PlatformID platform)
  19. {
  20. if (!platforms_.Contains((unsigned) platform))
  21. return;
  22. currentPlatform_ = platforms_[(unsigned)platform];
  23. }
  24. PlatformID ToolSystem::GetCurrentPlatform()
  25. {
  26. if (currentPlatform_.Null())
  27. return PLATFORMID_UNDEFINED;
  28. return currentPlatform_->GetPlatformID();
  29. }
  30. void ToolSystem::RegisterPlatform(Platform* platform)
  31. {
  32. platforms_.Insert(MakePair((unsigned)platform->GetPlatformID(), SharedPtr<Platform>(platform)));
  33. }
  34. }