refs #837 Using new abbreviated syntax for null units.

This commit is contained in:
Mathew Sutcliffe
2016-12-14 21:36:52 +00:00
parent 0ca9fe0a8a
commit b252673928
12 changed files with 18 additions and 18 deletions

View File

@@ -277,7 +277,7 @@ namespace BlackSample
TestServiceInterface testserviceInterface(Testservice::InterfaceName, Testservice::ObjectPath, connection); TestServiceInterface testserviceInterface(Testservice::InterfaceName, Testservice::ObjectPath, connection);
CSpeed speed(200, CSpeedUnit::km_h()); CSpeed speed(200, CSpeedUnit::km_h());
CSpeed speedNull(0, CSpeedUnit::nullUnit()); CSpeed speedNull(0, nullptr);
CAltitude al(1000, CAltitude::MeanSeaLevel, CLengthUnit::ft()); CAltitude al(1000, CAltitude::MeanSeaLevel, CLengthUnit::ft());
QTextStream qtin(stdin); QTextStream qtin(stdin);
QString line; QString line;

View File

@@ -133,7 +133,7 @@ namespace BlackCore
bool m_simulatorRenderedAircraftRestricted = false; bool m_simulatorRenderedAircraftRestricted = false;
bool m_simulatorRenderingEnabled = true; bool m_simulatorRenderingEnabled = true;
int m_simulatorMaxRenderedAircraft = -1; int m_simulatorMaxRenderedAircraft = -1;
BlackMisc::PhysicalQuantities::CLength m_simulatorMaxRenderedDistance { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit() }; BlackMisc::PhysicalQuantities::CLength m_simulatorMaxRenderedDistance { 0.0, nullptr };
mutable QReadWriteLock m_lockSnapshot; //!< lock snapshot mutable QReadWriteLock m_lockSnapshot; //!< lock snapshot
mutable QReadWriteLock m_lockRestrictions; //!< lock simulator restrictions mutable QReadWriteLock m_lockRestrictions; //!< lock simulator restrictions
}; };

View File

