refs #192, Doxygen and other cosmetic changes

This commit is contained in:
Klaus Basan
2014-03-26 18:26:10 +01:00
parent 9aebf05e68
commit a724f7ee91
13 changed files with 212 additions and 697 deletions

View File

@@ -27,14 +27,14 @@ namespace BlackMisc
/*!
* Constructor.
* \param icao
* \param type
* \param airline
* \param livery
* \param color
* \param icao "B737"
* \param combinedType "L2J"
* \param airline "DLH"
* \param livery "FREIGHT"
* \param color "CCFFDD" (RGB)
*/
CAircraftIcao(const QString &icao, const QString &type, const QString &airline, const QString &livery, const QString &color)
: m_aircraftDesignator(icao.trimmed().toUpper()), m_aircraftCombinedType(type.trimmed().toUpper()), m_airlineDesignator(airline.trimmed().toUpper()),
CAircraftIcao(const QString &icao, const QString &combinedType, const QString &airline, const QString &livery, const QString &color)
: m_aircraftDesignator(icao.trimmed().toUpper()), m_aircraftCombinedType(combinedType.trimmed().toUpper()), m_airlineDesignator(airline.trimmed().toUpper()),
m_livery(livery.trimmed().toUpper()), m_aircraftColor(color.trimmed().toUpper()) {}
//! \copydoc CValueObject::toQVariant

View File

