Debian Codegraph @

xbmc/input/keymaps/remote/CustomControllerTranslator.h

raw
1 /*
2 * Copyright (C) 2017-2024 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 "input/keymaps/interfaces/IKeyMapper.h"
12
13 #include <map>
14 #include <string>
15
16 namespace tinyxml2
17 {
18 class XMLNode;
19 }
20
21 namespace KODI
22 {
23 namespace KEYMAP
24 {
25 /*!
26 * \ingroup keymap
27 */
28 class CCustomControllerTranslator : public IKeyMapper
29 {
30 public:
31 CCustomControllerTranslator() = default;
32
33 // implementation of IKeyMapper
34 void MapActions(int windowID, const tinyxml2::XMLNode* pDevice) override;
35 void Clear() override;
36
37 bool TranslateCustomControllerString(int windowId,
38 const std::string& controllerName,
39 int buttonId,
40 int& action,
41 std::string& strAction);
42
43 private:
44 bool TranslateString(int windowId,
45 const std::string& controllerName,
46 int buttonId,
47 unsigned int& actionId,
48 std::string& strAction);
49
50 // Maps button id to action
51 using CustomControllerButtonMap = std::map<int, std::string>;
52
53 // Maps window id to controller button map
54 using CustomControllerWindowMap = std::map<int, CustomControllerButtonMap>;
55
56 // Maps custom controller name to controller Window map
57 std::map<std::string, CustomControllerWindowMap> m_customControllersMap;
58 };
59 } // namespace KEYMAP
60 } // namespace KODI