@@ -201,7 +201,7 @@ namespace BlackGui
{ {
// get initial aircraft to render // get initial aircraft to render
CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup(); CInterpolationAndRenderingSetup setup = sGui->getIContextSimulator()->getInterpolationAndRenderingSetup();
CLength newDistance(0, CLengthUnit::nullUnit()); CLength newDistance(0, nullptr);
if (!ui->le_MaxDistance->text().isEmpty()) if (!ui->le_MaxDistance->text().isEmpty())
{ {
newDistance = CLength(ui->le_MaxDistance->text().toInt(), CLengthUnit::NM()); newDistance = CLength(ui->le_MaxDistance->text().toInt(), CLengthUnit::NM());

View File

@@ -79,7 +79,7 @@ namespace BlackMisc
bool ok = false; bool ok = false;
double dv = v.toDouble(&ok) * 100.0; double dv = v.toDouble(&ok) * 100.0;
CAltitude a(ok ? dv : 0.0, FlightLevel, CAltitude a(ok ? dv : 0.0, FlightLevel,
ok ? CLengthUnit::ft() : CLengthUnit::nullUnit()); ok ? CLengthUnit::ft() : nullptr);
*this = a; *this = a;
return; return;
} }

View File

@@ -308,7 +308,7 @@ namespace BlackMisc
CTime CAtcStation::bookedWhen() const CTime CAtcStation::bookedWhen() const
{ {
if (!this->hasValidBookingTimes()) { return CTime(0, CTimeUnit::nullUnit()); } if (!this->hasValidBookingTimes()) { return CTime(0, nullptr); }
QDateTime now = QDateTime::currentDateTimeUtc(); QDateTime now = QDateTime::currentDateTimeUtc();
qint64 diffMs; qint64 diffMs;
if (this->m_bookedFromUtc > now) if (this->m_bookedFromUtc > now)

View File

@@ -197,7 +197,7 @@ namespace BlackMisc
{} {}
CCoordinateGeodetic::CCoordinateGeodetic(double latitudeDegrees, double longitudeDegrees) : CCoordinateGeodetic::CCoordinateGeodetic(double latitudeDegrees, double longitudeDegrees) :
CCoordinateGeodetic( { latitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { longitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit() }) {} CCoordinateGeodetic( { latitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { longitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { 0, nullptr }) {}
CCoordinateGeodetic::CCoordinateGeodetic(double latitudeDegrees, double longitudeDegrees, double heightMeters) : CCoordinateGeodetic::CCoordinateGeodetic(double latitudeDegrees, double longitudeDegrees, double heightMeters) :
CCoordinateGeodetic( { latitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { longitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { heightMeters, BlackMisc::PhysicalQuantities::CLengthUnit::m() }) {} CCoordinateGeodetic( { latitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { longitudeDegrees, BlackMisc::PhysicalQuantities::CAngleUnit::deg() }, { heightMeters, BlackMisc::PhysicalQuantities::CLengthUnit::m() }) {}

View File

@@ -164,8 +164,8 @@ namespace BlackMisc
//! Can given index be handled? //! Can given index be handled?
static bool canHandleIndex(const BlackMisc::CPropertyIndex &index); static bool canHandleIndex(const BlackMisc::CPropertyIndex &index);
BlackMisc::PhysicalQuantities::CAngle m_relativeBearing {0.0, BlackMisc::PhysicalQuantities::CAngleUnit::nullUnit()}; //!< temporary stored value BlackMisc::PhysicalQuantities::CAngle m_relativeBearing { 0, nullptr }; //!< temporary stored value
BlackMisc::PhysicalQuantities::CLength m_relativeDistance {0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()}; //!< temporary stored value BlackMisc::PhysicalQuantities::CLength m_relativeDistance { 0, nullptr }; //!< temporary stored value
}; };
//! Geodetic coordinate //! Geodetic coordinate
@@ -240,7 +240,7 @@ namespace BlackMisc
double m_x = 0; //!< normal vector double m_x = 0; //!< normal vector
double m_y = 0; //!< normal vector double m_y = 0; //!< normal vector
double m_z = 0; //!< normal vector double m_z = 0; //!< normal vector
BlackMisc::PhysicalQuantities::CLength m_geodeticHeight { 0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit() }; //!< height, ellipsoidal or geodetic height BlackMisc::PhysicalQuantities::CLength m_geodeticHeight { 0, nullptr }; //!< height, ellipsoidal or geodetic height
BLACK_METACLASS( BLACK_METACLASS(
CCoordinateGeodetic, CCoordinateGeodetic,

View File

@@ -69,7 +69,7 @@ namespace BlackMisc
if (distance == m_maxRenderedDistance) { return false; } if (distance == m_maxRenderedDistance) { return false; }
if (distance.isNull() || distance.isNegativeWithEpsilonConsidered()) if (distance.isNull() || distance.isNegativeWithEpsilonConsidered())
{ {
m_maxRenderedDistance = CLength(0.0, CLengthUnit::nullUnit()); m_maxRenderedDistance = CLength(0.0, nullptr);
} }
else if (distance.isZeroEpsilonConsidered()) else if (distance.isZeroEpsilonConsidered())
{ {
@@ -93,7 +93,7 @@ namespace BlackMisc
void CInterpolationAndRenderingSetup::clearMaxRenderedDistance() void CInterpolationAndRenderingSetup::clearMaxRenderedDistance()
{ {
this->setMaxRenderedDistance(CLength(0.0, CLengthUnit::nullUnit())); this->setMaxRenderedDistance(CLength(0.0, nullptr));
} }
bool CInterpolationAndRenderingSetup::isMaxAircraftRestricted() const bool CInterpolationAndRenderingSetup::isMaxAircraftRestricted() const
@@ -103,7 +103,7 @@ namespace BlackMisc
void CInterpolationAndRenderingSetup::clearAllRenderingRestrictions() void CInterpolationAndRenderingSetup::clearAllRenderingRestrictions()
{ {
this->m_maxRenderedDistance = CLength(0, CLengthUnit::nullUnit()); this->m_maxRenderedDistance = CLength(0, nullptr);
this->m_maxRenderedAircraft = InfiniteAircraft(); this->m_maxRenderedAircraft = InfiniteAircraft();
} }

View File

@@ -119,7 +119,7 @@ namespace BlackMisc
bool m_forceFullInterpolation = false; //! always do a full interpolation, even if aircraft is not moving bool m_forceFullInterpolation = false; //! always do a full interpolation, even if aircraft is not moving
bool m_enabledAircraftParts = true; //! Update aircraft parts bool m_enabledAircraftParts = true; //! Update aircraft parts
int m_maxRenderedAircraft = InfiniteAircraft(); //!< max.rendered aircraft int m_maxRenderedAircraft = InfiniteAircraft(); //!< max.rendered aircraft
BlackMisc::PhysicalQuantities::CLength m_maxRenderedDistance { 0.0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit()}; //!< max.distance for rendering BlackMisc::PhysicalQuantities::CLength m_maxRenderedDistance { 0, nullptr }; //!< max.distance for rendering
BLACK_METACLASS( BLACK_METACLASS(
CInterpolationAndRenderingSetup, CInterpolationAndRenderingSetup,

View File

@@ -61,7 +61,7 @@ namespace BlackMisc
//! Constructor, private message //! Constructor, private message
CTextMessage(const QString &message, const BlackMisc::Aviation::CCallsign &senderCallsign, const BlackMisc::Aviation::CCallsign &recipientCallsign = BlackMisc::Aviation::CCallsign()) CTextMessage(const QString &message, const BlackMisc::Aviation::CCallsign &senderCallsign, const BlackMisc::Aviation::CCallsign &recipientCallsign = BlackMisc::Aviation::CCallsign())
: m_message(message), m_senderCallsign(senderCallsign), m_recipientCallsign(recipientCallsign), m_frequency(0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit()) {} : m_message(message), m_senderCallsign(senderCallsign), m_recipientCallsign(recipientCallsign), m_frequency(0, nullptr) {}
//! Get callsign (from) //! Get callsign (from)
const BlackMisc::Aviation::CCallsign &getSenderCallsign() const { return m_senderCallsign; } const BlackMisc::Aviation::CCallsign &getSenderCallsign() const { return m_senderCallsign; }
@@ -174,7 +174,7 @@ namespace BlackMisc
QString m_message; QString m_message;
BlackMisc::Aviation::CCallsign m_senderCallsign; BlackMisc::Aviation::CCallsign m_senderCallsign;
BlackMisc::Aviation::CCallsign m_recipientCallsign; BlackMisc::Aviation::CCallsign m_recipientCallsign;
BlackMisc::PhysicalQuantities::CFrequency m_frequency {0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit()}; BlackMisc::PhysicalQuantities::CFrequency m_frequency { 0, nullptr };
bool m_wasSent = false; bool m_wasSent = false;
BLACK_METACLASS( BLACK_METACLASS(

View File

@@ -43,7 +43,7 @@ namespace BlackMisc
bool restricted = false, bool restricted = false,
bool renderingEnabled = true, bool renderingEnabled = true,
int maxAircraft = 100, int maxAircraft = 100,
const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance = BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::nullUnit())); const BlackMisc::PhysicalQuantities::CLength &maxRenderedDistance = { 0, nullptr });
//! Time when snapshot was taken //! Time when snapshot was taken
const QDateTime getTimestamp() const { return QDateTime::fromMSecsSinceEpoch(m_timestampMsSinceEpoch); } const QDateTime getTimestamp() const { return QDateTime::fromMSecsSinceEpoch(m_timestampMsSinceEpoch); }

View File

@@ -59,8 +59,8 @@ namespace BlackMiscTest
geoPos, CLength(100, CLengthUnit::km()), false, dtFrom2, dtUntil2); geoPos, CLength(100, CLengthUnit::km()), false, dtFrom2, dtUntil2);
// compare // compare
CLength l1(0, CLengthUnit::nullUnit()); CLength l1(0, nullptr);
CLength l2(0, CLengthUnit::nullUnit()); CLength l2(0, nullptr);
QVERIFY2(l1 == l2, "Null lengths should be equal"); QVERIFY2(l1 == l2, "Null lengths should be equal");
CLength l3(0, CLengthUnit::m()); CLength l3(0, CLengthUnit::m());