7 #include <QStringBuilder>
17 namespace swift::misc::simulation
25 : m_description(description), m_alias1(alias1), m_alias2(alias2), m_simulator(simulator)
43 if (s.
isEmpty()) {
return false; }
50 if (distributor.
hasAlias1() && this->matchesKeyOrAlias(distributor.
getAlias1())) {
return true; }
62 if (IDatastoreObjectWithStringKey::canHandleIndex(index))
64 return IDatastoreObjectWithStringKey::propertyByIndex(index);
86 if (IDatastoreObjectWithStringKey::canHandleIndex(index))
88 IDatastoreObjectWithStringKey::setPropertyByIndex(index, variant);
100 case IndexAlias1: m_alias1 = variant.
value<
QString>();
break;
101 case IndexAlias2: m_alias2 = variant.
value<
QString>();
break;
102 case IndexDescription: m_description = variant.
value<
QString>();
break;
110 if (IDatastoreObjectWithStringKey::canHandleIndex(index))
112 return IDatastoreObjectWithStringKey::comparePropertyByIndex(index, compareValue);
126 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Compare failed");
187 return distributorStub;
193 Q_ASSERT_X(!description.
isEmpty(), Q_FUNC_INFO,
"Missing description");
194 CDistributor distributor(
"", description, alias1, alias2, simulator);
251 static const QString k(
"XCSL");
257 static const QString k(
"MSFS");
263 static const QString k(
"MSFS2024");
A sequence of log categories.
Non-owning reference to a CPropertyIndex with a subset of its features.
Q_REQUIRED_RESULT CPropertyIndexRef copyFrontRemoved() const
Copy with first element removed.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
void push_back(const T &value)
Appends an element at the end of the sequence.
Streamable status message, e.g.
constexpr static auto SeverityError
Status severities.
Status messages, e.g. from Core -> GUI.
static bool canHandleIndex(CPropertyIndexRef index)
Can given index be handled.
int comparePropertyByIndex(CPropertyIndexRef index, const IOrderable &compareValue) const
Compare for index.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
void setLoadedFromDb(bool loaded)
Mark as loaded from DB.
static bool existsKey(const QJsonObject &json, const QString &prefix=QString())
Is a key available?
bool hasValidDbKey() const
Has valid DB key.
const QString & getDbKey() const
Get DB key.
ColumnIndex
Property index.
void setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Set key and timestamp values.
void setDbKey(const QString &key)
Set the DB key.
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
Set property by index.
QVariant propertyByIndex(CPropertyIndexRef index) const
Property by index.
Value object encapsulating information of software distributor.
bool hasAlias1() const
Alias 1?
void setDescription(const QString &description)
Set description.
QString getIdAndDescription() const
Get id and description.
static const QString & standardFS9()
Hardcoded keys for standard models.
static const QSet< QString > & standardAllFsFamily()
Hardcoded keys for standard models.
static const QString & xplaneXcsl()
Hardcoded keys for standard models.
int comparePropertyByIndex(CPropertyIndexRef index, const CDistributor &compareValue) const
Compare for index.
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const
Property by index.
const QString & getDescription() const
Get description.
void setPropertyByIndex(swift::misc::CPropertyIndexRef index, const QVariant &variant)
Set property by index.
static const QSet< QString > & xplaneMostPopular()
Hardcoded keys for standard models.
static const QString & standardMsfs()
Hardcoded keys for standard models.
static const QString & standardXPlane()
Hardcoded keys for standard models.
bool matchesKeyOrAlias(const QString &keyOrAlias) const
Matches key or alias.
static const QString & standardFSX()
Hardcoded keys for standard models.
static const QString & standardFlightGear()
Hardcoded keys for standard models.
void updateMissingParts(const CDistributor &otherDistributor)
Update missing parts.
bool hasAlias2() const
Alias 2?
CDistributor()
Default constructor.
bool hasDescription() const
Has description.
bool hasCompleteData() const
Complete data?
QString convertToQString(bool i18n=false) const
Cast as QString.
static CDistributor fromDatabaseJson(const QJsonObject &json, const QString &prefix=QString())
Object from JSON.
static const QString & standardP3D()
Hardcoded keys for standard models.
static const QString & standardMsfs2024()
Hardcoded keys for standard models.
const QString & getAlias2() const
Get alias2.
swift::misc::CStatusMessageList validate() const
Validate data.
void setAlias1(const QString &alias)
Set alias1.
static const QString & xplaneBlueBell()
Hardcoded keys for standard models.
const QString & getAlias1() const
Get alias1.
bool matchesSimulator(const CSimulatorInfo &simulator) const
Matches simulator.
Simple hardcoded info about the corresponding simulator.
int comparePropertyByIndex(CPropertyIndexRef index, const CSimulatorInfo &compareValue) const
Cast as QString.
bool matchesAny(const CSimulatorInfo &otherInfo) const
Matches any simulator.
static CSimulatorInfo fromDatabaseJson(const QJsonObject &json, const QString &prefix)
From database JSON.
QString removeChars(const QString &s, F predicate)
Return a string with characters removed that match the given predicate.
QJsonValue value(QLatin1StringView key) const const
QString toString() const const
QString & append(QChar ch)
QString arg(Args &&... args) const const
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
bool isEmpty() const const
QString toUpper() const const
QString trimmed() const const
QVariant fromValue(T &&value)
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.