Ref T409, new version of livery string parsing (sending ids)

This commit is contained in:
Klaus Basan
2018-10-27 01:57:03 +02:00
parent b977b87177
commit 4b74267248
2 changed files with 71 additions and 41 deletions

View File

@@ -47,6 +47,20 @@ namespace BlackMisc
class CIcon;
namespace Simulation
{
//! DB ids
struct DBTripleIds
{
int model = -1; //!< model id
int livery = -1; //!< livery id, by that I have airline id
int aircraft = -1; //!< aircraft ICAO id
//! Any valid id?
bool hasAnyId() const
{
return model >= 0 || livery >= 0 || aircraft >= 0;
}
};
//! Aircraft model (used by another pilot, my models on disk)
//! \remarks Simulator independent class, supposed to be common denominator
class BLACKMISC_EXPORT CAircraftModel :
@@ -316,8 +330,8 @@ namespace BlackMisc
//! Matches given simulator?
bool matchesSimulatorFlag(CSimulatorInfo::Simulator simulator) const;
//! swift livery string (to be sent via network), "liveryCode [modelString]";
//! \sa splitNetworkLiveryString
//! swift livery string (to be sent via network)
//! \sa parseNetworkLiveryString
QString getSwiftLiveryString() const;
//! Update missing parts from another model
@@ -445,10 +459,15 @@ namespace BlackMisc
//! From swift DB JSON, caching during this process (faster)
static CAircraftModel fromDatabaseJsonCaching(const QJsonObject &json, Aviation::AircraftIcaoIdMap &aircraftIcaos, Aviation::LiveryIdMap &liveries, DistributorIdMap &distributors, const QString &prefix = QString("mod_"));
//! Split swift network string "DLH._STD [modelname]"
//! \return QStringList [0] livery code , [1] model string
//! Livery string prefix
static const QString &liveryStringPrefix();
//! swift livery string
static bool isSwiftLiyeryString(const QString &liveryString);
//! Split swift network string
//! \sa getSwiftLiveryString
static QStringList splitNetworkLiveryString(const QString &liveryString);
static DBTripleIds parseNetworkLiveryString(const QString &liveryString);
//! Hint, that model was automatically generated (e.g. by auto stashing)
static const QString &autoGenerated();