xbmc
Platform.h
1 /*
2  * Copyright (C) 2016-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "utils/ComponentContainer.h"
12 
15 {
16 public:
17  virtual ~IPlatformService() = default;
18 };
19 
25 class CPlatform : public CComponentContainer<IPlatformService>
26 {
27 public:
32  static CPlatform *CreateInstance();
33 
35  CPlatform() = default;
36 
38  virtual ~CPlatform() = default;
39 
45  virtual bool InitStageOne() { return true; }
46 
52  virtual bool InitStageTwo() { return true; }
53 
59  virtual bool InitStageThree() { return true; }
60 
65  virtual void DeinitStageOne() {}
66 
71  virtual void DeinitStageTwo() {}
72 
77  virtual void DeinitStageThree() {}
78 
82  virtual bool IsConfigureAddonsAtStartupEnabled() { return false; }
83 
86  virtual bool SupportsUserInstalledBinaryAddons() { return true; }
87 
92  virtual void PlatformSyslog() {}
93 
96  template<class T>
97  std::shared_ptr<T> GetService()
98  {
99  return this->GetComponent<T>();
100  }
101 };
virtual void PlatformSyslog()
Print platform specific info to log.
Definition: Platform.h:92
virtual bool InitStageOne()
Called at an early stage of application startup.
Definition: Platform.h:45
std::shared_ptr< T > GetService()
Get a platform service instance.
Definition: Platform.h:97
virtual void DeinitStageOne()
Called at a late stage of application shutdown.
Definition: Platform.h:65
virtual bool IsConfigureAddonsAtStartupEnabled()
Flag whether disabled add-ons - installed via packagemanager or manually - should be offered for conf...
Definition: Platform.h:82
virtual void DeinitStageTwo()
Called at a middle stage of application shutdown.
Definition: Platform.h:71
virtual bool InitStageThree()
Called at a late stage of application startup.
Definition: Platform.h:59
A generic container for components.
Definition: ServiceBroker.h:55
Base class for services.
Definition: Platform.h:14
virtual void DeinitStageThree()
Called at an early stage of application shutdown.
Definition: Platform.h:77
virtual bool SupportsUserInstalledBinaryAddons()
Flag whether this platform supports user installation of binary add-ons.
Definition: Platform.h:86
Class for the Platform object.
Definition: Platform.h:25
virtual bool InitStageTwo()
Called at a middle stage of application startup.
Definition: Platform.h:52