mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 18:25:37 +08:00
Ref T242, null functions for livery, airline, aircraft
This commit is contained in:
@@ -196,6 +196,17 @@ namespace BlackMisc
|
||||
return score;
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::isNull() const
|
||||
{
|
||||
return m_designator.isEmpty() && m_manufacturer.isEmpty() && m_modelDescription.isEmpty();
|
||||
}
|
||||
|
||||
const CAircraftIcaoCode &CAircraftIcaoCode::null()
|
||||
{
|
||||
static const CAircraftIcaoCode null;
|
||||
return null;
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::hasDesignator() const
|
||||
{
|
||||
return !m_designator.isEmpty();
|
||||
|
||||
@@ -291,6 +291,12 @@ namespace BlackMisc
|
||||
//! \remark normally used with a selected set of ICAO codes or combined types
|
||||
int calculateScore(const CAircraftIcaoCode &otherCode, CStatusMessageList *log = nullptr) const;
|
||||
|
||||
//! Null ICAO?
|
||||
bool isNull() const;
|
||||
|
||||
//! NULL object
|
||||
static const CAircraftIcaoCode &null();
|
||||
|
||||
//! Valid designator?
|
||||
static bool isValidDesignator(const QString &designator);
|
||||
|
||||
|
||||
@@ -410,6 +410,17 @@ namespace BlackMisc
|
||||
return score;
|
||||
}
|
||||
|
||||
bool CAirlineIcaoCode::isNull() const
|
||||
{
|
||||
return m_designator.isNull() && m_iataCode.isNull() && m_telephonyDesignator.isNull();
|
||||
}
|
||||
|
||||
const CAirlineIcaoCode &CAirlineIcaoCode::null()
|
||||
{
|
||||
static const CAirlineIcaoCode null;
|
||||
return null;
|
||||
}
|
||||
|
||||
CAirlineIcaoCode CAirlineIcaoCode::fromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
{
|
||||
if (!existsKey(json, prefix))
|
||||
|
||||
@@ -228,6 +228,12 @@ namespace BlackMisc
|
||||
//! Score against other code 0..100
|
||||
int calculateScore(const CAirlineIcaoCode &otherCode, CStatusMessageList *log = nullptr) const;
|
||||
|
||||
//! Null ICAO?
|
||||
bool isNull() const;
|
||||
|
||||
//! NULL object
|
||||
static const CAirlineIcaoCode &null();
|
||||
|
||||
//! Valid designator?
|
||||
static bool isValidAirlineDesignator(const QString &airline);
|
||||
|
||||
|
||||
@@ -423,5 +423,16 @@ namespace BlackMisc
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
bool CLivery::isNull() const
|
||||
{
|
||||
return m_airline.isNull() && m_combinedCode.isEmpty() && m_description.isEmpty();
|
||||
}
|
||||
|
||||
const CLivery &CLivery::null()
|
||||
{
|
||||
static const CLivery null;
|
||||
return null;
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -180,6 +180,12 @@ namespace BlackMisc
|
||||
//! \remark normally used with liveries preselect by airline ICAO code
|
||||
int calculateScore(const CLivery &otherLivery, bool preferColorLiveries = false, CStatusMessageList *log = nullptr) const;
|
||||
|
||||
//! Null livery?
|
||||
bool isNull() const;
|
||||
|
||||
//! NULL object
|
||||
static const CLivery &null();
|
||||
|
||||
//! Object from JSON
|
||||
static CLivery fromDatabaseJson(const QJsonObject &json, const QString &prefix = QString("liv_"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user