Debian Codegraph @

xbmc/games/controllers/input/PhysicalFeature.h

raw
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"
12 #include "input/joysticks/JoystickTypes.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
27 /*!
28 * \ingroup games
29 */
30 class CPhysicalFeature
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::XBMCKey Keycode() const { return m_keycode; }
53
54 bool Deserialize(const tinyxml2::XMLElement* pElement,
55 const CController* controller,
56 JOYSTICK::FEATURE_CATEGORY category,
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::XBMCKey m_keycode = KEYBOARD::XBMCKey::XBMCK_UNKNOWN;
68 };
69
70 } // namespace GAME
71 } // namespace KODI