swift
aircraftengine.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_MISC_AVIATION_AIRCRAFTENGINES_H
7 #define SWIFT_MISC_AVIATION_AIRCRAFTENGINES_H
8 
9 #include <QMetaType>
10 #include <QString>
11 
12 #include "misc/metaclass.h"
13 #include "misc/swiftmiscexport.h"
14 #include "misc/valueobject.h"
15 
16 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::aviation, CAircraftEngine)
17 
18 namespace swift::misc::aviation
19 {
21  class SWIFT_MISC_EXPORT CAircraftEngine : public CValueObject<CAircraftEngine>
22  {
23  public:
25  CAircraftEngine() = default;
26 
29  CAircraftEngine(int number, bool on, int engineRpmPct);
30 
33  int getNumber() const { return m_number; }
34 
37  void setNumber(int number);
38 
40  bool isOn() const { return m_on; }
41 
43  void setOn(bool on) { m_on = on; }
44 
47  void setEngineRpmPct(int percentage);
48 
51  int getEngineRpmPct() const { return m_rpmPct; }
52 
54  QString convertToQString(bool i18n = false) const;
55 
56  private:
57  int m_number = 1;
58  bool m_on = true;
59  int m_rpmPct = 0;
60 
64  SWIFT_METAMEMBER(on),
65  SWIFT_METAMEMBER_NAMED(rpmPct, "rpm_pct"));
66  };
67 } // namespace swift::misc::aviation
68 
70 
71 #endif // SWIFT_MISC_AVIATION_AIRCRAFTENGINES_H
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
Value object encapsulating information about aircraft's engines.
int getNumber() const
Get engine number.
CAircraftEngine()=default
Default constructor.
void setOn(bool on)
Set to on/off.
int getEngineRpmPct() const
Get engine RPM percentage (0..100+)
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:72
#define SWIFT_METAMEMBER_NAMED(MEMBER, NAME,...)
Same as SWIFT_METAMEMBER but the second parameter is a string literal containing the JSON name of the...
Definition: metaclass.h:80
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:52
@ DisabledForJson
Element will be ignored during JSON serialization.
Definition: metaclass.h:204
#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