11 namespace swift::misc::aviation
16 for (
auto it = enginesOnOff.begin(); it != enginesOnOff.end(); ++it)
29 Q_ASSERT(engineNumber > 0);
35 Q_ASSERT(engineNumber > 0);
41 Q_ASSERT(engineNumber > 0);
55 for (
int e = 0; e < engineNumber; e++)
66 for (
int e = 0; e < engineNumber; e++)
79 for (
const auto &e : *
this)
81 const QJsonObject value = e.toJson();
82 map.insert(QString::number(e.getNumber()), value);
90 for (
const auto &e : json.keys())
93 const int number = e.toInt();
Pseudo-RAII pattern that tracks the current JSON value being converted.
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
const_reference frontOrDefault() const
Access the first element, or a default-initialized value if the sequence is empty.
CSequence findBy(Predicate p) const
Return a copy containing only those elements for which a given predicate returns true.
void push_back(const CAircraftEngine &value)
Appends an element at the end of the sequence.
void clear()
Removes all elements in the sequence.
Value object encapsulating information about aircraft's engines.
int getNumber() const
Get engine number.
bool isOn() const
Is on/off?
void setNumber(int number)
Set engine number.
void setOn(bool on)
Set to on/off.
void setEngines(const CAircraftEngine &engine, int engineNumber)
Copy one engine multiple times (number) and set the number of engines to number.
void convertFromJson(const QJsonObject &json)
Assign from JSON object.
CAircraftEngineList()=default
Default constructor.
CAircraftEngine getEngine(int engineNumber) const
Get engine 1..n.
bool isEngineOn(int engineNumber) const
Engine number 1..x on?
QJsonObject toJson() const
Cast to JSON object.
void initEngines(int engineNumber, bool on)
Init some engines.
void setEngineOn(int engineNumber, bool on)
Set engine on/off.
bool isAnyEngineOn() const
Is any engine on?
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.