refs #469, renamed flags

* db to entity flags as it also features entities not from DB
* Flag enums singular (discussed with MS / slack)
This commit is contained in:
Klaus Basan
2015-09-28 17:16:36 +02:00
committed by Mathew Sutcliffe
parent 24432a56c7
commit 2cfd3540b8
37 changed files with 190 additions and 166 deletions

View File

@@ -0,0 +1,76 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKMISC_NETWORK_ENTITRFLAGS_H
#define BLACKMISC_NETWORK_ENTITRFLAGS_H
#include "blackmisc/blackmiscexport.h"
#include <QObject>
namespace BlackMisc
{
namespace Network
{
/*!
* What and state of reading from web services
*/
class BLACKMISC_EXPORT CEntityFlags
{
public:
//! Which data to read, requires corresponding readers
enum EntityFlag
{
NoEntity = 0, ///< no data at all
VatsimDataFile = 1 << 0, ///< the VATSIM data file (multiple data entities)
BookingEntity = 1 << 1, ///< bookings
MetarEntity = 1 << 2,
AircraftIcaoEntity = 1 << 3, ///< ICAO codes for aircraft
AirlineIcaoEntity = 1 << 4, ///< ICAO codes for airlines
CountryEntity = 1 << 5, ///< country codes
DistributorEntity = 1 << 6, ///< distributors
LiveryEntity = 1 << 7, ///< liveries
ModelEntity = 1 << 8, ///< models
AllIcaoEntities = AircraftIcaoEntity | AirlineIcaoEntity, ///< all ICAO codes
AllIcaoAndCountries = AircraftIcaoEntity | AirlineIcaoEntity | CountryEntity, ///< all ICAO codes and countries
DistributorLiveryModel = DistributorEntity | LiveryEntity | ModelEntity, ///< Combinded
AllEntities = 0xFFFF ///< everything
};
Q_DECLARE_FLAGS(Entity, EntityFlag)
//! State of operation
enum ReadState
{
StartRead, ///< reading has been started
ReadFinished, ///< reading done
ReadFailed ///< reading failed
};
//! Convert to string
static QString flagToString(EntityFlag flag);
//! Convert to string
static QString flagToString(BlackMisc::Network::CEntityFlags::Entity flag);
//! Convert to string
static QString flagToString(ReadState flag);
//! Register metadata
static void registerMetadata();
};
} // namespace
} // namespace
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::EntityFlag)
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::Entity)
Q_DECLARE_METATYPE(BlackMisc::Network::CEntityFlags::ReadState)
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackMisc::Network::CEntityFlags::Entity)
#endif // guard