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 namespace tinyxml2
18 {
19 class XMLElement;
20 }
21 
22 namespace KODI
23 {
24 namespace GAME
25 {
26 
31 {
32 public:
33  CPhysicalFeature() = default;
34  CPhysicalFeature(int labelId);
35  CPhysicalFeature(const CPhysicalFeature& other) { *this = other; }
36 
37  void Reset(void);
38 
39  CPhysicalFeature& operator=(const CPhysicalFeature& rhs);
40 
41  JOYSTICK::FEATURE_TYPE Type(void) const { return m_type; }
42  JOYSTICK::FEATURE_CATEGORY Category(void) const { return m_category; }
43  const std::string& Name(void) const { return m_strName; }
44 
45  // GUI properties
46  std::string Label(void) const;
47  int LabelID(void) const { return m_labelId; }
48  std::string CategoryLabel(void) const;
49 
50  // Input properties
51  JOYSTICK::INPUT_TYPE InputType(void) const { return m_inputType; }
52  KEYBOARD::KeySymbol Keycode() const { return m_keycode; }
53 
54  bool Deserialize(const tinyxml2::XMLElement* pElement,
55  const CController* controller,
57  int categoryLabelId);
58 
59 private:
60  const CController* m_controller = nullptr; // Used for translating addon-specific labels
61  JOYSTICK::FEATURE_TYPE m_type = JOYSTICK::FEATURE_TYPE::UNKNOWN;
62  JOYSTICK::FEATURE_CATEGORY m_category = JOYSTICK::FEATURE_CATEGORY::UNKNOWN;
63  int m_categoryLabelId = -1;
64  std::string m_strName;
65  int m_labelId = -1;
66  JOYSTICK::INPUT_TYPE m_inputType = JOYSTICK::INPUT_TYPE::UNKNOWN;
67  KEYBOARD::KeySymbol m_keycode = XBMCK_UNKNOWN;
68 };
69 
70 } // namespace GAME
71 } // 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
Definition: SkinTimerManager.h:18
Definition: AudioDecoder.h:18
Definition: Controller.h:33
FEATURE_CATEGORY
Categories of features used in the joystick library.
Definition: JoystickTypes.h:66
Definition: PhysicalFeature.h:30