FINAL CUT
fkey_map.h
1 /***********************************************************************
2 * fkey_map.h - Key name mapping *
3 * *
4 * This file is part of the FINAL CUT widget toolkit *
5 * *
6 * Copyright 2015-2023 Markus Gans *
7 * *
8 * FINAL CUT is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation; either version 3 of *
11 * the License, or (at your option) any later version. *
12 * *
13 * FINAL CUT is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this program. If not, see *
20 * <http://www.gnu.org/licenses/>. *
21 ***********************************************************************/
22 
23 #ifndef FKEYMAP_H
24 #define FKEYMAP_H
25 
26 #if !defined (USE_FINAL_H) && !defined (COMPILE_FINAL_CUT)
27  #error "Only <final/final.h> can be included directly."
28 #endif
29 
30 #include <array>
31 #include <string>
32 
33 #include "final/ftypes.h"
34 #include "final/util/fstring.h"
35 
36 namespace finalcut
37 {
38 
39 enum class FKey : uInt32; // forward declaration
40 
41 class FKeyMap final
42 {
43  public:
44  struct KeyCapMap
45  {
46  FKey num{};
47  const char* string{};
48  uInt8 length{};
49  std::array<char, 4> tname{};
50  };
51 
52  struct KeyMap
53  {
54  FKey num{};
55  std::array<char, 8> string{};
56  uInt8 length{};
57  };
58 
59  struct KeyName
60  {
61  FKey num{};
62  std::array<char, 26> string{};
63  };
64 
65  // Using-declaration
66  using KeyCapMapType = std::array<KeyCapMap, 190>;
67  using KeyMapType = std::array<KeyMap, 234>;
68  using KeyNameType = std::array<KeyName, 390>;
69 
70  // Constructors
71  FKeyMap() = default;
72 
73  // Accessors
74  auto getClassName() const -> FString;
75  static auto getInstance() -> FKeyMap&;
76  static auto getKeyCapMap() -> KeyCapMapType&;
77  static auto getKeyMap() -> KeyMapType&;
78  static auto getKeyName() -> const KeyNameType&;
79 
80  private:
81  // Data members
82  static KeyCapMapType fkey_cap_table;
83  static KeyMapType fkey_table;
84  static const KeyNameType fkeyname;
85 };
86 
87 // FKeyMap inline functions
88 //----------------------------------------------------------------------
89 inline auto FKeyMap::getClassName() const -> FString
90 { return "FKeyMap"; }
91 
92 } // namespace finalcut
93 
94 #endif // FKEYMAP_H
Definition: fkey_map.h:44
Definition: class_template.cpp:25
Definition: fkey_map.h:59
Definition: fstring.h:79
Definition: fkey_map.h:41
Definition: fkey_map.h:52