Cppcheck warnings.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-01-25 17:04:53 +02:00
parent 9a51b165ac
commit a7987422ae
3 changed files with 34 additions and 33 deletions

View File

@ -38,7 +38,7 @@ public:
/**
* @brief VGraphicsFillItem Constructor
*/
VGraphicsFillItem(QGraphicsItem *parent = nullptr);
explicit VGraphicsFillItem(QGraphicsItem *parent = nullptr);
/**
* @brief ~VGraphicsFillItem Destructor
*/

View File

@ -34,6 +34,39 @@
#include <QDataStream>
#include <QtNumeric>
namespace
{
//---------------------------------------------------------------------------------------------------------------------
qreal EvalFormula(const VContainer *data, QString formula)
{
if (formula.isEmpty())
{
return -1;
}
else
{
try
{
// Replace line return character with spaces for calc if exist
formula.replace("\n", " ");
QScopedPointer<Calculator> cal(new Calculator());
const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
if (qIsInf(result) || qIsNaN(result))
{
return -1;
}
return result;
}
catch (qmu::QmuParserError &e)
{
Q_UNUSED(e)
return -1;
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
VPieceNode::VPieceNode()
: d(new VPieceNodeData)
@ -182,36 +215,6 @@ void VPieceNode::SetAngleType(PieceNodeAngle type)
}
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPieceNode::EvalFormula(const VContainer *data, QString formula) const
{
if (formula.isEmpty())
{
return -1;
}
else
{
try
{
// Replace line return character with spaces for calc if exist
formula.replace("\n", " ");
QScopedPointer<Calculator> cal(new Calculator());
const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
if (qIsInf(result) || qIsNaN(result))
{
return -1;
}
return result;
}
catch (qmu::QmuParserError &e)
{
Q_UNUSED(e)
return -1;
}
}
}
// Friend functions
//---------------------------------------------------------------------------------------------------------------------
QDataStream& operator<<(QDataStream& out, const VPieceNode& p)

View File

@ -76,8 +76,6 @@ public:
void SetAngleType(PieceNodeAngle type);
private:
QSharedDataPointer<VPieceNodeData> d;
qreal EvalFormula(const VContainer *data, QString formula) const;
};
Q_DECLARE_METATYPE(VPieceNode)