11 using namespace swift::misc::physical_quantities;
15 namespace swift::misc::aviation
26 if (icao.
isEmpty()) {
return false; }
38 if (updateFromList.
isEmpty()) {
return; }
66 for (
const CAirport &airport : *
this)
71 if (
sorted) { icaos.sort(); }
78 for (
const CAirport &airport : *
this)
83 if (
sorted) { names.sort(); }
90 for (
const CAirport &airport : *
this)
101 QStringList locations;
102 for (
const CAirport &airport : *
this)
105 if (l.isEmpty()) {
continue; }
106 locations.push_back(l);
108 if (
sorted) { locations.sort(); }
115 Q_UNUSED(inconsistent);
116 for (
const QJsonValue &value : array)
auto findFirstByOrDefault(Predicate p, const Value &def) const
Return a copy of the first element for which a given predicate returns true, or a default value if th...
bool contains(const T &object) const
Return true if there is an element equal to given object. Uses the most efficient implementation avai...
const_reference frontOrDefault() const
Access the first element, or a default-initialized value if the sequence is empty.
CSequence findBy(Predicate p) const
Return a copy containing only those elements for which a given predicate returns true.
void replaceOrAdd(const CAirport &original, const CAirport &replacement)
Replace elements matching the given element. If there is no match, push the new element on the end.
Q_REQUIRED_RESULT CSequence sorted(Predicate p) const
Return a copy sorted by a given comparator predicate.
void push_back(const T &value)
Appends an element at the end of the sequence.
bool isEmpty() const
Synonym for empty.
Build a QSet more efficiently when calling insert() in a for loop.
void insert(const T &value)
Add an element to the set. Runs in amortized constant time.
Value object encapsulating information about an airpot.
bool matchesLocation(const QString &location) const
Matches location?
QString getLocationPlusOptionalName() const
Location plus optional name (if available and different from location)
bool matchesDescriptiveName(const QString &name) const
Matches name?
static CAirport fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Object from JSON.
const QString & getLocation() const
Get location (e.g. "London")
bool hasValidIcaoCode() const
Valid ICAO code.
void updateMissingParts(const CAirport &airport)
Update the missing parts in airport.
const QString & getDescriptiveName() const
Get descriptive name.
const CAirportIcaoCode & getIcao() const
Get ICAO code.
const QString & getIcaoAsString() const
Get ICAO code as string.
Value object encapsulating information of airport ICAO data.
bool isEmpty() const
Is empty?
Value object for a list of airports.
QStringList allIcaoCodes(bool sorted) const
All ICAO codes.
QStringList allDescriptivesNames(bool sorted) const
All names.
static CAirportList fromDatabaseJson(const QJsonArray &array, CAirportList *inconsistent=nullptr)
From our DB JSON.
bool containsAirportWithIcaoCode(const CAirportIcaoCode &icao) const
Containing an airport with given ICAO code?
void updateMissingParts(const CAirportList &updateFromList)
Update this list from the other list.
CAirport findFirstByIcao(const CAirportIcaoCode &icao) const
Find first station by callsign, if not return default.
CAirport findFirstByNameOrLocation(const QString &nameOrLocation) const
Find first by name or location, if not return default.
CAirportList findByIcao(const CAirportIcaoCode &icao) const
Find 0..n airports by ICAO code.
QStringList allLocationsPlusOptionalDescription(bool sorted) const
All locations plus optional description.
QStringList allLocations() const
All locations.
void replaceOrAddByIcao(const CAirport &addedOrReplacedAirport)
Replace or add based on same ICAO code.
#define SWIFT_DEFINE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template definition of mixins for a CSequence subclass.