mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Ref T524, filter by combined type/manufacturer
This commit is contained in:
committed by
Mat Sutcliffe
parent
df19d74b39
commit
509a60d06f
@@ -371,7 +371,7 @@ namespace BlackMisc
|
||||
const bool wildcard = cc.contains('*');
|
||||
if (!wildcard) { return false; }
|
||||
const QChar at = cc.at(0);
|
||||
const QChar c = cc.at(1);
|
||||
const QChar c = cc.at(1);
|
||||
const QChar et = cc.at(2);
|
||||
if (at != '*')
|
||||
{
|
||||
@@ -387,6 +387,12 @@ namespace BlackMisc
|
||||
return cet.length() == 1 && cet.at(0) == et;
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::matchesCombinedTypeAndManufacturer(const QString &combinedType, const QString &manufacturer) const
|
||||
{
|
||||
return this->matchesCombinedType(combinedType) &&
|
||||
this->matchesManufacturer(manufacturer);
|
||||
}
|
||||
|
||||
QString CAircraftIcaoCode::getDesignatorManufacturer() const
|
||||
{
|
||||
return (this->hasDesignator() ? this->getDesignator() : QStringLiteral("????")) %
|
||||
|
||||
@@ -166,6 +166,9 @@ namespace BlackMisc
|
||||
//! \remark * can be used as wildcard, e.g. L*J, L**
|
||||
bool matchesCombinedType(const QString &combinedType) const;
|
||||
|
||||
//! Matches combined type and
|
||||
bool matchesCombinedTypeAndManufacturer(const QString &combinedType, const QString &manufacturer) const;
|
||||
|
||||
//! Set the model description (ICAO description)
|
||||
void setModelDescription(const QString &modelDescription) { m_modelDescription = modelDescription.trimmed(); }
|
||||
|
||||
|
||||
@@ -311,6 +311,21 @@ namespace BlackMisc
|
||||
return this->findByCombinedTypeAndWtc(combinedType, wtc).findColorLiveries();
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findByCombinedAndManufacturer(const CAircraftIcaoCode &icao) const
|
||||
{
|
||||
return this->findByCombinedAndManufacturer(icao.getCombinedType(), icao.getManufacturer());
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findByCombinedAndManufacturer(const QString &combinedType, const QString &manufacturer) const
|
||||
{
|
||||
if (manufacturer.isEmpty()) { return this->findByCombinedType(combinedType); }
|
||||
if (combinedType.isEmpty()) { return this->findByManufacturer(manufacturer); }
|
||||
return this->findBy([ & ](const CAircraftModel & model)
|
||||
{
|
||||
return model.getAircraftIcaoCode().matchesCombinedTypeAndManufacturer(combinedType, manufacturer);
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findColorLiveries() const
|
||||
{
|
||||
return this->findBy([ = ](const CAircraftModel & model)
|
||||
|
||||
@@ -181,12 +181,20 @@ namespace BlackMisc
|
||||
//! Find by combined code and WTC, wildcards for combined code possible, e.g. L*P, *2J
|
||||
CAircraftModelList findByCombinedTypeAndWtc(const QString &combinedType, const QString &wtc) const;
|
||||
|
||||
//! \copydoc findByCombinedType
|
||||
//! Combined type and color livery
|
||||
CAircraftModelList findByCombinedTypeWithColorLivery(const QString &combinedType) const;
|
||||
|
||||
//! \copydoc findByCombinedTypeAndWtc
|
||||
//! Combined WTC/livery
|
||||
CAircraftModelList findByCombinedTypeAndWtcWithColorLivery(const QString &combinedType, const QString &wtc) const;
|
||||
|
||||
//! Combined type and manufacturer
|
||||
//! \remark kind of pseudo family, as in most cases the same combined type of a manufacturer means similar aircraft
|
||||
CAircraftModelList findByCombinedAndManufacturer(const Aviation::CAircraftIcaoCode &icao) const;
|
||||
|
||||
//! Combined typeand manufacturer
|
||||
//! \remark kind of pseudo family, as in most cases the same combined type of a manufacturer means similar aircraft
|
||||
CAircraftModelList findByCombinedAndManufacturer(const QString &combinedType, const QString &manufacturer) const;
|
||||
|
||||
//! Find models with color liveries
|
||||
CAircraftModelList findColorLiveries() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user