Refactoring.

Code style.
This commit is contained in:
Roman Telezhynskyi 2023-07-13 19:31:54 +03:00
parent ac25cc02df
commit bbed14d37d

View File

@ -29,13 +29,11 @@
#include "vformula.h" #include "vformula.h"
#include "vformula_p.h" #include "vformula_p.h"
#include <qnumeric.h>
#include <QMessageLogger> #include <QMessageLogger>
#include <QScopedPointer> #include <QScopedPointer>
#include <QtDebug> #include <QtDebug>
#include "../qmuparser/qmuparsererror.h" #include "../qmuparser/qmuparsererror.h"
#include "../vgeometry/../ifc/ifcdef.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "../vmisc/vcommonsettings.h" #include "../vmisc/vcommonsettings.h"
@ -43,21 +41,23 @@
#include "vcontainer.h" #include "vcontainer.h"
#include "vtranslatevars.h" #include "vtranslatevars.h"
//VFormula // VFormula
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula() VFormula::VFormula()
: d(new VFormulaData) : d(new VFormulaData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula(const QString &formula, const VContainer *container) VFormula::VFormula(const QString &formula, const VContainer *container)
: d(new VFormulaData(formula, container)) : d(new VFormulaData(formula, container))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VFormula::operator=(const VFormula &formula) -> VFormula & auto VFormula::operator=(const VFormula &formula) -> VFormula &
{ {
if ( &formula == this ) if (&formula == this)
{ {
return *this; return *this;
} }
@ -66,21 +66,18 @@ auto VFormula::operator=(const VFormula &formula) -> VFormula &
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormula::VFormula(const VFormula &formula) VFormula::VFormula(const VFormula &formula) = default;
: d (formula.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormula::~VFormula() VFormula::~VFormula() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VFormula::operator==(const VFormula &formula) const -> bool auto VFormula::operator==(const VFormula &formula) const -> bool
{ {
return d->formula == formula.GetFormula() && d->strValue == formula.getStringValue() && return d->formula == formula.GetFormula() && d->strValue == formula.getStringValue() &&
d->checkZero == formula.getCheckZero() && d->checkLessThanZero == formula.getCheckLessThanZero() && d->checkZero == formula.getCheckZero() && d->checkLessThanZero == formula.getCheckLessThanZero() &&
d->data == formula.getData() && d->toolId == formula.getToolId() && d->postfix == formula.getPostfix() && d->data == formula.getData() && d->toolId == formula.getToolId() && d->postfix == formula.getPostfix() &&
d->error == formula.error() && VFuzzyComparePossibleNulls(d->dValue, formula.getDoubleValue()); d->error == formula.error() && VFuzzyComparePossibleNulls(d->dValue, formula.getDoubleValue());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -96,10 +93,8 @@ auto VFormula::GetFormula(FormulaType type) const -> QString
{ {
return VTranslateVars::TryFormulaToUser(d->formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); return VTranslateVars::TryFormulaToUser(d->formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
} }
else
{ return d->formula;
return d->formula;
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -109,8 +104,8 @@ void VFormula::SetFormula(const QString &value, FormulaType type)
{ {
if (type == FormulaType::FromUser) if (type == FormulaType::FromUser)
{ {
d->formula = VTranslateVars::TryFormulaFromUser(value, d->formula =
VAbstractApplication::VApp()->Settings()->GetOsSeparator()); VTranslateVars::TryFormulaFromUser(value, VAbstractApplication::VApp()->Settings()->GetOsSeparator());
} }
else else
{ {