mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T265, Ref T430, Ref T473 functions renamed
This commit is contained in:
committed by
Mat Sutcliffe
parent
6bd3a50ed8
commit
2d3e2e2d99
@@ -794,7 +794,7 @@ namespace BlackMisc
|
||||
model, modelIata, modelSwift, wtc,
|
||||
real, legacy, military, rank
|
||||
);
|
||||
code.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
code.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ namespace BlackMisc
|
||||
code.setGroupDesignator(groupDesignator);
|
||||
code.setGroupId(groupId);
|
||||
code.setGroupName(groupName);
|
||||
code.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
code.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace BlackMisc
|
||||
const CCountry country = CCountry::fromDatabaseJson(json, "ctry_");
|
||||
airport.setCountry(country);
|
||||
|
||||
airport.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
airport.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return airport;
|
||||
}
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace BlackMisc
|
||||
if (combinedCode.isEmpty())
|
||||
{
|
||||
CLivery liveryStub; // only consists of id, maybe key and timestamp
|
||||
liveryStub.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
liveryStub.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return liveryStub;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace BlackMisc
|
||||
CAirlineIcaoCode airline;
|
||||
if (!isColorLivery) { airline = CAirlineIcaoCode::fromDatabaseJson(json, "al_"); }
|
||||
CLivery livery(combinedCode, airline, description, colorFuselage, colorTail, military);
|
||||
livery.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
livery.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
|
||||
// color liveries must have default ICAO, but airline liveries must have DB airline
|
||||
BLACK_VERIFY_X((livery.isColorLivery() && !livery.getAirlineIcaoCode().hasValidDbKey()) || (livery.isAirlineLivery() && livery.getAirlineIcaoCode().hasValidDbKey()), Q_FUNC_INFO, "inconsistent data");
|
||||
@@ -275,7 +275,7 @@ namespace BlackMisc
|
||||
if (combinedCode.isEmpty())
|
||||
{
|
||||
CLivery liveryStub; // only consists of id, maybe key and timestamp
|
||||
liveryStub.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
liveryStub.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return liveryStub;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
CLivery livery(combinedCode, airline, description, colorFuselage, colorTail, military);
|
||||
livery.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
livery.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
|
||||
// color liveries must have default ICAO, but airline liveries must have DB airline
|
||||
BLACK_VERIFY_X((livery.isColorLivery() && !livery.getAirlineIcaoCode().hasValidDbKey()) || (livery.isAirlineLivery() && livery.getAirlineIcaoCode().hasValidDbKey()), Q_FUNC_INFO, "inconsistent data");
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace BlackMisc
|
||||
country.setAlias2(alias2);
|
||||
country.setIso3Code(iso3);
|
||||
country.setHistoric(stringToBool(historic));
|
||||
country.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
country.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return country;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace BlackMisc
|
||||
const bool existing = json.value("existing").toBool();
|
||||
|
||||
CArtifact artifact(name, version, md5, type, size, existing, platform);
|
||||
artifact.setKeyAndTimestampFromDatabaseJson(json);
|
||||
artifact.setKeyVersionTimestampFromDatabaseJson(json);
|
||||
if (json.contains("distributions"))
|
||||
{
|
||||
const QJsonObject distJson = json.value("distributions").toObject();
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace BlackMisc
|
||||
{
|
||||
namespace Db
|
||||
{
|
||||
void IDatastoreObject::setTimestampAndVersionFromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
void IDatastoreObject::setTimestampVersionFromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
{
|
||||
// we check 2 formats, the DB format and the backend object format
|
||||
QString timestampString(json.value(prefix % u"lastupdated").toString());
|
||||
@@ -84,12 +84,12 @@ namespace BlackMisc
|
||||
return QJsonValue();
|
||||
}
|
||||
|
||||
void IDatastoreObjectWithIntegerKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
void IDatastoreObjectWithIntegerKey::setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
{
|
||||
// this function is performance sensitive, as it is called for all DB data
|
||||
const int dbKey = json.value(prefix % u"id").toInt(-1);
|
||||
this->setDbKey(dbKey);
|
||||
IDatastoreObject::setTimestampAndVersionFromDatabaseJson(json, prefix);
|
||||
IDatastoreObject::setTimestampVersionFromDatabaseJson(json, prefix);
|
||||
}
|
||||
|
||||
bool IDatastoreObjectWithIntegerKey::existsKey(const QJsonObject &json, const QString &prefix)
|
||||
@@ -176,11 +176,11 @@ namespace BlackMisc
|
||||
return empty;
|
||||
}
|
||||
|
||||
void IDatastoreObjectWithStringKey::setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
void IDatastoreObjectWithStringKey::setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix)
|
||||
{
|
||||
QString dbKey = json.value(prefix % u"id").toString();
|
||||
this->setDbKey(dbKey);
|
||||
IDatastoreObject::setTimestampAndVersionFromDatabaseJson(json, prefix);
|
||||
IDatastoreObject::setTimestampVersionFromDatabaseJson(json, prefix);
|
||||
}
|
||||
|
||||
bool IDatastoreObjectWithStringKey::existsKey(const QJsonObject &json, const QString &prefix)
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace BlackMisc
|
||||
|
||||
protected:
|
||||
//! Set versionn and timestamp values
|
||||
void setTimestampAndVersionFromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
void setTimestampVersionFromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
QString m_version; //!< version info
|
||||
};
|
||||
@@ -128,7 +128,7 @@ namespace BlackMisc
|
||||
IDatastoreObjectWithIntegerKey(int key) : m_dbKey(key) {}
|
||||
|
||||
//! Set key and timestamp values
|
||||
void setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
void setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
//! Is a key available?
|
||||
static bool existsKey(const QJsonObject &json, const QString &prefix = QString());
|
||||
@@ -209,7 +209,7 @@ namespace BlackMisc
|
||||
IDatastoreObjectWithStringKey(const QString &key) : m_dbKey(key) {}
|
||||
|
||||
//! Set key and timestamp values
|
||||
void setKeyAndTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
void setKeyVersionTimestampFromDatabaseJson(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
//! Is a key available?
|
||||
static bool existsKey(const QJsonObject &json, const QString &prefix = QString());
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace BlackMisc
|
||||
const int entries(json.value(prefix + "entries").toInt());
|
||||
const QString tableName(json.value(prefix + "tablename").toString());
|
||||
CDbInfo dbInfo(id, tableName, entries);
|
||||
dbInfo.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
dbInfo.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return dbInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace BlackMisc
|
||||
const bool restricted = json.value("restricted").toBool();
|
||||
const int stability = json.value("stability").toInt();
|
||||
CDistribution distribution(channel, stability, restricted);
|
||||
distribution.setKeyAndTimestampFromDatabaseJson(json);
|
||||
distribution.setKeyVersionTimestampFromDatabaseJson(json);
|
||||
|
||||
// add the URLs
|
||||
for (int i = 0; i < 5; i++)
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace BlackMisc
|
||||
{
|
||||
// stub, only key, maybe also timestamps
|
||||
CDistributor distributorStub;
|
||||
distributorStub.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
distributorStub.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
return distributorStub;
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace BlackMisc
|
||||
const QString alias2(json.value(prefix % u"alias2").toString());
|
||||
Q_ASSERT_X(!description.isEmpty(), Q_FUNC_INFO, "Missing description");
|
||||
CDistributor distributor("", description, alias1, alias2, simulator);
|
||||
distributor.setKeyAndTimestampFromDatabaseJson(json, prefix);
|
||||
distributor.setKeyVersionTimestampFromDatabaseJson(json, prefix);
|
||||
distributor.setLoadedFromDb(true);
|
||||
return distributor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user