Refactoring.

Remove the top level "const" qualifier from the return type of a function.
This commit is contained in:
Roman Telezhynskyi 2024-04-16 17:34:23 +03:00
parent 1ddb07f2ee
commit 745c5de5d6
8 changed files with 46 additions and 46 deletions

View File

@ -170,7 +170,7 @@ void VContainer::ClearNamespace(const QString &nspace)
* @return point
*/
// cppcheck-suppress unusedFunction
auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer<VGObject>
auto VContainer::GetGObject(quint32 id) const -> QSharedPointer<VGObject>
{
if (d->calculationObjects.contains(id))
{
@ -186,7 +186,7 @@ auto VContainer::GetGObject(quint32 id) const -> const QSharedPointer<VGObject>
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::GetFakeGObject(quint32 id) -> const QSharedPointer<VGObject>
auto VContainer::GetFakeGObject(quint32 id) -> QSharedPointer<VGObject>
{
auto *obj = new VGObject();
obj->setId(id);
@ -575,13 +575,13 @@ void VContainer::FillPiecesAreas(Unit unit)
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataMeasurements() const -> const QMap<QString, QSharedPointer<VMeasurement>>
auto VContainer::DataMeasurements() const -> QMap<QString, QSharedPointer<VMeasurement>>
{
return DataVar<VMeasurement>(VarType::Measurement);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataMeasurementsWithSeparators() const -> const QMap<QString, QSharedPointer<VMeasurement>>
auto VContainer::DataMeasurementsWithSeparators() const -> QMap<QString, QSharedPointer<VMeasurement>>
{
QMap<QString, QSharedPointer<VMeasurement>> measurements = DataVar<VMeasurement>(VarType::Measurement);
QMap<QString, QSharedPointer<VMeasurement>> const separators = DataVar<VMeasurement>(VarType::MeasurementSeparator);
@ -592,13 +592,13 @@ auto VContainer::DataMeasurementsWithSeparators() const -> const QMap<QString, Q
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataIncrements() const -> const QMap<QString, QSharedPointer<VIncrement>>
auto VContainer::DataIncrements() const -> QMap<QString, QSharedPointer<VIncrement>>
{
return DataVar<VIncrement>(VarType::Increment);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataIncrementsWithSeparators() const -> const QMap<QString, QSharedPointer<VIncrement>>
auto VContainer::DataIncrementsWithSeparators() const -> QMap<QString, QSharedPointer<VIncrement>>
{
QMap<QString, QSharedPointer<VIncrement>> increments = DataVar<VIncrement>(VarType::Increment);
QMap<QString, QSharedPointer<VIncrement>> const separators = DataVar<VIncrement>(VarType::IncrementSeparator);
@ -609,43 +609,43 @@ auto VContainer::DataIncrementsWithSeparators() const -> const QMap<QString, QSh
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataLengthLines() const -> const QMap<QString, QSharedPointer<VLengthLine>>
auto VContainer::DataLengthLines() const -> QMap<QString, QSharedPointer<VLengthLine>>
{
return DataVar<VLengthLine>(VarType::LineLength);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataLengthCurves() const -> const QMap<QString, QSharedPointer<VCurveLength>>
auto VContainer::DataLengthCurves() const -> QMap<QString, QSharedPointer<VCurveLength>>
{
return DataVar<VCurveLength>(VarType::CurveLength);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataCurvesCLength() const -> const QMap<QString, QSharedPointer<VCurveCLength>>
auto VContainer::DataCurvesCLength() const -> QMap<QString, QSharedPointer<VCurveCLength>>
{
return DataVar<VCurveCLength>(VarType::CurveCLength);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataAngleLines() const -> const QMap<QString, QSharedPointer<VLineAngle>>
auto VContainer::DataAngleLines() const -> QMap<QString, QSharedPointer<VLineAngle>>
{
return DataVar<VLineAngle>(VarType::LineAngle);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataRadiusesArcs() const -> const QMap<QString, QSharedPointer<VArcRadius>>
auto VContainer::DataRadiusesArcs() const -> QMap<QString, QSharedPointer<VArcRadius>>
{
return DataVar<VArcRadius>(VarType::ArcRadius);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataAnglesCurves() const -> const QMap<QString, QSharedPointer<VCurveAngle>>
auto VContainer::DataAnglesCurves() const -> QMap<QString, QSharedPointer<VCurveAngle>>
{
return DataVar<VCurveAngle>(VarType::CurveAngle);
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataPieceArea() const -> const QMap<QString, QSharedPointer<VPieceArea>>
auto VContainer::DataPieceArea() const -> QMap<QString, QSharedPointer<VPieceArea>>
{
QMap<QString, QSharedPointer<VPieceArea>> externalAreas = DataVar<VPieceArea>(VarType::PieceExternalArea);
QMap<QString, QSharedPointer<VPieceArea>> const seamLineAreas = DataVar<VPieceArea>(VarType::PieceSeamLineArea);
@ -708,7 +708,7 @@ auto VContainer::GetTrVars() const -> const VTranslateVars *
}
//---------------------------------------------------------------------------------------------------------------------
template <typename T> auto VContainer::DataVar(const VarType &type) const -> const QMap<QString, QSharedPointer<T>>
template <typename T> auto VContainer::DataVar(const VarType &type) const -> QMap<QString, QSharedPointer<T>>
{
QMap<QString, QSharedPointer<T>> map;
// Sorting QHash by id
@ -771,7 +771,7 @@ auto VContainer::CalculationGObjects() const -> const QHash<quint32, QSharedPoin
}
//---------------------------------------------------------------------------------------------------------------------
auto VContainer::DataPieces() const -> const QHash<quint32, VPiece> *
auto VContainer::DataPieces() const -> QHash<quint32, VPiece> *
{
return d->pieces.data();
}

View File

@ -126,9 +126,9 @@ public:
static auto UniqueNamespace() -> QString;
template <typename T> auto GeometricObject(const quint32 &id) const -> const QSharedPointer<T>;
auto GetGObject(quint32 id) const -> const QSharedPointer<VGObject>;
static auto GetFakeGObject(quint32 id) -> const QSharedPointer<VGObject>;
template <typename T> auto GeometricObject(const quint32 &id) const -> QSharedPointer<T>;
auto GetGObject(quint32 id) const -> QSharedPointer<VGObject>;
static auto GetFakeGObject(quint32 id) -> QSharedPointer<VGObject>;
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<quint32, QSharedPointer<VGObject>> *;
auto DataPieces() const -> const QHash<quint32, VPiece> *;
auto DataPieces() const -> QHash<quint32, VPiece> *;
auto DataVariables() const -> const QHash<QString, QSharedPointer<VInternalVariable>> *;
auto DataMeasurements() const -> const QMap<QString, QSharedPointer<VMeasurement>>;
auto DataMeasurementsWithSeparators() const -> const QMap<QString, QSharedPointer<VMeasurement>>;
auto DataIncrements() const -> const QMap<QString, QSharedPointer<VIncrement>>;
auto DataIncrementsWithSeparators() const -> const QMap<QString, QSharedPointer<VIncrement>>;
auto DataLengthLines() const -> const QMap<QString, QSharedPointer<VLengthLine>>;
auto DataLengthCurves() const -> const QMap<QString, QSharedPointer<VCurveLength>>;
auto DataCurvesCLength() const -> const QMap<QString, QSharedPointer<VCurveCLength>>;
auto DataAngleLines() const -> const QMap<QString, QSharedPointer<VLineAngle>>;
auto DataRadiusesArcs() const -> const QMap<QString, QSharedPointer<VArcRadius>>;
auto DataAnglesCurves() const -> const QMap<QString, QSharedPointer<VCurveAngle>>;
auto DataPieceArea() const -> const QMap<QString, QSharedPointer<VPieceArea>>;
auto DataMeasurements() const -> QMap<QString, QSharedPointer<VMeasurement>>;
auto DataMeasurementsWithSeparators() const -> QMap<QString, QSharedPointer<VMeasurement>>;
auto DataIncrements() const -> QMap<QString, QSharedPointer<VIncrement>>;
auto DataIncrementsWithSeparators() const -> QMap<QString, QSharedPointer<VIncrement>>;
auto DataLengthLines() const -> QMap<QString, QSharedPointer<VLengthLine>>;
auto DataLengthCurves() const -> QMap<QString, QSharedPointer<VCurveLength>>;
auto DataCurvesCLength() const -> QMap<QString, QSharedPointer<VCurveCLength>>;
auto DataAngleLines() const -> QMap<QString, QSharedPointer<VLineAngle>>;
auto DataRadiusesArcs() const -> QMap<QString, QSharedPointer<VArcRadius>>;
auto DataAnglesCurves() const -> QMap<QString, QSharedPointer<VCurveAngle>>;
auto DataPieceArea() const -> QMap<QString, QSharedPointer<VPieceArea>>;
auto IsUnique(const QString &name) const -> bool;
static auto IsUnique(const QString &name, const QString &nspace) -> bool;
@ -224,7 +224,7 @@ private:
template <typename T> void UpdateObject(const quint32 &id, const QSharedPointer<T> &point);
template <typename T> auto DataVar(const VarType &type) const -> const QMap<QString, QSharedPointer<T>>;
template <typename T> auto DataVar(const VarType &type) const -> QMap<QString, QSharedPointer<T>>;
static void ClearNamespace(const QString &nspace);
};
@ -236,7 +236,7 @@ Q_DECLARE_TYPEINFO(VContainer, Q_MOVABLE_TYPE); // NOLINT
*/
//---------------------------------------------------------------------------------------------------------------------
template <typename T> auto VContainer::GeometricObject(const quint32 &id) const -> const QSharedPointer<T>
template <typename T> auto VContainer::GeometricObject(const quint32 &id) const -> QSharedPointer<T>
{
if (id == NULL_ID)
{

View File

@ -284,25 +284,25 @@ void DialogCubicBezier::ValidateAlias()
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP1() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP1() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP1));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP2() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP2() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP2));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP3() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP3() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP3));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogCubicBezier::GetP4() const -> const QSharedPointer<VPointF>
auto DialogCubicBezier::GetP4() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4));
}

View File

@ -91,10 +91,10 @@ private:
/** @brief number number of handled objects */
qint32 number{0};
auto GetP1() const -> const QSharedPointer<VPointF>;
auto GetP2() const -> const QSharedPointer<VPointF>;
auto GetP3() const -> const QSharedPointer<VPointF>;
auto GetP4() const -> const QSharedPointer<VPointF>;
auto GetP1() const -> QSharedPointer<VPointF>;
auto GetP2() const -> QSharedPointer<VPointF>;
auto GetP3() const -> QSharedPointer<VPointF>;
auto GetP4() const -> QSharedPointer<VPointF>;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -369,13 +369,13 @@ void DialogSpline::FXLength2()
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogSpline::GetP1() const -> const QSharedPointer<VPointF>
auto DialogSpline::GetP1() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP1));
}
//---------------------------------------------------------------------------------------------------------------------
auto DialogSpline::GetP4() const -> const QSharedPointer<VPointF>
auto DialogSpline::GetP4() const -> QSharedPointer<VPointF>
{
return data->GeometricObject<VPointF>(getCurrentObjectId(ui->comboBoxP4));
}

View File

@ -130,8 +130,8 @@ private:
/** @brief number number of handled objects */
qint32 number{0};
auto GetP1() const -> const QSharedPointer<VPointF>;
auto GetP4() const -> const QSharedPointer<VPointF>;
auto GetP1() const -> QSharedPointer<VPointF>;
auto GetP4() const -> QSharedPointer<VPointF>;
auto CurrentSpline() const -> VSpline;

View File

@ -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,

View File

@ -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<QString, QString>;
static auto GetRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc) -> VToolRecord;