2 * Copyright (C) 2005-2020 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "WindowSystemFactory.h"
13 using namespace KODI::WINDOWING
;
15 std::list
<std::pair
<std::string
, std::function
<std::unique_ptr
<CWinSystemBase
>()>>>
16 CWindowSystemFactory::m_windowSystems
;
18 std::list
<std::string
> CWindowSystemFactory::GetWindowSystems()
20 std::list
<std::string
> available
;
21 for (const auto& windowSystem
: m_windowSystems
)
22 available
.emplace_back(windowSystem
.first
);
27 std::unique_ptr
<CWinSystemBase
> CWindowSystemFactory::CreateWindowSystem(const std::string
& name
)
30 std::find_if(m_windowSystems
.begin(), m_windowSystems
.end(),
31 [&name
](auto& windowSystem
) { return windowSystem
.first
== name
; });
32 if (windowSystem
!= m_windowSystems
.end())
33 return windowSystem
->second();
38 void CWindowSystemFactory::RegisterWindowSystem(
39 const std::function
<std::unique_ptr
<CWinSystemBase
>()>& createFunction
, const std::string
& name
)
41 m_windowSystems
.emplace_back(name
, createFunction
);