xbmc
CustomControllerTranslator.h
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 "IButtonMapper.h"
12 
13 #include <map>
14 #include <string>
15 
16 namespace tinyxml2
17 {
18 class XMLNode;
19 }
20 
22 {
23 public:
24  CCustomControllerTranslator() = default;
25 
26  // implementation of IButtonMapper
27  void MapActions(int windowID, const tinyxml2::XMLNode* pDevice) override;
28  void Clear() override;
29 
30  bool TranslateCustomControllerString(int windowId,
31  const std::string& controllerName,
32  int buttonId,
33  int& action,
34  std::string& strAction);
35 
36 private:
37  bool TranslateString(int windowId,
38  const std::string& controllerName,
39  int buttonId,
40  unsigned int& actionId,
41  std::string& strAction);
42 
43  // Maps button id to action
44  using CustomControllerButtonMap = std::map<int, std::string>;
45 
46  // Maps window id to controller button map
47  using CustomControllerWindowMap = std::map<int, CustomControllerButtonMap>;
48 
49  // Maps custom controller name to controller Window map
50  std::map<std::string, CustomControllerWindowMap> m_customControllersMap;
51 };
Interface for classes that can map buttons to Kodi actions.
Definition: IButtonMapper.h:19
Definition: SkinTimerManager.h:18
Definition: CustomControllerTranslator.h:21