Debian Codegraph @

xbmc/games/addons/input/GameClientTopology.h

raw
1 /*
2 * Copyright (C) 2017-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 "games/GameTypes.h"
12 #include "games/controllers/types/ControllerTree.h"
13
14 #include <memory>
15
16 namespace KODI
17 {
18 namespace GAME
19 {
20
21 /*!
22 * \ingroup games
23 */
24 class CGameClientTopology
25 {
26 public:
27 CGameClientTopology() = default;
28 CGameClientTopology(GameClientPortVec ports, int playerLimit);
29
30 void Clear();
31
32 int GetPlayerLimit() const { return m_playerLimit; }
33
34 const CControllerTree& GetControllerTree() const { return m_controllers; }
35 CControllerTree& GetControllerTree() { return m_controllers; }
36
37 // Utility functions
38 static std::string MakeAddress(const std::string& baseAddress, const std::string& nodeId);
39 static std::pair<std::string, std::string> SplitAddress(const std::string& nodeAddress);
40
41 private:
42 static CControllerTree GetControllerTree(const GameClientPortVec& ports);
43 static CPortNode GetPortNode(const GameClientPortPtr& port, const std::string& controllerAddress);
44 static CControllerNode GetControllerNode(const GameClientDevicePtr& device,
45 const std::string& portAddress);
46
47 // Game API parameters
48 GameClientPortVec m_ports;
49 int m_playerLimit = -1;
50
51 // Controller parameters
52 CControllerTree m_controllers;
53 };
54
55 } // namespace GAME
56 } // namespace KODI