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