mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Ref T111, search for location/name
This commit is contained in:
committed by
Mathew Sutcliffe
parent
58b5dd1278
commit
bb4f0e7a13
@@ -62,6 +62,23 @@ namespace BlackMisc
|
||||
return this->findFirstByOrDefault(&CAirport::getIcao, icao, ifNotFound);
|
||||
}
|
||||
|
||||
CAirport CAirportList::findFirstByNameOrLocation(const QString &nameOrLocation, const CAirport &ifNotFound) const
|
||||
{
|
||||
if (this->isEmpty() || nameOrLocation.isEmpty()) { return ifNotFound; }
|
||||
CAirportList airports = this->findBy([&](const CAirport & airport)
|
||||
{
|
||||
return airport.matchesDescriptiveName(nameOrLocation);
|
||||
});
|
||||
if (!airports.isEmpty()) { return airports.frontOrDefault(); }
|
||||
|
||||
airports = this->findBy([&](const CAirport & airport)
|
||||
{
|
||||
return airport.matchesLocation(nameOrLocation);
|
||||
});
|
||||
if (!airports.isEmpty()) { return airports.frontOrDefault(); }
|
||||
return ifNotFound;
|
||||
}
|
||||
|
||||
QStringList CAirportList::allIcaoCodes(bool sorted) const
|
||||
{
|
||||
QStringList icaos;
|
||||
|
||||
Reference in New Issue
Block a user