mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #797, added support for combined type
* adjusted log messages * aligned name to combined type
This commit is contained in:
@@ -175,17 +175,17 @@ namespace BlackMisc
|
||||
return c;
|
||||
}
|
||||
|
||||
bool CAircraftIcaoCode::matchesCombinedCode(const QString &combinedCode) const
|
||||
bool CAircraftIcaoCode::matchesCombinedType(const QString &combinedType) const
|
||||
{
|
||||
const QString cc(combinedCode.toUpper().trimmed().replace(' ', '*').replace('-', '*'));
|
||||
if (combinedCode.length() != 3) { return false; }
|
||||
const QString cc(combinedType.toUpper().trimmed().replace(' ', '*').replace('-', '*'));
|
||||
if (combinedType.length() != 3) { return false; }
|
||||
if (cc == this->getCombinedType()) { return true; }
|
||||
|
||||
const bool wildcard = cc.contains('*');
|
||||
if (!wildcard) { return false; }
|
||||
QChar at = cc.at(0);
|
||||
QChar c = cc.at(1);
|
||||
QChar et = cc.at(2);
|
||||
const QChar at = cc.at(0);
|
||||
const QChar c = cc.at(1);
|
||||
const QChar et = cc.at(2);
|
||||
if (at != '*')
|
||||
{
|
||||
const QString cat = getAircraftType();
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace BlackMisc
|
||||
|
||||
//! Matches given combined code
|
||||
//! \remark * can be used as wildcard, e.g. L*J, L**
|
||||
bool matchesCombinedCode(const QString &combinedCode) const;
|
||||
bool matchesCombinedType(const QString &combinedType) const;
|
||||
|
||||
//! Designator + Manufacturer
|
||||
QString getDesignatorManufacturer() const;
|
||||
|
||||
@@ -191,14 +191,14 @@ namespace BlackMisc
|
||||
});
|
||||
}
|
||||
|
||||
CAircraftModelList CAircraftModelList::findByCombinedCode(const QString &combinedCode) const
|
||||
CAircraftModelList CAircraftModelList::findByCombinedType(const QString &combinedType) const
|
||||
{
|
||||
const QString cc(combinedCode.trimmed().toUpper());
|
||||
if (combinedCode.length() != 3) { return CAircraftModelList(); }
|
||||
const QString cc(combinedType.trimmed().toUpper());
|
||||
if (combinedType.length() != 3) { return CAircraftModelList(); }
|
||||
return this->findBy([ & ](const CAircraftModel & model)
|
||||
{
|
||||
const CAircraftIcaoCode icao(model.getAircraftIcaoCode());
|
||||
return icao.matchesCombinedCode(cc);
|
||||
return icao.matchesCombinedType(cc);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace BlackMisc
|
||||
CAircraftModelList findByFamily(const QString &family) const;
|
||||
|
||||
//! Find by combined code, wildcards possible e.g. L*P, *2J
|
||||
CAircraftModelList findByCombinedCode(const QString &combinedCode) const;
|
||||
CAircraftModelList findByCombinedType(const QString &combinedType) const;
|
||||
|
||||
//! Find by military flag
|
||||
CAircraftModelList findByMilitaryFlag(bool military) const;
|
||||
|
||||
Reference in New Issue
Block a user