Issue #77 Remove unneeded classes

This commit is contained in:
Mat Sutcliffe
2020-08-25 23:28:18 +01:00
parent 15789902a1
commit 4094b18c39
6 changed files with 15 additions and 201 deletions

View File

@@ -100,11 +100,11 @@ namespace BlackMisc
CVariant CAircraftLights::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
{
if (index.isMyself()) { return CVariant::from(*this); }
if (INullable::canHandleIndex(index)) { return INullable::propertyByIndex(index); }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexIsNull: return CVariant::from(this->isNull());
case IndexBeacon: return CVariant::from(m_beaconOn);
case IndexLanding: return CVariant::from(m_landingOn);
case IndexLogo: return CVariant::from(m_logoOn);
@@ -120,11 +120,11 @@ namespace BlackMisc
void CAircraftLights::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
{
if (index.isMyself()) { (*this) = variant.to<CAircraftLights>(); return; }
if (INullable::canHandleIndex(index)) { INullable::setPropertyByIndex(index, variant); return; }
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexIsNull: m_isNull = variant.toBool(); break;
case IndexBeacon: m_beaconOn = variant.toBool(); break;
case IndexLanding: m_landingOn = variant.toBool(); break;
case IndexLogo: m_logoOn = variant.toBool(); break;
@@ -142,6 +142,7 @@ namespace BlackMisc
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexIsNull: return Compare::compare(m_isNull, compareValue.isNull());
case IndexBeacon: return Compare::compare(m_beaconOn, compareValue.isBeaconOn());
case IndexLanding: return Compare::compare(m_landingOn, compareValue.isLandingOn());
case IndexLogo: return Compare::compare(m_logoOn, compareValue.isLogoOn());
@@ -152,7 +153,7 @@ namespace BlackMisc
case IndexRecognition: return Compare::compare(m_recognition, compareValue.isRecognitionOn());
default: break;
}
return INullable::comparePropertyByIndex(index.copyFrontRemoved(), compareValue);
return 0;
}
void CAircraftLights::setAllOn()

View File

@@ -16,7 +16,6 @@
#include "blackmisc/propertyindex.h"
#include "blackmisc/valueobject.h"
#include "blackmisc/variant.h"
#include "blackmisc/nullable.h"
#include <QMetaType>
#include <QString>
@@ -28,14 +27,13 @@ namespace BlackMisc
class CAircraftSituation;
//! Value object encapsulating information about aircraft's lights
class BLACKMISC_EXPORT CAircraftLights :
public CValueObject<CAircraftLights>,
public INullable
class BLACKMISC_EXPORT CAircraftLights : public CValueObject<CAircraftLights>
{
public:
//! Properties by index
enum ColumnIndex
{
IndexIsNull = CPropertyIndex::GlobalIndexINullable,
IndexStrobe = CPropertyIndex::GlobalIndexCAircraftLights,
IndexLanding,
IndexTaxi,
@@ -49,8 +47,8 @@ namespace BlackMisc
//! Default constructor
CAircraftLights() = default;
//! Constructor, init to null
using INullable::INullable;
//! Null constructor
CAircraftLights(std::nullptr_t) : m_isNull(true) {}
//! Constructor
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn);
@@ -136,7 +134,14 @@ namespace BlackMisc
//! Guessed lights
static CAircraftLights guessedLights(const CAircraftSituation &situation);
//! Null?
bool isNull() const { return m_isNull; }
//! Null?
void setNull(bool null) { m_isNull = null; }
private:
bool m_isNull = false; //!< null?
bool m_strobeOn = false;
bool m_landingOn = false;
bool m_taxiOn = false;