8 #include "QStringBuilder"
17 namespace swift::misc::aviation
23 : m_lights(lights), m_engines(engines), m_flapsPercentage(flapsPercent), m_gearDown(gearDown),
24 m_spoilersOut(spoilersOut), m_isOnGround(onGround)
29 : m_lights(lights), m_engines(engines), m_flapsPercentage(flapsPercent), m_gearDown(gearDown),
30 m_spoilersOut(spoilersOut), m_isOnGround(onGround)
38 (m_guessingDetails.isEmpty() ? QString() : u
" - " % m_guessingDetails) % u
" | on ground: " %
47 QJsonObject json = this->
toJson();
55 QJsonObject json = this->
toJson();
67 return other == *
this;
78 static const QString guessed(
"guessed");
79 static const QString notset(
"not set");
80 static const QString fsd(
"FSD parts");
84 case GuessedParts:
return guessed;
85 case FSDAircraftParts:
return fsd;
94 static const QString a(
"is_full_data");
100 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
109 case IndexEngines:
return QVariant::fromValue(m_engines);
110 case IndexEnginesAsString:
return QVariant::fromValue(m_engines.
toQString(
true));
111 case IndexFlapsPercentage:
return QVariant::fromValue(m_flapsPercentage);
112 case IndexGearDown:
return QVariant::fromValue(m_gearDown);
114 case IndexSpoilersOut:
return QVariant::fromValue(m_spoilersOut);
115 case IndexIsOnGround:
return QVariant::fromValue(m_isOnGround);
136 case IndexEngines: m_engines = variant.value<decltype(m_engines)>();
break;
137 case IndexFlapsPercentage: m_flapsPercentage = variant.toInt();
break;
138 case IndexGearDown: m_gearDown = variant.toBool();
break;
140 case IndexSpoilersOut: m_spoilersOut = variant.toBool();
break;
141 case IndexIsOnGround: m_isOnGround = variant.toBool();
break;
161 case IndexFlapsPercentage:
return Compare::compare(m_flapsPercentage, compareValue.
getFlapsPercent());
162 case IndexGearDown:
return Compare::compare(m_gearDown, compareValue.
isGearDown());
163 case IndexSpoilersOut:
return Compare::compare(m_spoilersOut, compareValue.
isSpoilersOut());
164 case IndexIsOnGround:
return Compare::compare(m_isOnGround, compareValue.
isOnGround());
168 Q_ASSERT_X(
false, Q_FUNC_INFO,
"No comparison");
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void setMSecsSinceEpoch(qint64 mSecsSinceEpoch)
Timestamp as ms value.
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const ITimestampWithOffsetBased &compareValue) const
Compare for index.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QString getFormattedTimestampAndOffset(bool includeRawTimestamp) const
Timestamp and offset.
Value object encapsulating information about aircraft's engines.
Value object encapsulating a list of aircraft engines.
void setEngines(const CAircraftEngine &engine, int engineNumber)
Copy one engine multiple times (number) and set the number of engines to number.
CAircraftEngine getEngine(int engineNumber) const
Get engine 1..n.
bool isEngineOn(int engineNumber) const
Engine number 1..x on?
bool isAnyEngineOn() const
Is any engine on?
Value object encapsulating information about aircraft's lights.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftLights &compareValue) const
Compare by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setCabinOn(bool on)
Set cabin lights.
void setRecognitionOn(bool on)
Set recognition lights.
Value object encapsulating information of aircraft's parts.
CAircraftParts()
Default constructor.
static const QString & attributeNameIsFullJson()
Attribute name.
bool isGearDown() const
Is gear down?
CAircraftLights getLights() const
Get aircraft lights.
PartsDetails
Parts Details.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
bool isEngineOn(int number) const
Is engine with number 1..n on?
bool isSpoilersOut() const
Are spoilers out?
bool isNull() const
NULL parts object?
QJsonObject toIncrementalJson() const
Incremental JSON object.
CAircraftLights getAdjustedLights() const
Lights adjusted depending on engines.
ColumnIndex
Properties by index.
CAircraftEngineList & engines()
Direct access to engines, meant for simple value modifications.
static const CAircraftParts & null()
NULL parts object.
bool isFixedGearDown() const
Is fixed gear down?
void setEngines(const CAircraftEngineList &engines)
Set engines.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
CAircraftLights & lights()
Reference to lights, meant for easy direct changes of the values.
bool isOnGround() const
Is aircraft on ground?
bool isAnyEngineOn() const
Any engine on?
PartsDetails getPartsDetails() const
Get parts details.
CAircraftEngine getEngine(int number) const
Engine with number.
int comparePropertyByIndex(CPropertyIndexRef index, const CAircraftParts &compareValue) const
Compare for index.
static const QString & partsDetailsToString(PartsDetails details)
Convert to QString.
void setAllLightsOn()
Set all lights on.
QString convertToQString(bool i18n=false) const
Cast as QString.
const QString & getPartsDetailsAsString() const
Parts details as string.
int getFlapsPercent() const
Get flaps position in percent.
void setAllLightsOff()
Set all lights off.
bool equalValues(const CAircraftParts &other) const
Equal values, but not comparing timestamp etc.
int getEnginesCount() const
Number of engines.
QJsonObject toFullJson() const
Full JSON Object.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
QString toQString(bool i18n=false) const
Cast as QString.
SWIFT_MISC_EXPORT const QString & boolToYesNo(bool v)
Bool to yes/no.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.