@@ -32,40 +32,26 @@ namespace BlackMisc
ReferenceDatum m_datum; //!< MSL or AGL?
protected:
/*!
* \copydoc CValueObject::convertToQString
*/
//! \copydoc CValueObject::convertToQString
virtual QString convertToQString(bool i18n) const override;
/*!
* \copydoc CValueObject::getMetaTypeId
*/
//! \copydoc CValueObject::getMetaTypeId
virtual int getMetaTypeId() const override;
/*!
* \copydoc CValueObject::isA
*/
//! \copydoc CValueObject::isA
virtual bool isA(int metaTypeId) const override;
/*!
* \copydoc CValueObject::compareImpl
*/
//! \copydoc CValueObject::compareImpl
virtual int compareImpl(const CValueObject &other) const override;
/*!
* \copydoc CValueObject::marshallToDbus
*/
//! \copydoc CValueObject::marshallToDbus
virtual void marshallToDbus(QDBusArgument &argument) const override;
/*!
* \copydoc CValueObject::unmarshallFromDbus
*/
//! \copydoc CValueObject::unmarshallFromDbus
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
public:
/*!
* \brief Default constructor: 0 Altitude true
*/
//! \brief Default constructor: 0 Altitude true
CAltitude() : BlackMisc::PhysicalQuantities::CLength(0, BlackMisc::PhysicalQuantities::CLengthUnit::m()), m_datum(MeanSeaLevel) {}
/*!
@@ -76,57 +62,34 @@ namespace BlackMisc
*/
CAltitude(double value, ReferenceDatum datum, const BlackMisc::PhysicalQuantities::CLengthUnit &unit) : BlackMisc::PhysicalQuantities::CLength(value, unit), m_datum(datum) {}
/*!
* \brief Constructor by CLength
* \param altitude
* \param datum
*/
//! \brief Constructor by CLength
CAltitude(BlackMisc::PhysicalQuantities::CLength altitude, ReferenceDatum datum) : BlackMisc::PhysicalQuantities::CLength(altitude), m_datum(datum) {}
/*!
* \brief Equal operator ==
* \param other
* @return
*/
//! \brief Equal operator ==
bool operator ==(const CAltitude &other) const;
/*!
* \brief Unequal operator ==
* \param other
* @return
*/
//! \brief Unequal operator !=
bool operator !=(const CAltitude &other) const;
/*!
* \brief AGL Above ground level?
* \return
*/
//! \brief AGL Above ground level?
bool isAboveGroundLevel() const
{
return AboveGround == this->m_datum;
}
/*!
* \brief MSL Mean sea level?
* \return
*/
//! \brief MSL Mean sea level?
bool isMeanSeaLevel() const
{
return MeanSeaLevel == this->m_datum;
}
/*!
* \copydoc CValueObject::toQVariant
*/
//! \copydoc CValueObject::toQVariant
virtual QVariant toQVariant() const override
{
return QVariant::fromValue(*this);
}
/*!
* \brief Get reference datum (MSL or AGL)
* \return
*/
//! \brief Get reference datum (MSL or AGL)
ReferenceDatum getReferenceDatum() const
{
return m_datum;

View File

@@ -15,29 +15,20 @@ namespace BlackMisc
{
namespace Aviation
{
/*!
* Value object encapsulating information of a callsign.
*/
//! \brief Value object encapsulating information of a callsign.
class CCallsign : public BlackMisc::CValueObject
{
public:
/*!
* Default constructor.
*/
//! \brief Default constructor.
CCallsign() {}
/*!
* Constructor.
*/
//! \brief Constructor
CCallsign(const QString &callsign, const QString &telephonyDesignator = "")
: m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign.trimmed())), m_telephonyDesignator(telephonyDesignator.trimmed())
{}
/*!
* Constructor.
* Needed to disambiguate implicit conversion from string literal.
*/
//! \brief Constructor, needed to disambiguate implicit conversion from string literal.
CCallsign(const char *callsign)
: m_callsignAsSet(callsign), m_callsign(CCallsign::unifyCallsign(callsign))
{}
@@ -112,7 +103,7 @@ namespace BlackMisc
/*!
* \brief Unify the callsign
* \param callsign
* \return
* \return unified callsign
*/
static QString unifyCallsign(const QString &callsign);

View File

@@ -25,12 +25,6 @@ namespace BlackMisc
//! \brief Constructor
CAvionicsBase(const QString &name) : m_name(name) {}
//! \brief Are set values valid?
virtual bool validValues() const
{
return true;
}
//! \brief Set name
void setName(const QString &name)
{
@@ -74,6 +68,12 @@ namespace BlackMisc
return this->m_name;
}
//! \brief Are set values valid?
virtual bool validValues() const
{
return true;
}
private:
BLACK_ENABLE_TUPLE_CONVERSION(CAvionicsBase)
};

View File

@@ -92,47 +92,34 @@ namespace BlackMisc
return QVariant::fromValue(*this);
}
/*!
* \brief Set active frequency
* \remarks will be rounded to channel spacing
* \see ChannelSpacing
*/
//! \brief Set active frequency
//! \remarks will be rounded to channel spacing
void setFrequencyActiveMHz(double frequencyMHz);
/*!
* \brief Set standby frequency
* \remarks will be rounded to channel spacing
*/
//! \brief Set standby frequency
//! \remarks will be rounded to channel spacing
void setFrequencyStandbyMHz(double frequencyMHz);
/*!
* \brief Is active frequency within 8.3383kHz channel?
*/
//! \brief Is active frequency within 8.3383kHz channel?
bool isActiveFrequencyWithin8_33kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency)
{
return CComSystem::isWithinChannelSpacing(this->getFrequencyActive(), comFrequency, ChannelSpacing8_33KHz);
}
/*!
* \brief Is active frequency within 25kHz channel?
*/
//! \brief Is active frequency within 25kHz channel?
bool isActiveFrequencyWithin25kHzChannel(const BlackMisc::PhysicalQuantities::CFrequency &comFrequency) const
{
return CComSystem::isWithinChannelSpacing(this->getFrequencyActive(), comFrequency, ChannelSpacing25KHz);
}
/*!
* \brief Set UNICOM frequency as active
*/
//! \brief Set UNICOM frequency as active
void setActiveUnicom()
{
this->toggleActiveStandby();
this->setFrequencyActive(BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants::FrequencyUnicom());
}
/*!
* \brief Set International Air Distress 121.5MHz
*/
//! \brief Set International Air Distress 121.5MHz
void setActiveInternationalAirDistress()
{
this->toggleActiveStandby();
@@ -142,10 +129,8 @@ namespace BlackMisc
//! \copydoc CValueObject::getValueHash
virtual uint getValueHash() const override;
/*!
* \brief operator ==
*/
bool operator ==(const CComSystem &other) const;
//! \copydoc CValueObject::toJson
virtual QJsonObject toJson() const override;
/*!
* \brief operator !=

View File

@@ -34,25 +34,15 @@ namespace BlackMisc
int m_digits; //!< digits used
protected:
/*!
* \brief Default constructor
*/
//! \brief Default constructor
CModulator() :
CAvionicsBase("default"), m_volumeInput(0), m_volumeOutput(0), m_enabled(true), m_digits(2) {}
/*!
* \brief Constructor
* \param name
* \param activeFrequency
* \param standbyFrequency
* \param digits
*/
//! \brief Constructor
CModulator(const QString &name, const BlackMisc::PhysicalQuantities::CFrequency &activeFrequency, const BlackMisc::PhysicalQuantities::CFrequency &standbyFrequency, int digits) :
CAvionicsBase(name), m_frequencyActive(activeFrequency), m_frequencyStandby(standbyFrequency), m_volumeInput(0), m_volumeOutput(0), m_enabled(true), m_digits(digits) {}
/*!
* \copydoc CValueObject::convertToQString
*/
//! \copydoc CValueObject::convertToQString
virtual QString convertToQString(bool i18n = false) const override
{
QString s(this->getName());
@@ -61,254 +51,166 @@ namespace BlackMisc
return s;
}
/*!
* \brief Set active frequency
* \param frequencyKHz
*/
//! \brief Set active frequency
void setFrequencyActiveKHz(double frequencyKHz)
{
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
}
/*!
* \brief Set standby frequency
* \param frequencyKHz
*/
//! \brief Set standby frequency
void setFrequencyStandbyKHz(double frequencyKHz)
{
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
}
/*!
* \brief Set active frequency
* \param frequencyMHz
*/
//! \brief Set active frequency
void setFrequencyActiveMHz(double frequencyMHz)
{
frequencyMHz = CMath::round(frequencyMHz, 3);
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
}
/*!
* \brief Set standby frequency
* \param frequencyMHz
*/
//! \brief Set standby frequency
void setFrequencyStandbyMHz(double frequencyMHz)
{
frequencyMHz = CMath::round(frequencyMHz, 3);
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
}
/*!
* \brief operator ==
* \param other
* \return
*/
//! \brief operator ==
bool operator ==(const CModulator &other) const;
/*!
* \brief operator !=
* \param other
* \return
*/
//! \brief operator !=
bool operator !=(const CModulator &other) const;
/*!
* \copydoc CValueObject::compareImpl(otherBase)
*/
//! \copydoc CValueObject::compareImpl(otherBase)
virtual int compareImpl(const CValueObject &otherBase) const override;
/*!
* \brief COM1
* \return
*/
//! \brief COM1
static const QString &NameCom1()
{
static QString n("COM1");
return n;
}
/*!
* \brief COM2
* \return
*/
//! \brief COM2
static const QString &NameCom2()
{
static QString n("COM2");
return n;
}
/*!
* \brief COM3
* \return
*/
//! \brief COM3
static const QString &NameCom3()
{
static QString n("COM3");
return n;
}
/*!
* \brief NAV1
* \return
*/
//! \brief NAV1
static const QString &NameNav1()
{
static QString n("NAV1");
return n;
}
/*!
* \brief NAV2
* \return
*/
//! \brief NAV2
static const QString &NameNav2()
{
static QString n("NAV2");
return n;
}
/*!
* \brief NAV2
* \return
*/
//! \brief NAV3
static const QString &NameNav3()
{
static QString n("NAV3");
return n;
}
/*!
* \brief ADF1
* \return
*/
//! \brief ADF1
static const QString &NameAdf1()
{
static QString n("ADF1");
return n;
}
/*!
* \brief ADF2
* \return
*/
//! \brief ADF2
static const QString &NameAdf2()
{
static QString n("ADF2");
return n;
}
/*!
* \brief Frequency not set
* \return
*/
//! \brief Frequency not set
static const BlackMisc::PhysicalQuantities::CFrequency &FrequencyNotSet()
{
static BlackMisc::PhysicalQuantities::CFrequency f;
return f;
}
/*!
* \copydoc CValueObject::marshallFromDbus()
*/
//! \copydoc CValueObject::marshallFromDbus()
virtual void marshallToDbus(QDBusArgument &argument) const override;
/*!
* \copydoc CValueObject::unmarshallFromDbus()
*/
//! \copydoc CValueObject::unmarshallFromDbus()
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
/*!
* \copydoc CValueObject::getValueHash()
*/
//! \copydoc CValueObject::getValueHash()
virtual uint getValueHash() const override;
public:
/*!
* \brief Virtual destructor
*/
//! \brief Virtual destructor
virtual ~CModulator() {}
/*!
* \brief Default value
* \return
*/
//! \brief Default value?
virtual bool isDefaultValue() const
{
return this->m_frequencyActive == CModulator::FrequencyNotSet();
}
/*!
* \brief Toggle active and standby frequencies
*/
//! \brief Toggle active and standby frequencies
void toggleActiveStandby();
/*!
* \brief Active frequency
* \return
*/
//! \brief Active frequency
BlackMisc::PhysicalQuantities::CFrequency getFrequencyActive() const
{
return this->m_frequencyActive;
}
/*!
* \brief Standby frequency
* \return
*/
//! \brief Standby frequency
BlackMisc::PhysicalQuantities::CFrequency getFrequencyStandby() const
{
return this->m_frequencyStandby;
}
/*!
* \brief Set active frequency
* \param frequency
*/
//! \brief Set active frequency
void setFrequencyActive(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
{
this->m_frequencyActive = frequency;
}
/*!
* \brief Set standby frequency
* \param frequency
*/
//! \brief Set standby frequency
void setFrequencyStandby(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
{
this->m_frequencyStandby = frequency;
}
/*!
* \brief Output volume
* \return
*/
//! \brief Output volume
qint32 getVolumeOutput() const { return this->m_volumeOutput; }
/*!
* \brief Input volume
* \return
*/
//! \brief Input volume
qint32 getVolumeInput() const { return this->m_volumeInput; }
/*!
* \brief Output volume
*/
//! \brief Output volume
void setVolumeOutput(qint32 volume) { this->m_volumeOutput = volume; }
/*!
* \brief Input volume
*/
//! \brief Input volume
void setVolumeInput(qint32 volume) { this->m_volumeInput = volume; }
/*!
* \brief Enabled?
*/
//! \brief Enabled?
bool isEnabled() const { return this->m_enabled;}
/*!
* \brief Enabled?
*/
//! \brief Enabled?
void setEnabled(bool enable) { this->m_enabled = enable;}
/*!

View File

@@ -48,24 +48,13 @@ namespace BlackMisc
virtual int compareImpl(const CValueObject &other) const override;
public:
/*!
* \brief Default constructor: 0 Track magnetic
*/
//! \brief Default constructor: 0 Track magnetic
CTrack() : BlackMisc::PhysicalQuantities::CAngle(0, BlackMisc::PhysicalQuantities::CAngleUnit::rad()), m_north(Magnetic) {}
/*!
* \brief Constructor
* \param value
* \param north
* \param unit
*/
//! \brief Constructor
CTrack(double value, ReferenceNorth north, const BlackMisc::PhysicalQuantities::CAngleUnit &unit) : BlackMisc::PhysicalQuantities::CAngle(value, unit), m_north(north) {}
/*!
* \brief Constructor by CAngle
* \param track
* \param north
*/
//! \brief Constructor by CAngle
CTrack(BlackMisc::PhysicalQuantities::CAngle track, ReferenceNorth north) : BlackMisc::PhysicalQuantities::CAngle(track), m_north(north) {}
//! \copydoc CValueObject::toQVariant

View File

@@ -18,9 +18,7 @@ namespace BlackMisc
{
namespace Hardware
{
/*!
* \brief Value object representing a keyboard key.
*/
//! \brief Value object representing a keyboard key.
class CKeyboardKey : public CValueObject
{
public:
@@ -195,11 +193,7 @@ namespace BlackMisc
return this->m_modifier1 != ModifierNone || this->m_modifier2 != ModifierNone;
}
/*!
* \brief Do we have this modifier?
* \param modifier
* \return
*/
//! \brief Do we have this modifier?
bool hasModifier(Modifier modifier) const
{
return m_modifier1 == modifier || m_modifier2 == modifier;

View File

@@ -63,9 +63,7 @@ namespace BlackMisc
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
public:
/*!
* \brief Default constructor
*/
//! \brief Default constructor
CMatrixBase() : m_matrix() {}
/*!
@@ -77,65 +75,39 @@ namespace BlackMisc
this->fill(fillValue);
}
/*!
* \brief Virtual destructor
*/
//! \brief Virtual destructor
virtual ~CMatrixBase() {}
/*!
* \brief List of values
* \return
*/
//! \brief List of values
QList<double> toList() const;
/*!
* \copydoc CValueObject::getValueHash
*/
virtual uint getValueHash() const override;
/*!
* \brief List of values
* \return
*/
//! \brief List of values
void fromList(const QList<double> &list);
/*!
* \brief Equal operator ==
* \param other
* \return
*/
//! \copydoc CValueObject::getValueHash
virtual uint getValueHash() const override;
//! \brief Equal operator ==
bool operator ==(const ImplMatrix &other) const
{
if (this == &other) return true;
return this->m_matrix == other.m_matrix;
}
/*!
* \brief Unequal operator !=
* \param other
* \return
*/
//! \brief Unequal operator !=
bool operator !=(const ImplMatrix &other) const
{
return !((*this) == other);
}
/*!
* \brief Operator *=
* \param factor
* \return
*/
//! \brief Operator *=
CMatrixBase &operator *=(double factor)
{
this->m_matrix *= factor;
return *this;
}
/*!
* \brief Operator *
* \param factor
* \return
*/
//! \brief Operator *
ImplMatrix operator *(double factor) const
{
ImplMatrix m = *derived();
@@ -143,33 +115,20 @@ namespace BlackMisc
return m;
}
/*!
* \brief Operator to support commutative scalar multiplication
* \param factor
* \param other
* \return
*/
//! \brief Operator to support commutative scalar multiplication
friend ImplMatrix operator *(double factor, const ImplMatrix &other)
{
return other * factor;
}
/*!
* \brief Operator /=
* \param factor
* \return
*/
//! \brief Operator /=
CMatrixBase &operator /=(double factor)
{
this->m_matrix /= factor;
return *this;
}
/*!
* \brief Operator /
* \param factor
* \return
*/
//! \brief Operator /
ImplMatrix operator /(double factor) const
{
ImplMatrix m = *derived();
@@ -177,22 +136,14 @@ namespace BlackMisc
return m;
}
/*!
* \brief Operator +=
* \param other
* \return
*/
//! \brief Operator +=
CMatrixBase &operator +=(const CMatrixBase &other)
{
this->m_matrix += other.m_matrix;
return *this;
}
/*!
* \brief Operator +
* \param other
* \return
*/
//! \brief Operator +
ImplMatrix operator +(const ImplMatrix &other) const
{
ImplMatrix m = *derived();
@@ -200,22 +151,14 @@ namespace BlackMisc
return m;
}
/*!
* \brief Operator -=
* \param other
* \return
*/
//! \brief Operator -=
CMatrixBase &operator -=(const CMatrixBase &other)
{
this->m_matrix -= other.m_matrix;
return *this;
}
/*!
* \brief Operator -
* \param other
* \return
*/
//! \brief Operator -
ImplMatrix operator -(const ImplMatrix &other) const
{
ImplMatrix m = *derived();
@@ -223,19 +166,13 @@ namespace BlackMisc
return m;
}
/*!
* \brief Is identity matrix?
* \return
*/
//! \brief Is identity matrix?
bool isIdentity() const
{
return this->m_matrix.isIdentity();
}
/*!
* \brief Is identity matrix? Epsilon considered.
* \return
*/
//! \brief Is identity matrix? Epsilon considered.
bool isIdentityEpsilon() const
{
ImplMatrix m = *derived();
@@ -243,35 +180,19 @@ namespace BlackMisc
return m.isIdentity();
}
/*!
* \brief Set as identity matrix
* \return
*/
//! \brief Set as identity matrix
void setToIdentity()
{
this->m_matrix.setToIdentity();
}
/*!
* \brief All values to zero
*/
//! \brief All values to zero
void setZero() { this->m_matrix.fill(0.0); }
/*!
* \brief Is zero
* \return
*/
//! \brief Is zero?
bool isZero() const;
/*!
* \brief Each cell gets a unique index (used primarily for testing)
*/
void setCellIndex();
/*!
* \brief Is identity matrix? Epsilon considered.
* \return
*/
//! \brief Is zero matrix? Epsilon considered.
bool isZeroEpsilon() const
{
ImplMatrix m = *derived();
@@ -279,21 +200,16 @@ namespace BlackMisc
return m.isZero();
}
/*!
* \brief Set all elements the same
* \param value
*/
//! \brief Each cell gets a unique index (used primarily for testing)
void setCellIndex();
//! \brief Set all elements the same
void fill(double value) { this->m_matrix.fill(value); }
/*!
* \brief Round all values
*/
//! \brief Round all values
void round();
/*!
* \brief Return a rounded matrix
* \return
*/
//! \brief Return a rounded matrix
ImplMatrix roundedMatrix() const
{
ImplMatrix m = *derived();
@@ -301,57 +217,30 @@ namespace BlackMisc
return m;
}
/*!
* \brief Get element
* \param row
* \param column
* \return
*/
//! \brief Get element
double getElement(int row, int column) const;
/*!
* \brief Get element
* \param row
* \param column
* \param value
*/
//! \brief Set element
void setElement(int row, int column, double value);
/*!
* \brief Get element by operator () modifying
* \param row
* \param column
* \return
*/
//! \brief Get element by operator () modifying
double &operator()(int row, int column)
{
this->checkRange(row, column);
return this->m_matrix(row, column);
}
/*!
* \brief Get element by operator () read only
* \param row
* \param column
* \return
*/
//! \brief Get element by operator () read only
double operator()(int row, int column) const
{
return this->getElement(row, column);
}
/*!
* \brief Register metadata
*/
//! \brief Register metadata
static void registerMetadata();
private:
/*!
* \brief Check range of row / column
* \param row
* \param column
* \throws std::range_error if index out of bounds
*/
//! \brief Check range of row / column
void checkRange(int row, int column) const;
};

View File

@@ -20,136 +20,98 @@ namespace BlackMisc
namespace Network
{
/*!
* Value object encapsulating information of a textserver
* Value object encapsulating information of a text message
*/
class CTextMessage : public BlackMisc::CValueObject
{
public:
/*!
* Default constructor.
*/
//! \brief Default constructor.
CTextMessage() : m_received(QDateTime::currentDateTimeUtc()), m_frequency(0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit()) {}
/*!
* Constructor, radio message
*/
//! \brief Constructor, radio message
CTextMessage(const QString &message, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const BlackMisc::Aviation::CCallsign &senderCallsign = BlackMisc::Aviation::CCallsign())
: m_message(message), m_received(QDateTime::currentDateTimeUtc()), m_senderCallsign(senderCallsign), m_frequency(frequency)
{
this->m_frequency.switchUnit(BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz());
}
/*!
* Constructor, private message
*/
//! \brief Constructor, private message
CTextMessage(const QString &message, const BlackMisc::Aviation::CCallsign &senderCallsign, const BlackMisc::Aviation::CCallsign &recipientCallsign = BlackMisc::Aviation::CCallsign())
: m_message(message), m_received(QDateTime::currentDateTimeUtc()), m_senderCallsign(senderCallsign), m_recipientCallsign(recipientCallsign), m_frequency(0, BlackMisc::PhysicalQuantities::CFrequencyUnit::nullUnit()) {}
/*!
* Get callsign (from)
*/
//! \brief Get callsign (from)
const BlackMisc::Aviation::CCallsign &getSenderCallsign() const
{
return m_senderCallsign;
}
/*!
* Set callsign (from)
*/
//! \brief Set callsign (from)
void setSenderCallsign(const BlackMisc::Aviation::CCallsign &callsign)
{
m_senderCallsign = callsign;
}
/*!
* Get callsign (to)
*/
//! \brief Get callsign (to)
const BlackMisc::Aviation::CCallsign &getRecipientCallsign() const
{
return m_recipientCallsign;
}
/*!
* Set callsign (to)
*/
//! \brief Set callsign (recipient)
void setRecipientCallsign(const BlackMisc::Aviation::CCallsign &callsign)
{
m_recipientCallsign = callsign;
}
/*!
* Send to particular frequency?
*/
//! \brief Send to particular frequency?
bool isSendToFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency) const;
/*!
* Send to UNICOM?
*/
//! \brief Send to UNICOM?
bool isSendToUnicom() const;
/*!
* \brief Valid receviver?
*/
//! \brief Valid receviver?
bool hasValidRecipient() const;
/*!
* Get message
*/
//! \brief Get message
const QString &getMessage() const
{
return m_message;
}
/*!
* Empty message
*/
//! \brief Empty message
bool isEmpty() const
{
return m_message.isEmpty();
}
/*!
* Set message
*/
//! \brief Set message
void setMessage(const QString &message)
{
m_message = message.trimmed();
}
/*!
* Get frequency
*/
//! \brief Get frequency
const BlackMisc::PhysicalQuantities::CFrequency &getFrequency() const
{
return m_frequency;
}
/*!
* Set frequency
*/
//! \brief Set frequency
void setFrequency(const BlackMisc::PhysicalQuantities::CFrequency &frequency)
{
m_frequency = frequency;
}
/*!
* \brief Is private message?
*/
//! \brief Is private message?
bool isPrivateMessage() const;
/*!
* \brief Is radio message?
*/
//! \brief Is radio message?
bool isRadioMessage() const;
/*!
* \brief Initial message of server?
*/
//! \brief Initial message of server?
bool isServerMessage() const;
/*!
* \brief Received (hh mm ss)
*/
//! \brief Received (hh mm ss)
QString receivedTime() const
{
QString rt = this->m_received.toString("hh::mm::ss");
@@ -166,9 +128,7 @@ namespace BlackMisc
*/
QString asString(bool withSender, bool withRecipient, const QString separator = ", ") const;
/*!
* Toggle sender receiver, can be used to ping my own message
*/
//! \brief Toggle sender receiver, can be used to ping my own message
void toggleSenderRecipient();
/*!
@@ -182,37 +142,25 @@ namespace BlackMisc
*/
bool isSelcalMessageFor(const QString &selcal) const;
/*!
* \brief Get SELCAL code (if applicable, e.g. ABCD), otherwise ""
*/
//! \brief Get SELCAL code (if applicable, e.g. ABCD), otherwise ""
QString getSelcalCode() const;
/*!
* \brief Equal operator ==
*/
//! \brief Equal operator ==
bool operator ==(const CTextMessage &other) const;
/*!
* \brief Unequal operator !=
*/
//! \brief Unequal operator !=
bool operator !=(const CTextMessage &other) const;
/*!
* \copydoc CValueObject::getValueHash()
*/
//! \copydoc CValueObject::getValueHash()
virtual uint getValueHash() const override;
/*!
* \copydoc CValueObject::toQVariant()
*/
//! \copydoc CValueObject::toQVariant()
virtual QVariant toQVariant() const override
{
return QVariant::fromValue(*this);
}
/*!
* \brief Register metadata
*/
//! \brief Register metadata
static void registerMetadata();
protected:

View File

@@ -19,7 +19,7 @@ namespace BlackMisc
}
if (this->hasValidCallsign())
{
s.append(this->getCallsign().getStringAsSet());
s.append(' ').append(this->getCallsign().getStringAsSet());
}
return s;
}
@@ -38,7 +38,6 @@ namespace BlackMisc
bool CUser::isA(int metaTypeId) const
{
if (metaTypeId == qMetaTypeId<CUser>()) { return true; }
return this->CValueObject::isA(metaTypeId);
}
@@ -48,7 +47,6 @@ namespace BlackMisc
int CUser::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CUser &>(otherBase);
return compare(TupleConverter<CUser>::toTuple(*this), TupleConverter<CUser>::toTuple(other));
}

View File

@@ -29,67 +29,45 @@ namespace BlackMisc
double m_value; //!< numeric part
MU m_unit; //!< unit part
/*!
* Which subclass of CMeasurementUnit does this quantity use?
*/
//! \brief Which subclass of CMeasurementUnit is used?
typedef MU UnitClass;
/*!
* \brief Easy access to derived class (CRTP template parameter)
*/
//! \brief Easy access to derived class (CRTP template parameter)
PQ const *derived() const
{
return static_cast<PQ const *>(this);
}
/*!
* \brief Easy access to derived class (CRTP template parameter)
*/
//! \brief Easy access to derived class (CRTP template parameter)
PQ *derived()
{
return static_cast<PQ *>(this);
}
protected:
/*!
* \brief Constructor with double
*/
//! \brief Constructor with double
CPhysicalQuantity(double value, const MU &unit);
/*!
* \brief Copy constructor
*/
//! \brief Copy constructor
CPhysicalQuantity(const CPhysicalQuantity &other);
/*!
* \copydoc CValueObject::convertToQString
*/
//! \copydoc CValueObject::convertToQString
virtual QString convertToQString(bool i18n = false) const override;
/*!
* \copydoc CValueObject::getMetaTypeId
*/
//! \copydoc CValueObject::getMetaTypeId
virtual int getMetaTypeId() const override;
/*!
* \copydoc CValueObject::isA
*/
//! \copydoc CValueObject::isA
virtual bool isA(int metaTypeId) const override;
/*!
* \copydoc CValueObject::compareImpl
*/
//! \copydoc CValueObject::compareImpl
virtual int compareImpl(const CValueObject &other) const override;
public:
/*!
* \brief Virtual destructor
*/
//! \brief Virtual destructor
virtual ~CPhysicalQuantity() {}
/*!
* \brief Unit
*/
//! \brief Unit
MU getUnit() const
{
return this->m_unit;
@@ -104,217 +82,145 @@ namespace BlackMisc
this->m_unit = unit;
}
/*!
* \brief Set unit by string
*/
void setUnitByString(const QString &unitName)
//! \brief Set unit by string
void setUnitBySymbol(const QString &unitName)
{
this->m_unit = CMeasurementUnit::unitFromSymbol<MU>(unitName);
}
/*!
* \brief Unit
*/
//! \brief Unit
QString getUnitSymbol() const
{
return this->m_unit.getSymbol(true);
}
/*!
* \brief Change unit, and convert value to maintain the same quantity
*/
//! \brief Change unit, and convert value to maintain the same quantity
PQ &switchUnit(const MU &newUnit);
/*!
* Is quantity null?
*/
//! Is quantity null?
bool isNull() const
{
return this->m_unit.isNull();
}
/*!
* \brief Value in given unit
*/
//! \brief Value in given unit
double value(const MU &unit) const;
/*!
* \brief Value in current unit
*/
//! \brief Value in current unit
double value() const
{
return this->m_value;
}
/*!
* \brief Set value in current unit
*/
//! \brief Set value in current unit
void setCurrentUnitValue(double value)
{
this->m_value = value;
}
/*!
* \brief Rounded value in given unit
*/
//! \brief Rounded value in given unit
double valueRounded(const MU &unit, int digits = -1) const;
/*!
* \brief Rounded value in current unit
*/
//! \brief Rounded value in current unit
double valueRounded(int digits = -1) const
{
return this->valueRounded(this->m_unit, digits);
}
/*!
* \brief Value to QString with the given unit, e.g. "5.00m"
*/
//! \brief Value to QString with the given unit, e.g. "5.00m"
QString valueRoundedWithUnit(const MU &unit, int digits = -1, bool i18n = false) const;
/*!
* \brief Value to QString with the current unit, e.g. "5.00m"
*/
//! \brief Value to QString with the current unit, e.g. "5.00m"
QString valueRoundedWithUnit(int digits = -1, bool i18n = false) const
{
return this->valueRoundedWithUnit(this->m_unit, digits, i18n);
}
/*!
* \brief Change value without changing unit
*/
//! \brief Change value without changing unit
void setValueSameUnit(double value);
/*!
* \brief Add to the value in the current unit.
*/
//! \brief Add to the value in the current unit.
void addValueSameUnit(double value);
/*!
* \brief Substract from the value in the current unit.
*/
//! \brief Substract from the value in the current unit.
void substractValueSameUnit(double value);
/*!
* \brief Multiply operator *=
*/
//! \brief Multiply operator *=
CPhysicalQuantity &operator *=(double multiply);
/*!
* \brief Divide operator /=
*/
//! \brief Divide operator /=
CPhysicalQuantity &operator /=(double divide);
/*!
* \brief Operator *
*/
//! \brief Operator *
PQ operator *(double multiply) const;
/*!
* \brief Operator to support commutative multiplication
*/
//! \brief Operator to support commutative multiplication
friend PQ operator *(double factor, const PQ &other)
{
return other * factor;
}
/*!
* \brief Operator /
*/
//! \brief Operator /
PQ operator /(double divide) const;
/*!
* \brief Equal operator ==
*/
//! \brief Equal operator ==
bool operator==(const CPhysicalQuantity &other) const;
/*!
* \brief Not equal operator !=
*/
//! \brief Not equal operator !=
bool operator!=(const CPhysicalQuantity &other) const;
/*!
* \brief Plus operator +=
*/
//! \brief Plus operator +=
CPhysicalQuantity &operator +=(const CPhysicalQuantity &other);
/*!
* \brief Minus operator-=
*/
//! \brief Minus operator-=
CPhysicalQuantity &operator -=(const CPhysicalQuantity &other);
/*!
* \brief Greater operator >
*/
//! \brief Greater operator >
bool operator >(const CPhysicalQuantity &other) const;
/*!
* \brief Less operator <
*/
//! \brief Less operator <
bool operator <(const CPhysicalQuantity &other) const;
/*!
* \brief Less equal operator <=
*/
//! \brief Less equal operator <=
bool operator <=(const CPhysicalQuantity &other) const;
/*!
* \brief Greater equal operator >=
*/
//! \brief Greater equal operator >=
bool operator >=(const CPhysicalQuantity &other) const;
/*!
* \brief Plus operator +
*/
//! \brief Plus operator +
PQ operator +(const PQ &other) const;
/*!
* \brief Minus operator -
*/
//! \brief Minus operator -
PQ operator -(const PQ &other) const;
/*!
* \brief Quantity value <= epsilon
*/
//! \brief Quantity value <= epsilon
bool isZeroEpsilonConsidered() const
{
return this->m_unit.isEpsilon(this->m_value);
}
/*!
* \brief Value >= 0 epsilon considered
*/
//! \brief Value >= 0 epsilon considered
bool isPositiveWithEpsilonConsidered() const
{
return !this->isZeroEpsilonConsidered() && this->m_value > 0;
}
/*!
* \brief Value <= 0 epsilon considered
*/
//! \brief Value <= 0 epsilon considered
bool isNegativeWithEpsilonConsidered() const
{
return !this->isZeroEpsilonConsidered() && this->m_value < 0;
}
/*!
* \copydoc CValueObject::marshallToDbus
*/
//! \copydoc CValueObject::marshallToDbus
virtual void marshallToDbus(QDBusArgument &argument) const override;
/*!
* \copydoc CValueObject::unmarshallFromDbus
*/
//! \copydoc CValueObject::unmarshallFromDbus
virtual void unmarshallFromDbus(const QDBusArgument &argument) override;
/*!
* \copydoc CValueObject::getValueHash
*/
//! \copydoc CValueObject::getValueHash
virtual uint getValueHash() const override;
/*!
* \brief Register metadata of unit and quantity
*/
//! \brief Register metadata of unit and quantity
static void registerMetadata();
};

View File

@@ -24,54 +24,32 @@ namespace BlackMisc
{
public:
/*!
* Default constructor.
*/
CVoiceRoom() :
m_connected(false), m_audioPlaying(false) {}
//! \brief Default constructor.
CVoiceRoom() : m_connected(false), m_audioPlaying(false) {}
/*!
* Constructor.
* \param hostname
* \param channel
*/
//! \brief Constructor.
CVoiceRoom(const QString &hostname, const QString &channel) :
m_hostname(hostname), m_channel(channel), m_connected(false), m_audioPlaying(false) {}
/*!
* Constructor.
* \param serverUrl
* \param connected
*/
//! \brief Constructor.
CVoiceRoom(const QString &serverUrl, bool connected = false);
/*!
* \copydoc CValueObject::toQVariant
*/
//! \copydoc CValueObject::toQVariant
virtual QVariant toQVariant() const override
{
return QVariant::fromValue(*this);
}
/*!
* Get the host name
* \return
*/
//! \brief Get the host name
const QString &getHostName() const { return m_hostname; }
/*!
* Get the voice room
*/
//! \brief Get the voice room channel
const QString &getChannel() const { return m_channel; }
/*!
* \brief Set the host name
*/
//! \brief Set the host name
void setHostName(const QString &hostName) { m_hostname = hostName; }
/*!
* \brief Set the voice channel
*/
//! \brief Set the voice channel
void setChannel(const QString &channel) { m_channel = channel; }
/*!
@@ -81,59 +59,31 @@ namespace BlackMisc
*/
QString getVoiceRoomUrl(bool noProtocol = true) const;
/*!
* \brief Valid voice room object?
* \return
*/
//! \brief Valid voice room object?
bool isValid() const { return !this->m_hostname.isEmpty() && !this->m_channel.isEmpty(); }
/*!
* \brief Is connected
* \return
*/
//! \brief Is connected?
bool isConnected() const { return this->isValid() && this->m_connected; }
/*!
* \brief Set connected status
* \param isConnected
*/
//! \brief Set connection status
void setConnected(bool isConnected) { this->m_connected = isConnected; }
/*!
* \brief Is audio playing in this room?
* \return
*/
//! \brief Is audio playing in this room?
bool isAudioPlaying() const { return this->m_audioPlaying; }
/*!
* \brief Set audio playing
* \param playing
*/
//! \brief Set audio playing
void setAudioPlaying(bool playing) { this->m_audioPlaying = playing; }
/*!
* \brief Is ATIS voice channel
* \return
*/
//! \brief Is ATIS voice channel
bool isAtis() const;
/*!
* \brief Equal operator ==
* \param other
* @return
*/
//! \brief Equal operator ==
bool operator ==(const CVoiceRoom &other) const;
/*!
* \brief Unequal operator ==
* \param other
* @return
*/
//! \brief Unequal operator !=
bool operator !=(const CVoiceRoom &other) const;
/*!
* \copydoc CValueObject::getValueHash
*/
//! \copydoc CValueObject::getValueHash
virtual uint getValueHash() const override;
/*!