xbmc
PhysicalFeature.h
1 /*
2  * Copyright (C) 2015-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/controllers/ControllerTypes.h"
13 #include "input/keyboard/KeyboardTypes.h"
14 
15 #include <string>
16 
17 class TiXmlElement;
18 
19 namespace KODI
20 {
21 namespace GAME
22 {
23 
25 {
26 public:
27  CPhysicalFeature() = default;
28  CPhysicalFeature(int labelId);
29  CPhysicalFeature(const CPhysicalFeature& other) { *this = other; }
30 
31  void Reset(void);
32 
33  CPhysicalFeature& operator=(const CPhysicalFeature& rhs);
34 
35  JOYSTICK::FEATURE_TYPE Type(void) const { return m_type; }
36  JOYSTICK::FEATURE_CATEGORY Category(void) const { return m_category; }
37  const std::string& Name(void) const { return m_strName; }
38 
39  // GUI properties
40  std::string Label(void) const;
41  int LabelID(void) const { return m_labelId; }
42  std::string CategoryLabel(void) const;
43 
44  // Input properties
45  JOYSTICK::INPUT_TYPE InputType(void) const { return m_inputType; }
46  KEYBOARD::KeySymbol Keycode() const { return m_keycode; }
47 
48  bool Deserialize(const TiXmlElement* pElement,
49  const CController* controller,
51  int categoryLabelId);
52 
53 private:
54  const CController* m_controller = nullptr; // Used for translating addon-specific labels
55  JOYSTICK::FEATURE_TYPE m_type = JOYSTICK::FEATURE_TYPE::UNKNOWN;
56  JOYSTICK::FEATURE_CATEGORY m_category = JOYSTICK::FEATURE_CATEGORY::UNKNOWN;
57  int m_categoryLabelId = -1;
58  std::string m_strName;
59  int m_labelId = -1;
60  JOYSTICK::INPUT_TYPE m_inputType = JOYSTICK::INPUT_TYPE::UNKNOWN;
61  KEYBOARD::KeySymbol m_keycode = XBMCK_UNKNOWN;
62 };
63 
64 } // namespace GAME
65 } // namespace KODI
INPUT_TYPE
Types of input available for scalar features.
Definition: JoystickTypes.h:140
FEATURE_TYPE
Types of features used in the joystick library.
Definition: JoystickTypes.h:49
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: Controller.h:30
FEATURE_CATEGORY
Categories of features used in the joystick library.
Definition: JoystickTypes.h:66
Definition: PhysicalFeature.h:24