swift
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 
11 #include "misc/aviation/airport.h"
13 #include "misc/collection.h"
15 #include "misc/geo/geoobjectlist.h"
16 #include "misc/sequence.h"
17 #include "misc/swiftmiscexport.h"
18 
19 SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::aviation, CAirport, CAirportList)
20 
21 namespace 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 
38  CAirportList(const CSequence<CAirport> &other);
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 
59  QStringList allIcaoCodes(bool sorted) const;
60 
62  QStringList allDescriptivesNames(bool sorted) const;
63 
66  QStringList allLocations() const;
67 
69  QStringList allLocationsPlusOptionalDescription(bool sorted) const;
70 
72  static CAirportList fromDatabaseJson(const QJsonArray &array, CAirportList *inconsistent = nullptr);
73  };
74 } // namespace swift::misc::aviation
75 
76 Q_DECLARE_METATYPE(swift::misc::aviation::CAirportList)
78 
79 #endif // SWIFT_MISC_AVIATION_AIRPORTLIST_H
Generic ordered container with value semantics.
Definition: collection.h:107
Generic sequential container with value semantics.
Definition: sequence.h:86
CSequence()=default
Default constructor.
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
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...
Definition: mixinmetatype.h:29
#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.