refs #328 CAircraftParts value classes

This commit is contained in:
Roland Winklmeier
2015-01-12 14:04:43 +01:00
committed by Klaus Basan
parent 16042c1fb2
commit 0a46a4a0bd
13 changed files with 648 additions and 4 deletions

View File

@@ -0,0 +1,102 @@
/* Copyright (C) 2014
* 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_AIRCRAFTLIGHTS_H
#define BLACKMISC_AIRCRAFTLIGHTS_H
#include "blackmisc/valueobject.h"
namespace BlackMisc
{
namespace Aviation
{
//! Value object encapsulating information about aircraft's lights
class CAircraftLights : public CValueObjectStdTuple<CAircraftLights>
{
public:
//! Default constructor
CAircraftLights() = default;
//! Constructor
CAircraftLights(bool strobeOn, bool landingOn, bool taxiOn, bool beaconOn, bool navOn, bool logoOn);
//! Strobes lights on?
bool isStrobeOn() const { return m_strobeOn; }
//! Set strobe lights
void setStrobeOn(bool on) { m_strobeOn = on; }
//! Landing lights on?
bool isLandingOn() const { return m_landingOn; }
//! Set landing lights
void setLandingOn(bool on) { m_landingOn = on; }
//! Taxi lights on?
bool isTaxiOn() const { return m_taxiOn; }
//! Set taxi lights
void setTaxiOn(bool on) { m_taxiOn = on; }
//! Beacon lights on?
bool isBeaconOn() const { return m_beaconOn; }
//! Set beacon lights
void setBeaconOn(bool on) { m_beaconOn = on; }
//! Nac lights on?
bool isNavOn() const { return m_navOn; }
//! Set nav lights
void setNavOn(bool on) { m_navOn = on; }
//! Logo lights on?
bool isLogoOn() const { return m_logoOn; }
//! Set logo lights
void setLogoOn(bool on) { m_logoOn = on; }
//! Returns object with all lights switched on
static CAircraftLights allLightsOn();
//! Returns object with all lights switched off
static CAircraftLights allLightsOff();
protected:
//! \copydoc CValueObject::convertToQString
virtual QString convertToQString(bool i18n = false) const override;
private:
BLACK_ENABLE_TUPLE_CONVERSION(CAircraftLights)
bool m_strobeOn = false;
bool m_landingOn = false;
bool m_taxiOn = false;
bool m_beaconOn = false;
bool m_navOn = false;
bool m_logoOn = false;
};
} // namespace
} // namespace
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Aviation::CAircraftLights, (
attr(o.m_strobeOn, "strobe_on"),
attr(o.m_landingOn, "landing_on"),
attr(o.m_taxiOn, "taxi_on"),
attr(o.m_beaconOn, "beacon_on"),
attr(o.m_navOn, "nav_on"),
attr(o.m_logoOn, "logo_on")
))
Q_DECLARE_METATYPE(BlackMisc::Aviation::CAircraftLights)
#endif // BLACKMISC_AIRCRAFTLIGHTS_H