summaryrefslogtreecommitdiffstats
path: root/xbmc/platform/Platform.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/platform/Platform.h
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/platform/Platform.h')
-rw-r--r--xbmc/platform/Platform.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/xbmc/platform/Platform.h b/xbmc/platform/Platform.h
new file mode 100644
index 0000000..ebb441c
--- /dev/null
+++ b/xbmc/platform/Platform.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2016-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "utils/ComponentContainer.h"
+
+//! \brief Base class for services.
+class IPlatformService
+{
+public:
+ virtual ~IPlatformService() = default;
+};
+
+/**\brief Class for the Platform object
+ *
+ * Contains methods to retrieve platform specific information
+ * and methods for doing platform specific environment preparation/initialisation
+ */
+class CPlatform : public CComponentContainer<IPlatformService>
+{
+public:
+ /**\brief Creates the Platform object
+ *
+ *@return the platform object
+ */
+ static CPlatform *CreateInstance();
+
+ /**\brief C'tor */
+ CPlatform() = default;
+
+ /**\brief D'tor */
+ virtual ~CPlatform() = default;
+
+ /**\brief Called at an early stage of application startup
+ *
+ * This method can be used to do platform specific environment preparation
+ * or initialisation (like setting environment variables for example)
+ */
+ virtual bool InitStageOne() { return true; }
+
+ /**\brief Called at a middle stage of application startup
+ *
+ * This method can be used for starting platform specific services that
+ * do not depend on windowing/gui. (eg macos XBMCHelper)
+ */
+ virtual bool InitStageTwo() { return true; }
+
+ /**\brief Called at a late stage of application startup
+ *
+ * This method can be used for starting platform specific Window/GUI related
+ * services/components. (eg , WS-Discovery Daemons)
+ */
+ virtual bool InitStageThree() { return true; }
+
+ /**\brief Called at a late stage of application shutdown
+ *
+ * This method should be used to cleanup resources allocated in InitStageOne
+ */
+ virtual void DeinitStageOne() {}
+
+ /**\brief Called at a middle stage of application shutdown
+ *
+ * This method should be used to cleanup resources allocated in InitStageTwo
+ */
+ virtual void DeinitStageTwo() {}
+
+ /**\brief Called at an early stage of application shutdown
+ *
+ * This method should be used to cleanup resources allocated in InitStageThree
+ */
+ virtual void DeinitStageThree() {}
+
+ /**\brief Flag whether disabled add-ons - installed via packagemanager or manually - should be
+ * offered for configuration and activation on kodi startup for this platform
+ */
+ virtual bool IsConfigureAddonsAtStartupEnabled() { return false; }
+
+ /**\brief Flag whether this platform supports user installation of binary add-ons.
+ */
+ virtual bool SupportsUserInstalledBinaryAddons() { return true; }
+
+ /**\brief Print platform specific info to log
+ *
+ * Logs platform specific system info during application creation startup
+ */
+ virtual void PlatformSyslog() {}
+
+ /**\brief Get a platform service instance.
+ */
+ template<class T>
+ std::shared_ptr<T> GetService()
+ {
+ return this->GetComponent<T>();
+ }
+};