swift
comnavequipment.h
1 // SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
4 #ifndef SWIFT_MISC_AVIATION_COMNAVEQUIPMENT_H
5 #define SWIFT_MISC_AVIATION_COMNAVEQUIPMENT_H
6 
7 #include "misc/swiftmiscexport.h"
8 #include "misc/valueobject.h"
9 
10 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::aviation, CComNavEquipment)
11 
12 namespace swift::misc::aviation
13 {
16  {
17  public:
18  // QFlag uses int as an underlying type. Hence, the equipment is split up into two enums.
19  // Once Qt adds a QFlag64, these can be united.
20  // See https://bugreports.qt.io/browse/QTBUG-53178
21 
24  {
25  CpdlcAtn = (1 << 0),
26  CpdlcFansHfdl = (1 << 1),
27  CpdlcFansVdlA = (1 << 2),
28  CpdlcFansVdl2 = (1 << 3),
29  CpdlcFansSatcomInmarsat = (1 << 4),
30  CpdlcFansSatcomMtsat = (1 << 5),
31  CpdlcFansSatcomIridium = (1 << 6),
32  AtcSatvoiceInmarsat = (1 << 7),
33  AtcSatvoiceMtsat = (1 << 8),
34  AtcSatvoiceIridium = (1 << 9),
35  CpdlcRcp400 = (1 << 10),
36  CpdlcRcp240 = (1 << 11),
37  SatvoiceRcp400 = (1 << 12),
38  };
39 
42  {
43  Standard = (1 << 0),
44  Gbas = (1 << 1),
45  Lpv = (1 << 2),
46  LoranC = (1 << 3),
47  Dme = (1 << 4),
48  FmcAcars = (1 << 5),
49  DFisAcars = (1 << 6),
50  PdcAcars = (1 << 7),
51  Adf = (1 << 8),
52  Gnss = (1 << 9),
53  HfRtf = (1 << 10),
54  InertiaNavigation = (1 << 11),
55  Mls = (1 << 12),
56  Ils = (1 << 13),
57  NoEquip = (1 << 14),
58  Vor = (1 << 15),
59  Pbn = (1 << 16),
60  Tacan = (1 << 17),
61  UhfRtf = (1 << 18),
62  VhfRtf = (1 << 19),
63  Rvsm = (1 << 20),
64  Mnps = (1 << 21),
65  Vhf833 = (1 << 22),
66  Other = (1 << 23)
67  };
68 
69  Q_DECLARE_FLAGS(ComNavEquipment, ComNavEquipmentOption)
70  Q_DECLARE_FLAGS(CpdlcSatcomEquipment, CpdlcSatcomEquipmentOption)
71 
72 
73  CComNavEquipment() = default;
74 
76  CComNavEquipment(ComNavEquipment comNavEquipment, CpdlcSatcomEquipment cpdlcSatcomEquipment);
77 
79  explicit CComNavEquipment(QString equipment);
80 
82  static QStringList allEquipmentLetters();
83 
86  bool hasEquipment(ComNavEquipmentOption equip) const { return m_equipment.testFlag(equip); }
87  bool hasEquipment(CpdlcSatcomEquipmentOption equip) const { return m_cpdlcSatcomEquipment.testFlag(equip); }
89 
91  QStringList enabledOptions() const;
92 
94  QString convertToQString(bool i18n = false) const;
95 
96  private:
99  static QString flagToString(CpdlcSatcomEquipmentOption flag);
100  static QString flagToString(ComNavEquipmentOption flag);
102 
103  ComNavEquipment m_equipment = Standard;
104  CpdlcSatcomEquipment m_cpdlcSatcomEquipment;
105 
108  SWIFT_METAMEMBER(equipment),
109  SWIFT_METAMEMBER(cpdlcSatcomEquipment));
110  };
111 } // namespace swift::misc::aviation
112 
113 Q_DECLARE_METATYPE(swift::misc::aviation::CComNavEquipment)
114 
115 #endif // SWIFT_MISC_AVIATION_COMNAVEQUIPMENT_H
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
bool hasEquipment(CpdlcSatcomEquipmentOption equip) const
Does this object contains equip?
CpdlcSatcomEquipmentOption
CPLDC and SATCOM equipment options.
ComNavEquipmentOption
COM/NAV equipment options.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65