From 21ca361bc101559e1fd1ffa920fa5801f9b70195 Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Mon, 19 Aug 2013 03:21:12 +0100 Subject: [PATCH] removed operator= and copy ctor from classes where they only duplicated the behaviour of the default implementations that C++ generates automatically --- src/blackmisc/avaltitude.cpp | 11 ------- src/blackmisc/avaltitude.h | 13 --------- src/blackmisc/avheading.cpp | 11 ------- src/blackmisc/avheading.h | 13 --------- src/blackmisc/avioadfsystem.h | 11 ------- src/blackmisc/aviocomsystem.h | 11 ------- src/blackmisc/aviomodulator.cpp | 13 --------- src/blackmisc/aviomodulator.h | 7 ----- src/blackmisc/avionavsystem.h | 11 ------- src/blackmisc/aviotransponder.h | 13 --------- src/blackmisc/avtrack.cpp | 11 ------- src/blackmisc/avtrack.h | 13 --------- src/blackmisc/coordinategeodetic.h | 14 --------- src/blackmisc/coordinatened.h | 14 --------- src/blackmisc/geoearthangle.h | 17 ----------- src/blackmisc/geolatitude.h | 6 ---- src/blackmisc/geolongitude.h | 6 ---- src/blackmisc/mathmatrixbase.h | 12 -------- src/blackmisc/mathvector3dbase.h | 14 --------- src/blackmisc/pqangle.h | 5 ---- src/blackmisc/pqbase.cpp | 43 ---------------------------- src/blackmisc/pqbase.h | 23 ++------------- src/blackmisc/pqfrequency.h | 5 ---- src/blackmisc/pqlength.h | 5 ---- src/blackmisc/pqmass.h | 6 ---- src/blackmisc/pqphysicalquantity.cpp | 20 ------------- src/blackmisc/pqphysicalquantity.h | 13 --------- src/blackmisc/pqpressure.h | 5 ---- src/blackmisc/pqspeed.h | 5 ---- src/blackmisc/pqtemperature.h | 5 ---- src/blackmisc/pqtime.h | 5 ---- src/blackmisc/streamable.h | 8 ------ 32 files changed, 2 insertions(+), 367 deletions(-) diff --git a/src/blackmisc/avaltitude.cpp b/src/blackmisc/avaltitude.cpp index 604a654cd..d2b1619b7 100644 --- a/src/blackmisc/avaltitude.cpp +++ b/src/blackmisc/avaltitude.cpp @@ -22,17 +22,6 @@ QString CAltitude::convertToQString(bool /* i18n */) const return s.append(this->m_msl ? " MSL" : " AGL"); } -/* - * Assigment - */ -CAltitude &CAltitude::operator =(const CAltitude &other) -{ - if (this == &other) return *this; - CLength::operator = (other); - this->m_msl = other.m_msl; - return *this; -} - /* * Equal? */ diff --git a/src/blackmisc/avaltitude.h b/src/blackmisc/avaltitude.h index 43379510e..572b5da1b 100644 --- a/src/blackmisc/avaltitude.h +++ b/src/blackmisc/avaltitude.h @@ -78,19 +78,6 @@ public: */ CAltitude(BlackMisc::PhysicalQuantities::CLength altitude, bool msl) : BlackMisc::PhysicalQuantities::CLength(altitude), m_msl(msl) {} - /*! - * \brief Copy constructor - * \param other - */ - CAltitude(const CAltitude &other) : BlackMisc::PhysicalQuantities::CLength(other), m_msl(other.m_msl) {} - - /*! - * \brief Assignment operator = - * \param other - * @return - */ - CAltitude &operator =(const CAltitude &other); - /*! * \brief Equal operator == * \param other diff --git a/src/blackmisc/avheading.cpp b/src/blackmisc/avheading.cpp index b1b4dd430..b02f7d939 100644 --- a/src/blackmisc/avheading.cpp +++ b/src/blackmisc/avheading.cpp @@ -22,17 +22,6 @@ QString CHeading::convertToQString(bool i18n) const return s.append(this->m_magnetic ? " magnetic" : " true"); } -/* - * Assigment - */ -CHeading& CHeading::operator =(const CHeading &other) -{ - if (this == &other) return *this; - this->CAngle::operator = (other); - this->m_magnetic = other.m_magnetic; - return *this; -} - /* * Equal? */ diff --git a/src/blackmisc/avheading.h b/src/blackmisc/avheading.h index 83d678da6..124c895ec 100644 --- a/src/blackmisc/avheading.h +++ b/src/blackmisc/avheading.h @@ -78,19 +78,6 @@ public: */ CHeading(CAngle heading, bool magnetic) : CAngle(heading), m_magnetic(magnetic) {} - /*! - * \brief Copy constructor - * \param other - */ - CHeading(const CHeading &other) : CAngle(other), m_magnetic(other.m_magnetic) {} - - /*! - * \brief Assignment operator = - * \param other - * @return - */ - CHeading &operator =(const CHeading &other); - /*! * \brief Equal operator == * \param other diff --git a/src/blackmisc/avioadfsystem.h b/src/blackmisc/avioadfsystem.h index 8a65aa16f..6dc056e82 100644 --- a/src/blackmisc/avioadfsystem.h +++ b/src/blackmisc/avioadfsystem.h @@ -121,17 +121,6 @@ public: this->validate(true); } - /*! - * \brief Assigment operator = - * \param otherSystem - * \return - */ - CAdfSystem &operator =(const CAdfSystem &otherSystem) - { - this->CModulator::operator =(otherSystem); - return *this; - } - /*! * \brief operator == * \param otherSystem diff --git a/src/blackmisc/aviocomsystem.h b/src/blackmisc/aviocomsystem.h index 46e4ff6ed..ab10eab81 100644 --- a/src/blackmisc/aviocomsystem.h +++ b/src/blackmisc/aviocomsystem.h @@ -151,17 +151,6 @@ public: this->setFrequencyActive(BlackMisc::PhysicalQuantities::CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress()); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CComSystem& operator =(const CComSystem &other) - { - this->CModulator::operator =(other); - return *this; - } - /*! * \brief operator == * \param other diff --git a/src/blackmisc/aviomodulator.cpp b/src/blackmisc/aviomodulator.cpp index 94428b640..c7de9a2df 100644 --- a/src/blackmisc/aviomodulator.cpp +++ b/src/blackmisc/aviomodulator.cpp @@ -35,19 +35,6 @@ template void CModulator::registerMetadata() qDBusRegisterMetaType(); } -/* - * Assigment operator = - */ -template CModulator& CModulator::operator=(const CModulator &other) -{ - if (this == &other) return *this; - this->m_frequencyActive = other.m_frequencyActive; - this->m_frequencyStandby = other.m_frequencyStandby; - this->m_digits = other.m_digits; - this->setName(other.getName()); - return *this; -} - /* * Equal operator == */ diff --git a/src/blackmisc/aviomodulator.h b/src/blackmisc/aviomodulator.h index ab7485c43..f8280bf18 100644 --- a/src/blackmisc/aviomodulator.h +++ b/src/blackmisc/aviomodulator.h @@ -126,13 +126,6 @@ protected: this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyMHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::MHz()); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CModulator &operator =(const CModulator &other); - /*! * \brief operator == * \param other diff --git a/src/blackmisc/avionavsystem.h b/src/blackmisc/avionavsystem.h index f6ec2026b..188a42502 100644 --- a/src/blackmisc/avionavsystem.h +++ b/src/blackmisc/avionavsystem.h @@ -132,17 +132,6 @@ public: this->validate(true); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CNavSystem &operator =(const CNavSystem &other) - { - this->CModulator::operator =(other); - return *this; - } - /*! * \brief operator == * \param other diff --git a/src/blackmisc/aviotransponder.h b/src/blackmisc/aviotransponder.h index e866dfbfc..3d09cb1cc 100644 --- a/src/blackmisc/aviotransponder.h +++ b/src/blackmisc/aviotransponder.h @@ -224,19 +224,6 @@ public: this->m_transponderCode = 2000; } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CTransponder &operator =(const CTransponder &other) - { - this->CAvionicsBase::operator =(other); - this->m_transponderMode = other.m_transponderMode; - this->m_transponderCode = other.m_transponderCode; - return *this; - } - /*! * \brief operator == * \param other diff --git a/src/blackmisc/avtrack.cpp b/src/blackmisc/avtrack.cpp index 5fe603fc0..b3a16a450 100644 --- a/src/blackmisc/avtrack.cpp +++ b/src/blackmisc/avtrack.cpp @@ -22,17 +22,6 @@ QString CTrack::convertToQString(bool i18n) const return s.append(this->m_magnetic ? " magnetic" : " true"); } -/* - * Assigment - */ -CTrack& CTrack::operator =(const CTrack &other) -{ - if (this == &other) return *this; - this->CAngle::operator = (other); - this->m_magnetic = other.m_magnetic; - return *this; -} - /* * Equal? */ diff --git a/src/blackmisc/avtrack.h b/src/blackmisc/avtrack.h index 6eca3ecf8..d202b4e38 100644 --- a/src/blackmisc/avtrack.h +++ b/src/blackmisc/avtrack.h @@ -77,19 +77,6 @@ public: */ CTrack(BlackMisc::PhysicalQuantities::CAngle track, bool magnetic) : BlackMisc::PhysicalQuantities::CAngle(track), m_magnetic(magnetic) {} - /*! - * \brief Copy constructor - * \param other - */ - CTrack(const CTrack &other) : BlackMisc::PhysicalQuantities::CAngle(other), m_magnetic(other.m_magnetic) {} - - /*! - * \brief Assignment operator = - * \param other - * \return - */ - CTrack &operator =(const CTrack &other); - /*! * \brief Equal operator == * \param other diff --git a/src/blackmisc/coordinategeodetic.h b/src/blackmisc/coordinategeodetic.h index 3ec776e86..864acff1c 100644 --- a/src/blackmisc/coordinategeodetic.h +++ b/src/blackmisc/coordinategeodetic.h @@ -194,20 +194,6 @@ public: return !((*this) == other); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CCoordinateGeodetic &operator =(const CCoordinateGeodetic &other) - { - if (this == &other) return *this; - this->m_height = other.m_height; - this->m_latitude = other.m_latitude; - this->m_longitude = other.m_longitude; - return *this; - } - /* * Register metadata */ diff --git a/src/blackmisc/coordinatened.h b/src/blackmisc/coordinatened.h index 57fdd9f85..78c40638e 100644 --- a/src/blackmisc/coordinatened.h +++ b/src/blackmisc/coordinatened.h @@ -108,20 +108,6 @@ public: return !((*this) == other); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CCoordinateNed &operator =(const CCoordinateNed &other) - { - if (this == &other) return *this; - this->CVector3DBase::operator = (other); - this->m_hasReferencePosition = other.m_hasReferencePosition; - this->m_referencePosition = other.m_referencePosition; - return *this; - } - /*! * \brief Corresponding reference position * \return diff --git a/src/blackmisc/geoearthangle.h b/src/blackmisc/geoearthangle.h index 4c76aad70..8cb2835ed 100644 --- a/src/blackmisc/geoearthangle.h +++ b/src/blackmisc/geoearthangle.h @@ -50,12 +50,6 @@ protected: */ CEarthAngle() : CAngle(0.0, BlackMisc::PhysicalQuantities::CAngleUnit::deg()) {} - /*! - * \brief Copy constructor - * \param latOrLon - */ - CEarthAngle(const LATorLON &latOrLon) : CAngle(latOrLon) {} - /*! * \brief Init by double value * \param value @@ -184,17 +178,6 @@ public: return this->CAngle::operator >=(latOrLon); } - /*! - * \brief Assignment operator = - * \param latOrLon - * \return - */ - CEarthAngle &operator =(const LATorLON &latOrLon) - { - this->CAngle::operator =(latOrLon); - return *this; - } - /*! * \brief Plus operator + * \param latOrLon diff --git a/src/blackmisc/geolatitude.h b/src/blackmisc/geolatitude.h index 781a8b599..5f5fd66a1 100644 --- a/src/blackmisc/geolatitude.h +++ b/src/blackmisc/geolatitude.h @@ -31,12 +31,6 @@ public: */ CLatitude() : CEarthAngle() {} - /*! - * \brief Copy constructor - * \param other - */ - CLatitude(const CLatitude &other) : CEarthAngle(other) {} - /*! * \brief Constructor * \param angle diff --git a/src/blackmisc/geolongitude.h b/src/blackmisc/geolongitude.h index a851be10c..8ab0e9e8a 100644 --- a/src/blackmisc/geolongitude.h +++ b/src/blackmisc/geolongitude.h @@ -28,12 +28,6 @@ public: */ CLongitude() : CEarthAngle() {} - /*! - * \brief Copy constructor - * \param other - */ - CLongitude(const CLongitude &other) : CEarthAngle(other) {} - /*! * \brief Constructor * \param angle diff --git a/src/blackmisc/mathmatrixbase.h b/src/blackmisc/mathmatrixbase.h index ca11bb417..de8d3b5d3 100644 --- a/src/blackmisc/mathmatrixbase.h +++ b/src/blackmisc/mathmatrixbase.h @@ -140,18 +140,6 @@ public: return !((*this) == other); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CMatrixBase &operator =(const CMatrixBase &other) - { - if (this == &other) return *this; - this->m_matrix = other.m_matrix; - return *this; - } - /*! * \brief Operator *= * \param factor diff --git a/src/blackmisc/mathvector3dbase.h b/src/blackmisc/mathvector3dbase.h index b5c9e1ea8..dac6f3e8d 100644 --- a/src/blackmisc/mathvector3dbase.h +++ b/src/blackmisc/mathvector3dbase.h @@ -203,20 +203,6 @@ public: return !((*this) == other); } - /*! - * \brief Assigment operator = - * \param other - * \return - */ - CVector3DBase &operator =(const CVector3DBase &other) - { - if (this == &other) return *this; - this->m_i = other.m_i; - this->m_j = other.m_j; - this->m_k = other.m_k; - return *this; - } - /*! * \brief Operator += * \param other diff --git a/src/blackmisc/pqangle.h b/src/blackmisc/pqangle.h index 9453f63c6..c8209d8cd 100644 --- a/src/blackmisc/pqangle.h +++ b/src/blackmisc/pqangle.h @@ -24,11 +24,6 @@ public: */ CAngle() : CPhysicalQuantity(0, CAngleUnit::defaultUnit()) {} - /*! - * \brief Copy constructor from base type - */ - CAngle(const CPhysicalQuantity &base) : CPhysicalQuantity(base) {} - /*! * \brief Init by double value * \param value diff --git a/src/blackmisc/pqbase.cpp b/src/blackmisc/pqbase.cpp index 982ddaf0e..8ea33df57 100644 --- a/src/blackmisc/pqbase.cpp +++ b/src/blackmisc/pqbase.cpp @@ -17,34 +17,6 @@ namespace PhysicalQuantities // --- Prefix ------------------------------------------------------------ // ----------------------------------------------------------------------- -/* - * Constructor - */ -CMeasurementPrefix::CMeasurementPrefix(const QString &name, const QString &symbol, double factor) : - m_name(name), m_symbol(symbol), m_factor(factor) -{ -} - -/* - * Constructor - */ -CMeasurementPrefix::CMeasurementPrefix(const CMeasurementPrefix &other) : - m_name(other.m_name), m_symbol(other.m_symbol), m_factor(other.m_factor) -{ -} - -/* - * Assignment operator - */ -CMeasurementPrefix &CMeasurementPrefix::operator=(const CMeasurementPrefix &other) -{ - if (this == &other) return *this; - this->m_name = other.m_name; - this->m_symbol= other.m_symbol; - this->m_factor = other.m_factor; - return *this; -} - /* * Equal? */ @@ -106,21 +78,6 @@ CMeasurementUnit::CMeasurementUnit(const CMeasurementUnit &other) : { } -/* - * Assigment operator - */ -CMeasurementUnit &CMeasurementUnit::operator =(const CMeasurementUnit &other) -{ - if (this == &other) return *this; // Same object? Yes, so skip assignment, and just return *this - this->m_name = other.m_name; - this->m_symbol = other.m_symbol; - this->m_prefix = other.m_prefix; - this->m_displayDigits = other.m_displayDigits; - this->m_epsilon = other.m_epsilon; - this->m_converter = other.m_converter; - return *this; -} - /* * Equal operator */ diff --git a/src/blackmisc/pqbase.h b/src/blackmisc/pqbase.h index 0576109ad..f7fb27a3b 100644 --- a/src/blackmisc/pqbase.h +++ b/src/blackmisc/pqbase.h @@ -41,7 +41,8 @@ private: * \param prefixName * \param factor */ - CMeasurementPrefix(const QString &name, const QString &symbol, double factor); + CMeasurementPrefix(const QString &name, const QString &symbol, double factor) : + m_name(name), m_symbol(symbol), m_factor(factor) {} protected: /*! @@ -75,19 +76,6 @@ protected: } public: - /*! - * \brief Copy constructor - * \param other - */ - CMeasurementPrefix(const CMeasurementPrefix &other); - - /*! - * \brief Assigmnet operator = - * \param other - * \return - */ - CMeasurementPrefix &operator =(const CMeasurementPrefix &other); - /*! * \brief Equal operator == * \param other @@ -439,13 +427,6 @@ protected: */ CMeasurementUnit(const CMeasurementUnit &other); - /*! - * \brief Assignment operator = - * \param other - * \return - */ - CMeasurementUnit &operator =(const CMeasurementUnit &other); - /*! * \brief String for streaming operators is full name * \return diff --git a/src/blackmisc/pqfrequency.h b/src/blackmisc/pqfrequency.h index 96b790d95..d86a89f76 100644 --- a/src/blackmisc/pqfrequency.h +++ b/src/blackmisc/pqfrequency.h @@ -24,11 +24,6 @@ public: */ CFrequency() : CPhysicalQuantity(0, CFrequencyUnit::defaultUnit()) {} - /** - *\brief Copy constructor from base type - */ - CFrequency(const CPhysicalQuantity &base) : CPhysicalQuantity(base) {} - /*! * \brief Init by double value * \param value diff --git a/src/blackmisc/pqlength.h b/src/blackmisc/pqlength.h index 559b7f172..15cecf3ef 100644 --- a/src/blackmisc/pqlength.h +++ b/src/blackmisc/pqlength.h @@ -24,11 +24,6 @@ public: */ CLength() : CPhysicalQuantity(0, CLengthUnit::defaultUnit()) {} - /** - *\brief Copy constructor from base type - */ - CLength(const CPhysicalQuantity &base) : CPhysicalQuantity(base) {} - /*! *\brief Init by double value * \param value diff --git a/src/blackmisc/pqmass.h b/src/blackmisc/pqmass.h index 9b949b78b..00483b3b1 100644 --- a/src/blackmisc/pqmass.h +++ b/src/blackmisc/pqmass.h @@ -30,12 +30,6 @@ public: */ CMass(double value, const CMassUnit &unit) : CPhysicalQuantity(value, unit) {} - /*! - * \brief Copy constructor from base type - * \param base - */ - CMass(const CPhysicalQuantity &base) : CPhysicalQuantity(base) {} - /*! * \brief Virtual destructor */ diff --git a/src/blackmisc/pqphysicalquantity.cpp b/src/blackmisc/pqphysicalquantity.cpp index 945c0aa68..b83c3ce29 100644 --- a/src/blackmisc/pqphysicalquantity.cpp +++ b/src/blackmisc/pqphysicalquantity.cpp @@ -18,14 +18,6 @@ template CPhysicalQuantity::CPhysicalQuantity(doubl { } -/* - * Copy constructor - */ -template CPhysicalQuantity::CPhysicalQuantity(const CPhysicalQuantity &other) : - m_value(other.m_value), m_unit(other.m_unit) -{ -} - /* * Equal operator == */ @@ -44,18 +36,6 @@ template bool CPhysicalQuantity::operator !=(const return !((*this) == other); } -/* - * Assignment operator = - */ -template CPhysicalQuantity& CPhysicalQuantity::operator=(const CPhysicalQuantity &other) -{ - if (this == &other) return *this; - - this->m_value = other.m_value; - this->m_unit = other.m_unit; - return *this; -} - /* * Plus operator */ diff --git a/src/blackmisc/pqphysicalquantity.h b/src/blackmisc/pqphysicalquantity.h index acdc6794e..ce3c80786 100644 --- a/src/blackmisc/pqphysicalquantity.h +++ b/src/blackmisc/pqphysicalquantity.h @@ -61,19 +61,6 @@ protected: */ CPhysicalQuantity(double value, const MU &unit); - /*! - * \brief Copy constructor - * \param other - */ - CPhysicalQuantity(const CPhysicalQuantity &other); - - /*! - * \brief Assignment operator = - * \param other - * \return - */ - CPhysicalQuantity &operator =(const CPhysicalQuantity &other); - /*! * \brief Name as string * \param i18n diff --git a/src/blackmisc/pqpressure.h b/src/blackmisc/pqpressure.h index 38d08778f..febb338b1 100644 --- a/src/blackmisc/pqpressure.h +++ b/src/blackmisc/pqpressure.h @@ -25,11 +25,6 @@ public: */ CPressure() : CPhysicalQuantity(0, CPressureUnit::defaultUnit()) {} - /** - *\brief Copy constructor from base type - */ - CPressure(const CPhysicalQuantity &base) : CPhysicalQuantity(base) {} - /*! *\brief Init by double value * \param value diff --git a/src/blackmisc/pqspeed.h b/src/blackmisc/pqspeed.h index 889916f42..a783b4b9c 100644 --- a/src/blackmisc/pqspeed.h +++ b/src/blackmisc/pqspeed.h @@ -25,11 +25,6 @@ public: */ CSpeed() : CPhysicalQuantity(0, CSpeedUnit::defaultUnit()) {} - /*! - *\brief Copy constructor from base type - */ - CSpeed(const CPhysicalQuantity &base): CPhysicalQuantity(base) {} - /*! *\brief Init by double value * \param value diff --git a/src/blackmisc/pqtemperature.h b/src/blackmisc/pqtemperature.h index e8697e509..a94540967 100644 --- a/src/blackmisc/pqtemperature.h +++ b/src/blackmisc/pqtemperature.h @@ -24,11 +24,6 @@ public: */ CTemperature() : CPhysicalQuantity(0, CTemperatureUnit::defaultUnit()) {} - /** - * \brief Copy constructor from base type - */ - CTemperature(const CPhysicalQuantity &base) : CPhysicalQuantity(base) {} - /*! * \brief Init by double value * \param value diff --git a/src/blackmisc/pqtime.h b/src/blackmisc/pqtime.h index 060585c70..8ecd81fc7 100644 --- a/src/blackmisc/pqtime.h +++ b/src/blackmisc/pqtime.h @@ -25,11 +25,6 @@ public: */ CTime() : CPhysicalQuantity(0, CTimeUnit::defaultUnit()) {} - /** - *\brief Copy constructor from base type - */ - CTime(const CPhysicalQuantity &base): CPhysicalQuantity(base) {} - /*! *\brief Init by double value * \param value diff --git a/src/blackmisc/streamable.h b/src/blackmisc/streamable.h index 8e5394cf7..8ad890010 100644 --- a/src/blackmisc/streamable.h +++ b/src/blackmisc/streamable.h @@ -166,14 +166,6 @@ protected: * \param argument */ virtual void unmarshallFromDbus(const QDBusArgument &) = 0; - - /*! - * \brief Copy assignment operator. - * \remark This is protected in order to forbid slicing an instance of one derived - * class into an instance of a completely unrelated derived class. - * \return - */ - CStreamable& operator=(const CStreamable&) { return *this; } }; } // namespace