mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T24, shared info file name and flag for SharedInfoObjectEntity
This commit is contained in:
@@ -31,7 +31,7 @@ namespace BlackCore
|
||||
f |= AirportReader;
|
||||
}
|
||||
|
||||
if (entity.testFlag(CEntityFlags::InfoObjectEntity)) { f |= DbInfoDataReader; }
|
||||
if (entity.testFlag(CEntityFlags::DbInfoObjectEntity)) { f |= DbInfoDataReader; }
|
||||
if (entity.testFlag(CEntityFlags::BookingEntity)) { f |= VatsimBookingReader; }
|
||||
if (entity.testFlag(CEntityFlags::VatsimDataFile)) { f |= VatsimDataReader; }
|
||||
if (entity.testFlag(CEntityFlags::VatsimStatusFile)) { f |= VatsimStatusReader; }
|
||||
@@ -51,7 +51,7 @@ namespace BlackCore
|
||||
if (readers.testFlag(IcaoDataReader)) { entities |= CEntityFlags::AllIcaoAndCountries; }
|
||||
if (readers.testFlag(ModelReader)) { entities |= CEntityFlags::DistributorLiveryModel; }
|
||||
if (readers.testFlag(AirportReader)) { entities |= CEntityFlags::AirportEntity; }
|
||||
if (readers.testFlag(DbInfoDataReader)) { entities |= CEntityFlags::InfoObjectEntity; }
|
||||
if (readers.testFlag(DbInfoDataReader)) { entities |= CEntityFlags::DbInfoObjectEntity; }
|
||||
if (readers.testFlag(VatsimBookingReader)) { entities |= CEntityFlags::BookingEntity; }
|
||||
if (readers.testFlag(VatsimMetarReader)) { entities |= CEntityFlags::MetarEntity; }
|
||||
if (readers.testFlag(VatsimDataReader)) { entities |= CEntityFlags::VatsimDataFile; }
|
||||
|
||||
@@ -35,13 +35,13 @@ namespace BlackMisc
|
||||
DbReading = 1 << 0, //!< directly from DB
|
||||
DbWriting = 1 << 1, //!< DB writing
|
||||
Shared = 1 << 2, //!< shared directory
|
||||
SharedHeadersOnly = 1 << 3, //!< shared headers only
|
||||
SharedInfoOnly = 1 << 3, //!< shared info file only
|
||||
Cached = 1 << 4, //!< from cache
|
||||
Canceled = 1 << 5, //!< canceled DB reading
|
||||
Ignore = 1 << 6, //!< ignore this entity
|
||||
CacheThenDb = DbReading | Cached, //!< Cache where possible, otherwise DB
|
||||
CacheThenShared = Shared | Cached, //!< Cache where possible, otherwise shared
|
||||
CacheAndSharedHeaders = SharedHeadersOnly | Cached
|
||||
CacheAndSharedHeaders = SharedInfoOnly | Cached
|
||||
};
|
||||
Q_DECLARE_FLAGS(DataRetrievalMode, DataRetrievalModeFlag)
|
||||
|
||||
|
||||
@@ -159,6 +159,12 @@ namespace BlackMisc
|
||||
return names;
|
||||
}
|
||||
|
||||
const QString &CDbInfo::sharedInfoFileName()
|
||||
{
|
||||
static const QString f("dbinfo.json");
|
||||
return f;
|
||||
}
|
||||
|
||||
const QStringList &CDbInfo::serviceNames()
|
||||
{
|
||||
static const QStringList names({"jsonaircrafticao.php", "jsonairlineicao.php", "jsonairport.php", "jsoncountry.php", "jsondistributor.php", "jsonlivery.php", "jsonaircraftmodel.php" });
|
||||
|
||||
@@ -92,6 +92,9 @@ namespace BlackMisc
|
||||
//! The shared file names
|
||||
static const QStringList &sharedFileNames();
|
||||
|
||||
//! Get shared info file name
|
||||
static const QString &sharedInfoFileName();
|
||||
|
||||
//! Service names
|
||||
static const QStringList &serviceNames();
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace BlackMisc
|
||||
case BookingEntity: return "VATSIM bookings";
|
||||
case CountryEntity: return "Country";
|
||||
case DistributorEntity: return "Distributor";
|
||||
case InfoObjectEntity: return "Info objects";
|
||||
case DbInfoObjectEntity: return "Info objects (DB)";
|
||||
case SharedInfoObjectEntity: return "Info objects (shared)";
|
||||
case LiveryEntity: return "Livery";
|
||||
case ModelEntity: return "Model";
|
||||
case NoEntity: return "no data";
|
||||
@@ -52,7 +53,8 @@ namespace BlackMisc
|
||||
if (flag.testFlag(BookingEntity)) list << "VATSIM bookings";
|
||||
if (flag.testFlag(CountryEntity)) list << "Country";
|
||||
if (flag.testFlag(DistributorEntity)) list << "Distributor";
|
||||
if (flag.testFlag(InfoObjectEntity)) list << "Info objects";
|
||||
if (flag.testFlag(DbInfoObjectEntity)) list << "Info objects (DB)";
|
||||
if (flag.testFlag(SharedInfoObjectEntity)) list << "Info objects (shared)";
|
||||
if (flag.testFlag(LiveryEntity)) list << "Livery";
|
||||
if (flag.testFlag(ModelEntity)) list << "Model";
|
||||
if (flag.testFlag(NoEntity)) list << "no data";
|
||||
@@ -112,7 +114,7 @@ namespace BlackMisc
|
||||
|
||||
CEntityFlags::Entity CEntityFlags::iterateDbEntities(Entity &entities)
|
||||
{
|
||||
if (entities == NoEntity || entities == InfoObjectEntity) { return NoEntity; }
|
||||
if (entities == NoEntity || entities == DbInfoObjectEntity) { return NoEntity; }
|
||||
if (entities.testFlag(AircraftIcaoEntity)) { entities &= ~AircraftIcaoEntity; return AircraftIcaoEntity; }
|
||||
if (entities.testFlag(AirlineIcaoEntity)) { entities &= ~AirlineIcaoEntity; return AirlineIcaoEntity; }
|
||||
if (entities.testFlag(AirportEntity)) { entities &= ~AirportEntity; return AirportEntity; }
|
||||
|
||||
@@ -33,26 +33,27 @@ namespace BlackMisc
|
||||
enum EntityFlag
|
||||
{
|
||||
NoEntity = 0, //!< no data at all
|
||||
InfoObjectEntity = 1 << 0, //!< info about DB data (kinf of metadata)
|
||||
AircraftIcaoEntity = 1 << 1, //!< ICAO codes for aircraft
|
||||
AirlineIcaoEntity = 1 << 2, //!< ICAO codes for airlines
|
||||
CountryEntity = 1 << 3, //!< country codes
|
||||
DistributorEntity = 1 << 4, //!< distributors
|
||||
LiveryEntity = 1 << 5, //!< liveries
|
||||
ModelEntity = 1 << 6, //!< models
|
||||
BookingEntity = 1 << 7, //!< bookings
|
||||
MetarEntity = 1 << 8, //!< METAR
|
||||
VatsimDataFile = 1 << 9, //!< the VATSIM data file (multiple data entities)
|
||||
VatsimStatusFile = 1 << 10, //!< the VATSIM status file (URLs for data files etc.)
|
||||
AirportEntity = 1 << 11, //!< airports
|
||||
AllEntities = ((1 << 12) - 1), //!< everything
|
||||
DbInfoObjectEntity = 1 << 0, //!< info about DB data (kind of metadata)
|
||||
SharedInfoObjectEntity = 1 << 1, //!< info about shared DB data (metadata)
|
||||
AircraftIcaoEntity = 1 << 2, //!< ICAO codes for aircraft
|
||||
AirlineIcaoEntity = 1 << 3, //!< ICAO codes for airlines
|
||||
CountryEntity = 1 << 4, //!< country codes
|
||||
DistributorEntity = 1 << 5, //!< distributors
|
||||
LiveryEntity = 1 << 6, //!< liveries
|
||||
ModelEntity = 1 << 7, //!< models
|
||||
BookingEntity = 1 << 8, //!< bookings
|
||||
MetarEntity = 1 << 9, //!< METAR
|
||||
VatsimDataFile = 1 << 10, //!< the VATSIM data file (multiple data entities)
|
||||
VatsimStatusFile = 1 << 11, //!< the VATSIM status file (URLs for data files etc.)
|
||||
AirportEntity = 1 << 12, //!< airports
|
||||
AllEntities = ((1 << 13) - 1), //!< everything
|
||||
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, //!< all ICAO codes
|
||||
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, //!< all ICAO codes and countries
|
||||
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, //!< Combinded
|
||||
ModelMatchingEntities = AllIcaoEntities | LiveryEntity | ModelEntity, //!< all needed for model matching
|
||||
AllDbEntities = AllIcaoAndCountries | DistributorLiveryModel | InfoObjectEntity | AirportEntity, //!< All DB stuff
|
||||
AllDbEntitiesNoInfoObjects = AllIcaoAndCountries | DistributorLiveryModel | AirportEntity, //!< All DB entities, no info objects
|
||||
AllDbEntitiesNoInfoObjectsNoAirports = AllIcaoAndCountries | DistributorLiveryModel //!< All DB entities, no info objects and airports
|
||||
AllDbEntities = AllIcaoAndCountries | DistributorLiveryModel | DbInfoObjectEntity | AirportEntity, //!< All DB stuff
|
||||
AllDbEntitiesNoInfoObjects = AllIcaoAndCountries | DistributorLiveryModel | AirportEntity, //!< All DB entities, no info objects
|
||||
AllDbEntitiesNoInfoObjectsNoAirports = AllIcaoAndCountries | DistributorLiveryModel //!< All DB entities, no info objects and airports
|
||||
};
|
||||
Q_DECLARE_FLAGS(Entity, EntityFlag)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user