From 745c5de5d669a9014f09b1010ca78f4f2586868a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 16 Apr 2024 17:34:23 +0300 Subject: [PATCH] Refactoring. Remove the top level "const" qualifier from the return type of a function. --- src/libs/vpatterndb/vcontainer.cpp | 30 ++++++++-------- src/libs/vpatterndb/vcontainer.h | 34 +++++++++---------- .../dialogs/tools/dialogcubicbezier.cpp | 8 ++--- .../vtools/dialogs/tools/dialogcubicbezier.h | 8 ++--- .../vtools/dialogs/tools/dialogspline.cpp | 4 +-- src/libs/vtools/dialogs/tools/dialogspline.h | 4 +-- src/libs/vtools/tools/vabstracttool.cpp | 2 +- src/libs/vtools/tools/vabstracttool.h | 2 +- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 463f5a9d8..454909583 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -170,7 +170,7 @@ void VContainer::ClearNamespace(const QString &nspace) * @return point */ // cppcheck-suppress unusedFunction -auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer +auto VContainer::GetGObject(quint32 id) const -> QSharedPointer { if (d->calculationObjects.contains(id)) { @@ -186,7 +186,7 @@ auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::GetFakeGObject(quint32 id) -> const QSharedPointer +auto VContainer::GetFakeGObject(quint32 id) -> QSharedPointer { auto *obj = new VGObject(); obj->setId(id); @@ -575,13 +575,13 @@ void VContainer::FillPiecesAreas(Unit unit) } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataMeasurements() const -> const QMap> +auto VContainer::DataMeasurements() const -> QMap> { return DataVar(VarType::Measurement); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataMeasurementsWithSeparators() const -> const QMap> +auto VContainer::DataMeasurementsWithSeparators() const -> QMap> { QMap> measurements = DataVar(VarType::Measurement); QMap> const separators = DataVar(VarType::MeasurementSeparator); @@ -592,13 +592,13 @@ auto VContainer::DataMeasurementsWithSeparators() const -> const QMap const QMap> +auto VContainer::DataIncrements() const -> QMap> { return DataVar(VarType::Increment); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataIncrementsWithSeparators() const -> const QMap> +auto VContainer::DataIncrementsWithSeparators() const -> QMap> { QMap> increments = DataVar(VarType::Increment); QMap> const separators = DataVar(VarType::IncrementSeparator); @@ -609,43 +609,43 @@ auto VContainer::DataIncrementsWithSeparators() const -> const QMap const QMap> +auto VContainer::DataLengthLines() const -> QMap> { return DataVar(VarType::LineLength); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataLengthCurves() const -> const QMap> +auto VContainer::DataLengthCurves() const -> QMap> { return DataVar(VarType::CurveLength); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataCurvesCLength() const -> const QMap> +auto VContainer::DataCurvesCLength() const -> QMap> { return DataVar(VarType::CurveCLength); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataAngleLines() const -> const QMap> +auto VContainer::DataAngleLines() const -> QMap> { return DataVar(VarType::LineAngle); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataRadiusesArcs() const -> const QMap> +auto VContainer::DataRadiusesArcs() const -> QMap> { return DataVar(VarType::ArcRadius); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataAnglesCurves() const -> const QMap> +auto VContainer::DataAnglesCurves() const -> QMap> { return DataVar(VarType::CurveAngle); } //--------------------------------------------------------------------------------------------------------------------- -auto VContainer::DataPieceArea() const -> const QMap> +auto VContainer::DataPieceArea() const -> QMap> { QMap> externalAreas = DataVar(VarType::PieceExternalArea); QMap> const seamLineAreas = DataVar(VarType::PieceSeamLineArea); @@ -708,7 +708,7 @@ auto VContainer::GetTrVars() const -> const VTranslateVars * } //--------------------------------------------------------------------------------------------------------------------- -template auto VContainer::DataVar(const VarType &type) const -> const QMap> +template auto VContainer::DataVar(const VarType &type) const -> QMap> { QMap> map; // Sorting QHash by id @@ -771,7 +771,7 @@ auto VContainer::CalculationGObjects() const -> const QHash const QHash * +auto VContainer::DataPieces() const -> QHash * { return d->pieces.data(); } diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index c19f97e85..7153026dd 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -126,9 +126,9 @@ public: static auto UniqueNamespace() -> QString; - template auto GeometricObject(const quint32 &id) const -> const QSharedPointer; - auto GetGObject(quint32 id) const -> const QSharedPointer; - static auto GetFakeGObject(quint32 id) -> const QSharedPointer; + template auto GeometricObject(const quint32 &id) const -> QSharedPointer; + auto GetGObject(quint32 id) const -> QSharedPointer; + static auto GetFakeGObject(quint32 id) -> QSharedPointer; auto GetPiece(quint32 id) const -> VPiece; auto GetPiecePath(quint32 id) const -> VPiecePath; auto GetPieceForPiecePath(quint32 id) const -> quint32; @@ -178,20 +178,20 @@ public: void FillPiecesAreas(Unit unit); auto CalculationGObjects() const -> const QHash> *; - auto DataPieces() const -> const QHash *; + auto DataPieces() const -> QHash *; auto DataVariables() const -> const QHash> *; - auto DataMeasurements() const -> const QMap>; - auto DataMeasurementsWithSeparators() const -> const QMap>; - auto DataIncrements() const -> const QMap>; - auto DataIncrementsWithSeparators() const -> const QMap>; - auto DataLengthLines() const -> const QMap>; - auto DataLengthCurves() const -> const QMap>; - auto DataCurvesCLength() const -> const QMap>; - auto DataAngleLines() const -> const QMap>; - auto DataRadiusesArcs() const -> const QMap>; - auto DataAnglesCurves() const -> const QMap>; - auto DataPieceArea() const -> const QMap>; + auto DataMeasurements() const -> QMap>; + auto DataMeasurementsWithSeparators() const -> QMap>; + auto DataIncrements() const -> QMap>; + auto DataIncrementsWithSeparators() const -> QMap>; + auto DataLengthLines() const -> QMap>; + auto DataLengthCurves() const -> QMap>; + auto DataCurvesCLength() const -> QMap>; + auto DataAngleLines() const -> QMap>; + auto DataRadiusesArcs() const -> QMap>; + auto DataAnglesCurves() const -> QMap>; + auto DataPieceArea() const -> QMap>; auto IsUnique(const QString &name) const -> bool; static auto IsUnique(const QString &name, const QString &nspace) -> bool; @@ -224,7 +224,7 @@ private: template void UpdateObject(const quint32 &id, const QSharedPointer &point); - template auto DataVar(const VarType &type) const -> const QMap>; + template auto DataVar(const VarType &type) const -> QMap>; static void ClearNamespace(const QString &nspace); }; @@ -236,7 +236,7 @@ Q_DECLARE_TYPEINFO(VContainer, Q_MOVABLE_TYPE); // NOLINT */ //--------------------------------------------------------------------------------------------------------------------- -template auto VContainer::GeometricObject(const quint32 &id) const -> const QSharedPointer +template auto VContainer::GeometricObject(const quint32 &id) const -> QSharedPointer { if (id == NULL_ID) { diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp index a9b63ff17..8160347c7 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezier.cpp @@ -284,25 +284,25 @@ void DialogCubicBezier::ValidateAlias() } //--------------------------------------------------------------------------------------------------------------------- -auto DialogCubicBezier::GetP1() const -> const QSharedPointer +auto DialogCubicBezier::GetP1() const -> QSharedPointer { return data->GeometricObject(getCurrentObjectId(ui->comboBoxP1)); } //--------------------------------------------------------------------------------------------------------------------- -auto DialogCubicBezier::GetP2() const -> const QSharedPointer +auto DialogCubicBezier::GetP2() const -> QSharedPointer { return data->GeometricObject(getCurrentObjectId(ui->comboBoxP2)); } //--------------------------------------------------------------------------------------------------------------------- -auto DialogCubicBezier::GetP3() const -> const QSharedPointer +auto DialogCubicBezier::GetP3() const -> QSharedPointer { return data->GeometricObject(getCurrentObjectId(ui->comboBoxP3)); } //--------------------------------------------------------------------------------------------------------------------- -auto DialogCubicBezier::GetP4() const -> const QSharedPointer +auto DialogCubicBezier::GetP4() const -> QSharedPointer { return data->GeometricObject(getCurrentObjectId(ui->comboBoxP4)); } diff --git a/src/libs/vtools/dialogs/tools/dialogcubicbezier.h b/src/libs/vtools/dialogs/tools/dialogcubicbezier.h index 75adc8a23..dccce2537 100644 --- a/src/libs/vtools/dialogs/tools/dialogcubicbezier.h +++ b/src/libs/vtools/dialogs/tools/dialogcubicbezier.h @@ -91,10 +91,10 @@ private: /** @brief number number of handled objects */ qint32 number{0}; - auto GetP1() const -> const QSharedPointer; - auto GetP2() const -> const QSharedPointer; - auto GetP3() const -> const QSharedPointer; - auto GetP4() const -> const QSharedPointer; + auto GetP1() const -> QSharedPointer; + auto GetP2() const -> QSharedPointer; + auto GetP3() const -> QSharedPointer; + auto GetP4() const -> QSharedPointer; }; //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogspline.cpp b/src/libs/vtools/dialogs/tools/dialogspline.cpp index c72000fe8..eb8fd9a59 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogspline.cpp @@ -369,13 +369,13 @@ void DialogSpline::FXLength2() } //--------------------------------------------------------------------------------------------------------------------- -auto DialogSpline::GetP1() const -> const QSharedPointer +auto DialogSpline::GetP1() const -> QSharedPointer { return data->GeometricObject(getCurrentObjectId(ui->comboBoxP1)); } //--------------------------------------------------------------------------------------------------------------------- -auto DialogSpline::GetP4() const -> const QSharedPointer +auto DialogSpline::GetP4() const -> QSharedPointer { return data->GeometricObject(getCurrentObjectId(ui->comboBoxP4)); } diff --git a/src/libs/vtools/dialogs/tools/dialogspline.h b/src/libs/vtools/dialogs/tools/dialogspline.h index 550503c47..94019531c 100644 --- a/src/libs/vtools/dialogs/tools/dialogspline.h +++ b/src/libs/vtools/dialogs/tools/dialogspline.h @@ -130,8 +130,8 @@ private: /** @brief number number of handled objects */ qint32 number{0}; - auto GetP1() const -> const QSharedPointer; - auto GetP4() const -> const QSharedPointer; + auto GetP1() const -> QSharedPointer; + auto GetP4() const -> QSharedPointer; auto CurrentSpline() const -> VSpline; diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index 294b89981..681da3ad7 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -247,7 +247,7 @@ void VAbstractTool::PerformDelete() } //--------------------------------------------------------------------------------------------------------------------- -auto VAbstractTool::Colors() -> const QStringList +auto VAbstractTool::Colors() -> QStringList { return QStringList{ColorBlack, ColorGreen, ColorBlue, ColorDarkRed, ColorDarkGreen, ColorDarkBlue, ColorYellow, ColorLightSalmon, ColorGoldenRod, ColorOrange, diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index 01638ba1b..fdf7e53f7 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -97,7 +97,7 @@ public: static auto CheckFormula(const quint32 &toolId, QString &formula, VContainer *data) -> qreal; - static auto Colors() -> const QStringList; + static auto Colors() -> QStringList; static auto ColorsList() -> QMap; static auto GetRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc) -> VToolRecord;