Files
pilotclient/src/blackcore/webreaderflags.cpp
Klaus Basan 2cfd3540b8 refs #469, renamed flags
* db to entity flags as it also features entities not from DB
* Flag enums singular (discussed with MS / slack)
2015-11-19 21:00:13 +00:00

61 lines
1.8 KiB
C++

/* 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.
*/
#include "webreaderflags.h"
using namespace BlackMisc::Network;
namespace BlackCore
{
CWebReaderFlags::WebReader CWebReaderFlags::entityToReader(CEntityFlags::Entity entity)
{
WebReader f = None;
if (entity.testFlag(CEntityFlags::AircraftIcaoEntity) ||
entity.testFlag(CEntityFlags::AirlineIcaoEntity) ||
entity.testFlag(CEntityFlags::CountryEntity))
{
f |= IcaoDataReader;
}
if (entity.testFlag(CEntityFlags::ModelEntity) ||
entity.testFlag(CEntityFlags::DistributorEntity) ||
entity.testFlag(CEntityFlags::LiveryEntity))
{
f |= ModelReader;
}
if (entity.testFlag(CEntityFlags::BookingEntity))
{
f |= VatsimBookingReader;
}
if (entity.testFlag(CEntityFlags::VatsimDataFile))
{
f |= VatsimDataReader;
}
if (entity.testFlag(CEntityFlags::MetarEntity))
{
f |= VatsimMetarReader;
}
return f;
}
bool CWebReaderFlags::isFromSwiftDb(CEntityFlags::Entity entity)
{
return isFromSwiftDb(entityToReader(entity));
}
bool CWebReaderFlags::isFromSwiftDb(WebReader reader)
{
return reader.testFlag(ModelReader) || reader.testFlag(IcaoDataReader);
}
} // namespace