diff --git a/src/blackgui/transpondermodeselector.h b/src/blackgui/transpondermodeselector.h index 24463da9c..b61ecb296 100644 --- a/src/blackgui/transpondermodeselector.h +++ b/src/blackgui/transpondermodeselector.h @@ -1,7 +1,7 @@ -#ifndef BLACKGUI_QWITRANSPONDERMODESELECTOR_H -#define BLACKGUI_QWITRANSPONDERMODESELECTOR_H +#ifndef BLACKGUI_TRANSPONDERMODESELECTOR_H +#define BLACKGUI_TRANSPONDERMODESELECTOR_H -#include "../blackmisc/aviotransponder.h" +#include "blackmisc/aviotransponder.h" #include "blackmisc/aviotransponder.h" #include #include diff --git a/src/blackmisc/avcallsign.h b/src/blackmisc/avcallsign.h index 70c451e47..0b6f9e214 100644 --- a/src/blackmisc/avcallsign.h +++ b/src/blackmisc/avcallsign.h @@ -3,10 +3,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/*! - \file -*/ - #ifndef BLACKMISC_CALLSIGN_H #define BLACKMISC_CALLSIGN_H #include "valueobject.h" @@ -20,15 +16,15 @@ namespace BlackMisc { public: - //! \brief Default constructor. + //! Default constructor. CCallsign() {} - //! \brief Constructor + //! Constructor CCallsign(const QString &callsign, const QString &telephonyDesignator = "") : m_callsignAsSet(callsign.trimmed()), m_callsign(CCallsign::unifyCallsign(callsign.trimmed())), m_telephonyDesignator(telephonyDesignator.trimmed()) {} - //! \brief Constructor, needed to disambiguate implicit conversion from string literal. + //! Constructor, needed to disambiguate implicit conversion from string literal. CCallsign(const char *callsign) : m_callsignAsSet(callsign), m_callsign(CCallsign::unifyCallsign(callsign)) {} @@ -45,34 +41,34 @@ namespace BlackMisc return CCallsign::convertToIcon(*this); } - //! \brief Is empty? + //! Is empty? bool isEmpty() const { return this->m_callsignAsSet.isEmpty(); } - //! \brief Get callsign. + //! Get callsign. const QString &asString() const { return this->m_callsign; } - //! \brief Get callsign. + //! Get callsign. const QString &getStringAsSet() const { return this->m_callsignAsSet; } - //! \brief Get callsign telephony designator (how callsign is pronounced) + //! Get callsign telephony designator (how callsign is pronounced) const QString &getTelephonyDesignator() const { return this->m_telephonyDesignator; } - //! \brief Get ICAO code, if this makes sense (EDDF_TWR -> EDDF) + //! Get ICAO code, if this makes sense (EDDF_TWR -> EDDF) QString getIcaoCode() const { return m_callsign.left(4).toUpper(); } - //! \brief Makes this callsign looking like an observer callsign (DAMBZ -> DAMBZ_OBS) + //! Makes this callsign looking like an observer callsign (DAMBZ -> DAMBZ_OBS) QString getAsObserverCallsignString() const; - //! \brief Equals callsign string? + //! Equals callsign string? bool equalsString(const QString &callsignString) const; - //! \brief Equal operator == + //! Equal operator == bool operator ==(const CCallsign &other) const; - //! \brief Unequal operator != + //! Unequal operator != bool operator !=(const CCallsign &other) const; - //! \brief Less than operator < for sorting + //! Less than operator < for sorting bool operator <(const CCallsign &other) const; //! \copydoc CValueObject::getValueHash() @@ -84,10 +80,10 @@ namespace BlackMisc //! \copydoc CValueObject::fromJson virtual void fromJson(const QJsonObject &json) override; - //! \brief Register metadata + //! Register metadata static void registerMetadata(); - //! \brief Members + //! Members static const QStringList &jsonMembers(); protected: @@ -110,13 +106,13 @@ namespace BlackMisc virtual void unmarshallFromDbus(const QDBusArgument &argument) override; /*! - * \brief Unify the callsign + * Unify the callsign * \param callsign * \return unified callsign */ static QString unifyCallsign(const QString &callsign); - //! \brief representing icon + //! representing icon static const QPixmap &convertToIcon(const CCallsign &callsign); private: diff --git a/src/blackmisc/pqphysicalquantity.h b/src/blackmisc/pqphysicalquantity.h index 98ea75b10..40f2ccf29 100644 --- a/src/blackmisc/pqphysicalquantity.h +++ b/src/blackmisc/pqphysicalquantity.h @@ -29,26 +29,26 @@ namespace BlackMisc double m_value; //!< numeric part MU m_unit; //!< unit part - //! \brief Which subclass of CMeasurementUnit is used? + //! Which subclass of CMeasurementUnit is used? typedef MU UnitClass; - //! \brief Easy access to derived class (CRTP template parameter) + //! Easy access to derived class (CRTP template parameter) PQ const *derived() const { return static_cast(this); } - //! \brief Easy access to derived class (CRTP template parameter) + //! Easy access to derived class (CRTP template parameter) PQ *derived() { return static_cast(this); } protected: - //! \brief Constructor with double + //! Constructor with double CPhysicalQuantity(double value, const MU &unit); - //! \brief Copy constructor + //! Copy constructor CPhysicalQuantity(const CPhysicalQuantity &other); //! \copydoc CValueObject::convertToQString @@ -64,10 +64,10 @@ namespace BlackMisc virtual int compareImpl(const CValueObject &other) const override; public: - //! \brief Virtual destructor + //! Virtual destructor virtual ~CPhysicalQuantity() {} - //! \brief Unit + //! Unit MU getUnit() const { return this->m_unit; @@ -77,36 +77,27 @@ namespace BlackMisc * \brief Simply set unit, do no calclulate conversion * \sa switchUnit */ - void setUnit(const MU &unit) - { - this->m_unit = unit; - } + void setUnit(const MU &unit) { this->m_unit = unit; } - //! \brief Set unit by string + //! Set unit by string void setUnitBySymbol(const QString &unitName) { this->m_unit = CMeasurementUnit::unitFromSymbol(unitName); } - //! \brief Unit - QString getUnitSymbol() const - { - return this->m_unit.getSymbol(true); - } + //! Unit + QString getUnitSymbol() const { return this->m_unit.getSymbol(true); } - //! \brief Change unit, and convert value to maintain the same quantity + //! Change unit, and convert value to maintain the same quantity PQ &switchUnit(const MU &newUnit); //! Is quantity null? - bool isNull() const - { - return this->m_unit.isNull(); - } + bool isNull() const { return this->m_unit.isNull(); } - //! \brief Value in given unit + //! Value in given unit double value(const MU &unit) const; - //! \brief Value in current unit + //! Value in current unit double value() const { if (this->isNull()) @@ -116,103 +107,104 @@ namespace BlackMisc return this->m_value; } - //! \brief Set value in current unit + //! Set value in current unit void setCurrentUnitValue(double value) { - if (! this->isNull()) + if (!this->isNull()) { this->m_value = value; } } //! \brief Rounded value in given unit + //! Rounded value in given unit double valueRounded(const MU &unit, int digits = -1) const; - //! \brief Rounded value in current unit + //! 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" + //! 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" + //! 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 + //! Change value without changing unit void setValueSameUnit(double value); - //! \brief Add to the value in the current unit. + //! Add to the value in the current unit. void addValueSameUnit(double value); - //! \brief Substract from the value in the current unit. + //! Substract from the value in the current unit. void substractValueSameUnit(double value); - //! \brief Multiply operator *= + //! Multiply operator *= CPhysicalQuantity &operator *=(double multiply); - //! \brief Divide operator /= + //! Divide operator /= CPhysicalQuantity &operator /=(double divide); - //! \brief Operator * + //! Operator * PQ operator *(double multiply) const; - //! \brief Operator to support commutative multiplication + //! Operator to support commutative multiplication friend PQ operator *(double factor, const PQ &other) { return other * factor; } - //! \brief Operator / + //! Operator / PQ operator /(double divide) const; - //! \brief Equal operator == + //! Equal operator == bool operator==(const CPhysicalQuantity &other) const; - //! \brief Not equal operator != + //! Not equal operator != bool operator!=(const CPhysicalQuantity &other) const; - //! \brief Plus operator += + //! Plus operator += CPhysicalQuantity &operator +=(const CPhysicalQuantity &other); - //! \brief Minus operator-= + //! Minus operator-= CPhysicalQuantity &operator -=(const CPhysicalQuantity &other); - //! \brief Greater operator > + //! Greater operator > bool operator >(const CPhysicalQuantity &other) const; - //! \brief Less operator < + //! Less operator < bool operator <(const CPhysicalQuantity &other) const; - //! \brief Less equal operator <= + //! Less equal operator <= bool operator <=(const CPhysicalQuantity &other) const; - //! \brief Greater equal operator >= + //! Greater equal operator >= bool operator >=(const CPhysicalQuantity &other) const; - //! \brief Plus operator + + //! Plus operator + PQ operator +(const PQ &other) const; - //! \brief Minus operator - + //! Minus operator - PQ operator -(const PQ &other) const; - //! \brief Quantity value <= epsilon + //! Quantity value <= epsilon bool isZeroEpsilonConsidered() const { return this->m_unit.isEpsilon(this->m_value); } - //! \brief Value >= 0 epsilon considered + //! Value >= 0 epsilon considered bool isPositiveWithEpsilonConsidered() const { return !this->isZeroEpsilonConsidered() && this->m_value > 0; } - //! \brief Value <= 0 epsilon considered + //! Value <= 0 epsilon considered bool isNegativeWithEpsilonConsidered() const { return !this->isZeroEpsilonConsidered() && this->m_value < 0; @@ -233,7 +225,7 @@ namespace BlackMisc //! \copydoc CValueObject::fromJson virtual void fromJson(const QJsonObject &json) override; - //! \brief Register metadata of unit and quantity + //! Register metadata of unit and quantity static void registerMetadata(); }; diff --git a/src/blackmisc/pqstring.h b/src/blackmisc/pqstring.h index fa08de636..6b719f77a 100644 --- a/src/blackmisc/pqstring.h +++ b/src/blackmisc/pqstring.h @@ -44,11 +44,11 @@ namespace BlackMisc virtual bool isA(int metaTypeId) const override; public: - //! \brief Default constructor + //! Default constructor CPqString() {} /*! - * \brief Constructor + * Constructor * \param value such as 10km/h */ CPqString(const QString &value) : m_string(value) {} @@ -65,13 +65,13 @@ namespace BlackMisc //! \copydoc CValueObject::getValueHash virtual uint getValueHash() const override; - //! \brief Equal operator == + //! Equal operator == bool operator ==(const CPqString &other) const; - //! \brief Unequal operator != + //! Unequal operator != bool operator !=(const CPqString &other) const; - //! \brief Register metadata + //! Register metadata static void registerMetadata(); //! Parse a string value like "100m", "10.3Mhz" diff --git a/src/blackmisc/pqtime.h b/src/blackmisc/pqtime.h index 2f44d574d..8585d66bb 100644 --- a/src/blackmisc/pqtime.h +++ b/src/blackmisc/pqtime.h @@ -15,34 +15,26 @@ namespace BlackMisc /*! * \brief Time class, e.g. "ms", "hour", "s", "day" - * \author KWB */ class CTime : public CPhysicalQuantity { public: - /*! - * \brief Default constructor - */ + //! Default constructor CTime() : CPhysicalQuantity(0, CTimeUnit::defaultUnit()) {} - /*! - *\brief Init by double value - * \param value - * \param unit - */ + //! Init by double value CTime(double value, const CTimeUnit &unit) : CPhysicalQuantity(value, unit) {} - /*! - * \copydoc CValueObject::toQVariant - */ - virtual QVariant toQVariant() const override - { - return QVariant::fromValue(*this); - } + //! By Qt time + CTime(const QTime &time); - /*! - * \brief Destructor - */ + //! By string hh:mm or hh:mm:ss + CTime(const QString &time); + + //! \copydoc CValueObject::toQVariant + virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); } + + //! Destructor virtual ~CTime() {} }; diff --git a/src/blackmisc/valueobject.h b/src/blackmisc/valueobject.h index 883f59f48..f5fe4c4b8 100644 --- a/src/blackmisc/valueobject.h +++ b/src/blackmisc/valueobject.h @@ -28,112 +28,57 @@ namespace BlackMisc class CValueObject { - /*! - * \brief Stream << overload to be used in debugging messages - * \param debug - * \param uc - * \return - */ + //! Stream << overload to be used in debugging messages friend QDebug operator<<(QDebug debug, const CValueObject &uc) { debug << uc.stringForStreaming(); return debug; } - /*! - * \brief Operator << based on text stream - * \param textStream - * \param uc - * \return - */ + //! Operator << based on text stream friend QTextStream &operator<<(QTextStream &textStream, const CValueObject &uc) { textStream << uc.stringForStreaming(); return textStream; } - /*! - * \brief Operator << when there is no debug stream - * \param nodebug - * \param valueObject - * \return - */ + //! Operator << when there is no debug stream friend QNoDebug operator<<(QNoDebug nodebug, const CValueObject &valueObject) { Q_UNUSED(valueObject); return nodebug; } - /*! - * \brief Stream operator << for QDataStream - * \param stream - * \param valueObject - * \return - */ + //! Operator << for QDataStream friend QDataStream &operator<<(QDataStream &stream, const CValueObject &valueObject) { stream << valueObject.stringForStreaming(); return stream; } - /*! - * \brief Stream operator << for std::cout - * \param ostr - * \param uc - * \return - */ + //! Stream operator << for std::cout friend std::ostream &operator<<(std::ostream &ostr, const CValueObject &uc) { ostr << uc.stringForStreaming().toStdString(); return ostr; } - /*! - * \brief Unmarshalling operator >>, DBus to object - * \param argument - * \param valueObject - * \return - */ + //! Unmarshalling operator >>, DBus to object friend const QDBusArgument &operator>>(const QDBusArgument &argument, CValueObject &valueObject); - /*! - * \brief Marshalling operator <<, object to DBus - * \param argument - * \param valueObject - * \return - */ + //! Marshalling operator <<, object to DBus friend QDBusArgument &operator<<(QDBusArgument &argument, const CValueObject &valueObject); - /*! - * \brief Operator == with value map - * \param valueMap - * \param valueObject - * \return - */ + //! Operator == with value map friend bool operator==(const CIndexVariantMap &valueMap, const CValueObject &valueObject); - /*! - * \brief Operator != with value map - * \param valueMap - * \param valueObject - * \return - */ + //! Operator != with value map friend bool operator!=(const CIndexVariantMap &valueMap, const CValueObject &valueObject); - /*! - * \brief operator == with value map - * \param valueObject - * \param valueMap - * \return - */ + //! Operator == with value map friend bool operator==(const CValueObject &valueObject, const CIndexVariantMap &valueMap); - /*! - * \brief Operator != with value map - * \param valueObject - * \param valueMap - * \return - */ + //! Operator != with value map friend bool operator!=(const CValueObject &valueObject, const CIndexVariantMap &valueMap); /*! @@ -146,57 +91,34 @@ namespace BlackMisc friend int compare(const CValueObject &v1, const CValueObject &v2); public: - /*! - * \brief Virtual destructor - */ + //! Virtual destructor virtual ~CValueObject() {} - /*! - * \brief Cast as QString - */ + //! Cast as QString QString toQString(bool i18n = false) const; - /*! - * \brief Cast to pretty-printed QString - */ + //! Cast to pretty-printed QString virtual QString toFormattedQString(bool i18n = false) const; - /*! - * \brief To std string - */ + //! To std string std::string toStdString(bool i18n = false) const; - /*! - * \brief Update by variant map - */ + //! Update by variant map int apply(const BlackMisc::CIndexVariantMap &indexMap); - /*! - * \brief Value hash, allows comparisons between QVariants - */ + //! Value hash, allows comparisons between QVariants virtual uint getValueHash() const = 0; - /*! - * \brief Virtual method to return QVariant, used with DBus QVariant lists - */ + //! Virtual method to return QVariant, used with DBus QVariant lists virtual QVariant toQVariant() const = 0; - /*! - * \brief Contribute to JSON object - * \return updated JSON object - */ + //! Contribute to JSON object virtual QJsonObject toJson() const { QJsonObject json; return json;} - /*! - * \brief Initialize from JSOn object - * \param json - */ + //! Initialize from JSON object virtual void fromJson(const QJsonObject &json) { Q_UNUSED(json); } - /*! - * \brief As icon, not implement by all classes - * \return - */ + //! As icon, not implement by all classes virtual const QPixmap &toIcon() const { static const QPixmap p; return p; } /*! @@ -224,43 +146,26 @@ namespace BlackMisc */ virtual QString propertyByIndexAsString(int index, bool i18n = false) const; - /*! - * \brief The stored object as CValueObject - */ + //! \brief The stored object as CValueObject static const CValueObject *fromQVariant(const QVariant &qv); protected: - /*! - * \brief Default constructor - */ + //! Default constructor CValueObject() {} - /*! - * \brief Copy constructor - */ + //! Copy constructor CValueObject(const CValueObject &) {} - /*! - * \brief Copy assignment operator = - */ + //! Copy assignment operator = CValueObject &operator=(const CValueObject &) { return *this; } - /*! - * \brief String for streaming operators - */ + //! String for streaming operators virtual QString stringForStreaming() const; - /*! - * \brief String for QString conversion - * \param i18n - * \return - */ + //! String for QString conversion virtual QString convertToQString(bool i18n = false) const = 0; - /*! - * \brief Returns the Qt meta type ID of this object. - * \return - */ + //! Returns the Qt meta type ID of this object. virtual int getMetaTypeId() const = 0; /*! @@ -281,16 +186,15 @@ namespace BlackMisc */ virtual int compareImpl(const CValueObject &other) const = 0; - /*! - * \brief Marshall to DBus - */ + //! Marshall to DBus virtual void marshallToDbus(QDBusArgument &) const = 0; - /*! - * \brief Unmarshall from DBus - */ + //! Unmarshall from DBus virtual void unmarshallFromDbus(const QDBusArgument &) = 0; + //! Parse from string, e.g. 100km/h + virtual void parseFromString(const QString &) { qFatal("Not implemented"); } + }; /*! @@ -331,36 +235,21 @@ namespace BlackMisc return argument << static_cast(valueObject); } - /*! - * \brief Non member, non friend operator >> for JSON - * \param json - * \param valueObject - * \return - */ + //! Non member, non friend operator >> for JSON inline const QJsonObject &operator>>(const QJsonObject &json, CValueObject &valueObject) { valueObject.fromJson(json); return json; } - /*! - * \brief Non member, non friend operator >> for JSON - * \param json - * \param valueObject - * \return - */ + //! Non member, non friend operator >> for JSON inline const QJsonValue &operator>>(const QJsonValue &json, CValueObject &valueObject) { valueObject.fromJson(json.toObject()); return json; } - /*! - * \brief Non member, non friend operator >> for JSON - * \param json - * \param valueObject - * \return - */ + //! Non member, non friend operator >> for JSON inline const QJsonValueRef &operator>>(const QJsonValueRef &json, CValueObject &valueObject) { valueObject.fromJson(json.toObject()); @@ -382,7 +271,7 @@ namespace BlackMisc /*! * \brief Non member, non friend operator >> for JSON * \param json - * \param value + * \param value as pair name/value * \return */ template typename std::enable_if::value, QJsonObject>::type & @@ -392,11 +281,7 @@ namespace BlackMisc return json; } - /*! - * Allow comparison with QVariant, e.g. QVariant == CFrequency ? - * \param variant - * \param valueObject - */ + //! Allow comparison with QVariant, e.g. QVariant == CFrequency ? template typename std::enable_if::value, bool>::type operator==(const QVariant &variant, const T &valueObject) { @@ -405,45 +290,28 @@ namespace BlackMisc return vuc == valueObject; } - /*! - * \brief Allow comparison with QVariant, e.g. QVariant != CFrequency ? - * \param variant - * \param valueObject - */ + //! Allow comparison with QVariant, e.g. QVariant != CFrequency ? template typename std::enable_if::value, bool>::type operator!=(const QVariant &variant, const T &valueObject) { return !(variant == valueObject); } - /*! - * \brief Allow comparison with QVariant, e.g. QVariant == CFrequency ? - * \param valueObject - * \param variant - */ + //! Allow comparison with QVariant, e.g. QVariant == CFrequency ? template typename std::enable_if::value, bool>::type operator==(const T &valueObject, const QVariant &variant) { return variant == valueObject; } - /*! - * \brief Allow comparison with QVariant, e.g. QVariant != CFrequency ? - * \param valueObject - * \param variant - */ + //! Allow comparison with QVariant, e.g. QVariant != CFrequency ? template typename std::enable_if::value, bool>::type operator!=(const T &valueObject, const QVariant &variant) { return variant != valueObject; } - /*! - * qHash overload, needed for storing CValueObject in a QSet. - * \param value - * \param seed - * \return - */ + //! qHash overload, needed for storing CValueObject in a QSet. inline uint qHash(const BlackMisc::CValueObject &value, uint seed = 0) { return ::qHash(value.getValueHash(), seed);