mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
* Include only what is used * Use forward declaration when possible * Sorted includes refs #630
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
/* Copyright (C) 2013
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
#include "blackmisc/aviation/airportlist.h"
|
|
#include "blackmisc/compare.h"
|
|
#include "blackmisc/metaclassprivate.h"
|
|
#include "blackmisc/range.h"
|
|
|
|
#include <QString>
|
|
#include <tuple>
|
|
|
|
using namespace BlackMisc::PhysicalQuantities;
|
|
|
|
namespace BlackMisc
|
|
{
|
|
namespace Aviation
|
|
{
|
|
|
|
CAirportList::CAirportList() { }
|
|
|
|
CAirportList::CAirportList(const CSequence<CAirport> &other) :
|
|
CSequence<CAirport>(other)
|
|
{ }
|
|
|
|
CAirportList CAirportList::findByIcao(const CAirportIcaoCode &icao) const
|
|
{
|
|
return this->findBy(&CAirport::getIcao, icao);
|
|
}
|
|
|
|
void CAirportList::replaceOrAddByIcao(const CAirport &addedOrReplacedAirport)
|
|
{
|
|
if (!addedOrReplacedAirport.hasValidIcaoCode()) return; // ignore invalid airport
|
|
this->replaceOrAdd(&CAirport::getIcao, addedOrReplacedAirport.getIcao(), addedOrReplacedAirport);
|
|
}
|
|
|
|
CAirport CAirportList::findFirstByIcao(const CAirportIcaoCode &icao, const CAirport &ifNotFound) const
|
|
{
|
|
return this->findFirstByOrDefault(&CAirport::getIcao, icao, ifNotFound);
|
|
}
|
|
|
|
} // namespace
|
|
} // namespace
|