swift
Loading...
Searching...
No Matches
airportlist.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_MISC_AVIATION_AIRPORTLIST_H
7#define SWIFT_MISC_AVIATION_AIRPORTLIST_H
8
9#include <QMetaType>
10
13#include "misc/collection.h"
16#include "misc/sequence.h"
18
19SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::aviation, CAirport, CAirportList)
20
21namespace swift::misc::aviation
22{
25 public CSequence<CAirport>,
26 public db::IDatastoreObjectList<CAirport, CAirportList, int>,
27 public geo::IGeoObjectWithRelativePositionList<CAirport, CAirportList>,
28 public mixin::MetaType<CAirportList>
29 {
30 public:
33
35 CAirportList() = default;
36
39
41 CAirportList findByIcao(const CAirportIcaoCode &icao) const;
42
44 CAirport findFirstByIcao(const CAirportIcaoCode &icao) const;
45
47 CAirport findFirstByNameOrLocation(const QString &nameOrLocation) const;
48
50 bool containsAirportWithIcaoCode(const CAirportIcaoCode &icao) const;
51
53 void replaceOrAddByIcao(const CAirport &addedOrReplacedAirport);
54
56 void updateMissingParts(const CAirportList &updateFromList);
57
60
63
67
70
72 static CAirportList fromDatabaseJson(const QJsonArray &array, CAirportList *inconsistent = nullptr);
73 };
74} // namespace swift::misc::aviation
75
78
79#endif // SWIFT_MISC_AVIATION_AIRPORTLIST_H
Generic ordered container with value semantics.
Definition collection.h:113
CSequence()=default
Default constructor.
Q_REQUIRED_RESULT CSequence sorted(Predicate p) const
Definition sequence.h:610
Value object encapsulating information about an airpot.
Definition airport.h:36
Value object encapsulating information of airport ICAO data.
Value object for a list of airports.
Definition airportlist.h:29
CSequence()=default
Default constructor.
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.
CAirportList()=default
Default constructor.
List of objects read from database. Such objects should implement.
List of objects with geo coordinates.
CRTP class template from which a derived class can inherit common methods dealing with the metatype o...
#define SWIFT_MISC_DECLARE_USING_MIXIN_METATYPE(DERIVED)
When a derived class and a base class both inherit from mixin::MetaType, the derived class uses this ...
#define SWIFT_DECLARE_SEQUENCE_MIXINS(Namespace, T, List)
Explicit template declaration of mixins for a CSequence subclass to be placed near the top of the hea...
Definition sequence.h:62
#define SWIFT_MISC_EXPORT
Export a class or function from the library.