Debian Codegraph @

xbmc/input/keyboard/KeyboardLayout.h

raw
1 /*
2 * Copyright (C) 2005-2024 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 "input/InputCodingTable.h"
12
13 #include <map>
14 #include <string>
15 #include <vector>
16
17 namespace tinyxml2
18 {
19 class XMLElement;
20 }
21
22 namespace KODI
23 {
24 namespace KEYBOARD
25 {
26 /*!
27 * \ingroup keyboard
28 */
29 class CKeyboardLayout
30 {
31 public:
32 CKeyboardLayout() = default;
33 virtual ~CKeyboardLayout();
34 IInputCodingTablePtr GetCodingTable() { return m_codingtable; }
35
36 bool Load(const tinyxml2::XMLElement* element);
37
38 std::string GetIdentifier() const;
39 std::string GetName() const;
40 const std::string& GetLanguage() const { return m_language; }
41 const std::string& GetLayout() const { return m_layout; }
42
43 enum ModifierKey
44 {
45 ModifierKeyNone = 0x00,
46 ModifierKeyShift = 0x01,
47 ModifierKeySymbol = 0x02
48 };
49
50 std::string GetCharAt(unsigned int row, unsigned int column, unsigned int modifiers = 0) const;
51
52 private:
53 static std::vector<std::string> BreakCharacters(const std::string& chars);
54
55 typedef std::vector<std::vector<std::string>> KeyboardRows;
56 typedef std::map<unsigned int, KeyboardRows> Keyboards;
57
58 std::string m_language;
59 std::string m_layout;
60 Keyboards m_keyboards;
61 IInputCodingTablePtr m_codingtable;
62 };
63 } // namespace KEYBOARD
64 } // namespace KODI