swift
ecosystem.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2017 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_NETWORK_ECOSYSTEM_H
7 #define SWIFT_MISC_NETWORK_ECOSYSTEM_H
8 
9 #include <QMetaType>
10 #include <QString>
11 
12 #include "misc/swiftmiscexport.h"
13 #include "misc/valueobject.h"
14 
15 SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::network, CEcosystem)
16 
17 namespace swift::misc::network
18 {
20  class SWIFT_MISC_EXPORT CEcosystem : public CValueObject<CEcosystem>
21  {
22  public:
25  {
26  IndexSystem = CPropertyIndexRef::GlobalIndexCEcosystem,
27  IndexSystemString
28  };
29 
31  enum System
32  {
38  PrivateFSD
39  };
40 
43 
45  CEcosystem(System s) : m_system(static_cast<int>(s)) {}
46 
48  System getSystem() const { return static_cast<System>(m_system); }
49 
51  bool isUnspecified() const { return this->getSystem() == Unspecified; }
52 
54  bool isSystem(System s) const { return this->getSystem() == s; }
55 
57  void setSystem(System system) { m_system = static_cast<int>(system); }
58 
60  const QString &getSystemString() const;
61 
63  QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
64 
66  void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
67 
69  int comparePropertyByIndex(CPropertyIndexRef index, const CEcosystem &compareValue) const;
70 
72  QString convertToQString(bool i18n = false) const;
73 
75  static const CEcosystem &unspecified();
76 
78  static const CEcosystem &vatsim();
79 
81  static const CEcosystem &swift();
82 
84  static const CEcosystem &swiftTest();
85 
87  static const CEcosystem &privateFsd();
88 
89  private:
90  int m_system = static_cast<int>(Unspecified);
91 
93  CEcosystem,
94  SWIFT_METAMEMBER(system));
95  };
96 } // namespace swift::misc::network
97 
98 Q_DECLARE_METATYPE(swift::misc::network::CEcosystem)
100 
101 #endif // SWIFT_MISC_NETWORK_ECOSYSTEM_H
Non-owning reference to a CPropertyIndex with a subset of its features.
Mix of the most commonly used mixin classes.
Definition: valueobject.h:114
ColumnIndex
Base class enums.
Definition: mixinindex.h:44
Ecosystem of server belonging together.
Definition: ecosystem.h:21
@ SwiftTest
swift test server
Definition: ecosystem.h:36
@ NoSystem
no relevant ecosystem
Definition: ecosystem.h:34
bool isUnspecified() const
Unknown system?
Definition: ecosystem.h:51
System getSystem() const
Get system.
Definition: ecosystem.h:48
bool isSystem(System s) const
Is system?
Definition: ecosystem.h:54
CEcosystem(System s)
Constructor.
Definition: ecosystem.h:45
CEcosystem()
Default constructor.
Definition: ecosystem.h:42
void setSystem(System system)
Set the system.
Definition: ecosystem.h:57
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition: metaclass.h:73
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition: metaclass.h:53
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template declaration of mixins for a CValueObject subclass to be placed near the top of the ...
Definition: valueobject.h:65