platform_integration.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #include "platform/platform_integration.h"
  8. #if defined Q_OS_WINRT || defined Q_OS_WIN
  9. #include "platform/win/integration_win.h"
  10. #elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
  11. #include "platform/mac/integration_mac.h"
  12. #else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
  13. #include "platform/linux/integration_linux.h"
  14. #endif // else Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
  15. namespace Platform {
  16. namespace {
  17. Integration *GlobalInstance/* = nullptr*/;
  18. } // namespace
  19. Integration::~Integration() {
  20. GlobalInstance = nullptr;
  21. }
  22. std::unique_ptr<Integration> Integration::Create() {
  23. Expects(GlobalInstance == nullptr);
  24. auto result = CreateIntegration();
  25. GlobalInstance = result.get();
  26. return result;
  27. }
  28. Integration &Integration::Instance() {
  29. Expects(GlobalInstance != nullptr);
  30. return *GlobalInstance;
  31. };
  32. } // namespace Platform