swift
Loading...
Searching...
No Matches
vpilotmodelrule.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2015 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_SIMULATION_FSCOMMON_VPILOTMODELRULE_H
7#define SWIFT_MISC_SIMULATION_FSCOMMON_VPILOTMODELRULE_H
8
9#include <QMetaType>
10#include <QString>
11#include <QtGlobal>
12
13#include "misc/metaclass.h"
17#include "misc/timestampbased.h"
18#include "misc/valueobject.h"
19
20SWIFT_DECLARE_VALUEOBJECT_MIXINS(swift::misc::simulation::fscommon, CVPilotModelRule)
21
22namespace swift::misc::simulation::fscommon
23{
26 class SWIFT_MISC_EXPORT CVPilotModelRule : public CValueObject<CVPilotModelRule>, public ITimestampBased
27 {
28 public:
31 {
32 IndexModelName = CPropertyIndexRef::GlobalIndexCVPilotModelRule,
33 IndexFolder,
34 IndexTypeCode,
35 IndexCallsignPrefix
36 };
37
39 CVPilotModelRule() = default;
40
42 CVPilotModelRule(const QString &modelName, const QString &folder, const QString &typeCode,
43 const QString &callsignPrefix, qint64 updated);
44
46 const QString &getModelName() const { return this->m_modelName; }
47
49 const QString &getFolder() const { return this->m_folder; }
50
52 QString getDistributor() const;
53
55 const QString &getTypeCode() const { return this->m_typeCode; }
56
58 const QString &getCallsignPrefix() const { return this->m_callsignPrefix; }
59
61 void setModelName(const QString &name) { this->m_modelName = name.trimmed().toUpper(); }
62
64 void setTypeCode(const QString &code) { this->m_typeCode = code.trimmed().toUpper(); }
65
67 void setFolder(const QString &folder) { this->m_folder = folder.trimmed().toUpper(); }
68
70 void setCallsignPrefix(const QString &callsign) { this->m_callsignPrefix = callsign.trimmed().toUpper(); }
71
73 QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
74
76 void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant);
77
79 QString convertToQString(bool i18n = false) const;
80
82 CAircraftModel toAircraftModel() const;
83
84 private:
85 QString m_modelName;
86 QString m_folder;
87 QString m_typeCode;
88 QString m_callsignPrefix;
89 qint64 m_updatedMsSinceEpoch;
90
97 SWIFT_METAMEMBER(updatedMsSinceEpoch));
98 };
99
100} // namespace swift::misc::simulation::fscommon
101
103
104#endif // SWIFT_MISC_SIMULATION_FSCOMMON_VPILOTMODELRULE_H
Non-owning reference to a CPropertyIndex with a subset of its features.
ITimestampBased()=default
Constructor.
Aircraft model (used by another pilot, my models on disk).
Value object encapsulating information of software distributor.
void setModelName(const QString &name)
Model name.
void setTypeCode(const QString &code)
Type code.
CVPilotModelRule()=default
Default constructor.
const QString & getCallsignPrefix() const
Get callsign prefix.
void setCallsignPrefix(const QString &callsign)
Callsign prefix.
const QString & getModelName() const
Get model name.
const QString & getTypeCode() const
Get type code.
void setFolder(const QString &folder)
Folder.
const QString & getFolder() const
Get folder.
#define SWIFT_METAMEMBER(MEMBER,...)
Macro to define an element within a metaclass.
Definition metaclass.h:72
#define SWIFT_METACLASS(CLASS,...)
Macro to define a nested metaclass that describes the attributes of its enclosing class.
Definition metaclass.h:52
@ CaseInsensitiveComparison
Element will be compared case insensitively (must be a QString).
Definition metaclass.h:205
QString toUpper() const const
QString trimmed() const const
#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