swift
aircraftcategorylist.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2019 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_AIRCRAFTCATEGORYLIST_H
7 #define SWIFT_MISC_AVIATION_AIRCRAFTCATEGORYLIST_H
8 
9 #include <tuple>
10 
11 #include <QJsonArray>
12 #include <QList>
13 #include <QMetaType>
14 #include <QSet>
15 
17 #include "misc/collection.h"
19 #include "misc/sequence.h"
20 #include "misc/swiftmiscexport.h"
21 
22 SWIFT_DECLARE_SEQUENCE_MIXINS(swift::misc::aviation, CAircraftCategory, CAircraftCategoryList)
23 
24 namespace swift::misc::aviation
25 {
28  public CSequence<CAircraftCategory>,
29  public db::IDatastoreObjectList<CAircraftCategory, CAircraftCategoryList, int>,
30  public mixin::MetaType<CAircraftCategoryList>
31  {
32  public:
35 
38 
41 
43  CAircraftCategoryList findByName(const QString &name, Qt::CaseSensitivity cs = Qt::CaseInsensitive) const;
44 
46  void sortByPath();
47 
49  void sortByLevel();
50 
52  QSet<QString> getLevelStrings() const;
53 
55  QString getLevelsString(const QString &separator = ", ") const;
56 
58  QList<int> getFirstLevels() const;
59 
61  QList<int> getSecondLevels() const;
62 
64  CAircraftCategoryList findHighestLevels(const CAircraftCategoryList &categories);
65 
67  CAircraftCategoryList findByFirstLevel(int level) const;
68 
70  CAircraftCategoryList findByLevel(const QList<int> &level, bool noRootNode = false) const;
71 
73  CAircraftCategory findByFullLevel(const QList<int> &level) const;
74 
76  CAircraftCategoryList findFirstLevels() const;
77 
80  CAircraftCategoryList findSiblings(const CAircraftCategory &category) const;
81 
84  CAircraftCategoryList findInParallelBranch(const CAircraftCategory &category) const;
85 
87  int removeIfLevel(const QList<int> &level);
88 
90  CAircraftCategoryList removedLevel(const QList<int> &level) const;
91 
93  static CAircraftCategoryList fromDatabaseJson(const QJsonArray &array);
94  };
95 } // namespace swift::misc::aviation
96 
99 
100 #endif // SWIFT_MISC_AVIATION_AIRCRAFTCATEGORYLIST_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 for aircraft categories.
Value object encapsulating a list of ICAO codes.
List of objects read from database. Such objects should implement.
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.