cppcheck.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-12 14:52:48 +03:00
parent 8b6dbc0463
commit be398bae93
83 changed files with 304 additions and 302 deletions

View File

@ -42,7 +42,7 @@ class TapeConfigurationPage : public QWidget
{
Q_OBJECT
public:
TapeConfigurationPage(QWidget *parent = nullptr);
explicit TapeConfigurationPage(QWidget *parent = nullptr);
void Apply();
public slots:
void LangChanged();

View File

@ -40,7 +40,7 @@ class TapePathPage : public QWidget
{
Q_OBJECT
public:
TapePathPage(QWidget *parent = nullptr);
explicit TapePathPage(QWidget *parent = nullptr);
void Apply();
public slots:
void TableActivated();

View File

@ -183,6 +183,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress uninitMemberVar
MApplication::MApplication(int &argc, char **argv)
:VAbstractApplication(argc, argv),
mainWindows(),

View File

@ -35,7 +35,7 @@ class VLitePattern : public VAbstractPattern
{
Q_OBJECT
public:
VLitePattern(QObject *parent = nullptr);
explicit VLitePattern(QObject *parent = nullptr);
virtual void CreateEmptyFile() Q_DECL_OVERRIDE;

View File

@ -35,7 +35,7 @@
class VTableSearch
{
public:
VTableSearch(QTableWidget *table);
explicit VTableSearch(QTableWidget *table);
void Find(const QString &term);
void FindPrevious();

View File

@ -581,7 +581,9 @@ QStringList VApplication::LabelLanguages()
void VApplication::StartLogging()
{
CreateLogDir();
// cppcheck-suppress leakReturnValNotUsed
BeginLogging();
// cppcheck-suppress leakReturnValNotUsed
ClearOldLogs();
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
ClearOldReports();
@ -786,6 +788,7 @@ void VApplication::CollectReport(const QString &reportName) const
reportFile.remove(); // Clear after yourself
filename = QString("%1/reports/log-%2.log").arg(qApp->applicationDirPath()).arg(timestamp);
// cppcheck-suppress leakReturnValNotUsed
GatherLogs();
QFile logFile(QString("%1/valentina.log").arg(LogDirPath()));
logFile.copy(filename); // Collect log
@ -849,6 +852,7 @@ void VApplication::SendReport(const QString &reportName) const
content.append(QString("\r\n-------------------------------\r\n"));
content.append(QString("Log:")+"\r\n");
// cppcheck-suppress leakReturnValNotUsed
GatherLogs();
QFile logFile(QString("%1/valentina.log").arg(LogDirPath()));
if (logFile.open(QIODevice::ReadOnly | QIODevice::Text))

View File

@ -37,7 +37,7 @@ class VFormulaProperty : public VPE::VProperty
{
Q_OBJECT
public:
VFormulaProperty(const QString &name);
explicit VFormulaProperty(const QString &name);
//! Get the data how it should be displayed
virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;

View File

@ -43,7 +43,7 @@ class VFormulaPropertyEditor : public QWidget
public:
//! Constructor taking a widget as parent
VFormulaPropertyEditor(QWidget *parent);
explicit VFormulaPropertyEditor(QWidget *parent);
//! Destructor
virtual ~VFormulaPropertyEditor() Q_DECL_OVERRIDE;

View File

@ -45,7 +45,7 @@ class VToolOptionsPropertyBrowser : public QObject
{
Q_OBJECT
public:
VToolOptionsPropertyBrowser(QDockWidget *parent);
explicit VToolOptionsPropertyBrowser(QDockWidget *parent);
void ClearPropertyBrowser();
public slots:
void itemClicked(QGraphicsItem *item);

View File

@ -41,7 +41,7 @@ class CommunityPage : public QWidget
{
Q_OBJECT
public:
CommunityPage(QWidget *parent = nullptr);
explicit CommunityPage(QWidget *parent = nullptr);
void Apply();
private:
Q_DISABLE_COPY(CommunityPage)

View File

@ -41,7 +41,7 @@ class ConfigurationPage : public QWidget
{
Q_OBJECT
public:
ConfigurationPage(QWidget *parent = nullptr);
explicit ConfigurationPage(QWidget *parent = nullptr);
void Apply();
public slots:
void LangChanged();

View File

@ -40,7 +40,7 @@ class PathPage : public QWidget
{
Q_OBJECT
public:
PathPage(QWidget *parent = nullptr);
explicit PathPage(QWidget *parent = nullptr);
void Apply();
public slots:
void TableActivated();

View File

@ -41,7 +41,7 @@ class PatternPage : public QWidget
{
Q_OBJECT
public:
PatternPage(QWidget *parent = nullptr);
explicit PatternPage(QWidget *parent = nullptr);
void Apply();
private:
Q_DISABLE_COPY(PatternPage)

View File

@ -46,7 +46,7 @@ class MainWindowsNoGUI : public QMainWindow
{
Q_OBJECT
public:
MainWindowsNoGUI(QWidget *parent = nullptr);
explicit MainWindowsNoGUI(QWidget *parent = nullptr);
virtual ~MainWindowsNoGUI() Q_DECL_OVERRIDE;
public slots:

View File

@ -906,14 +906,14 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
VToolBasePoint *spoint = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const qreal x = qApp->toPixel(GetParametrDouble(domElement, AttrX, "10.0"));
const qreal y = qApp->toPixel(GetParametrDouble(domElement, AttrY, "10.0"));
@ -951,15 +951,15 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
@ -1000,15 +1000,15 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1044,15 +1044,15 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1089,15 +1089,15 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1134,15 +1134,15 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const QString formula = GetParametrString(domElement, AttrLength, "100.0");
QString f = formula;//need for saving fixed formula;
@ -1179,13 +1179,13 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 p1Line1Id = GetParametrUInt(domElement, AttrP1Line1, NULL_ID_STR);
const quint32 p2Line1Id = GetParametrUInt(domElement, AttrP2Line1, NULL_ID_STR);
@ -1209,13 +1209,13 @@ void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &d
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const QString radius = GetParametrString(domElement, AttrRadius, "0");
QString f = radius;//need for saving fixed formula;
@ -1251,12 +1251,12 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
{
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, mx, my);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR);
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
@ -1279,15 +1279,15 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
const quint32 p1LineId = GetParametrUInt(domElement, AttrP1Line, NULL_ID_STR);
@ -1310,13 +1310,13 @@ void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &d
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 axisP1Id = GetParametrUInt(domElement, AttrAxisP1, NULL_ID_STR);
const quint32 axisP2Id = GetParametrUInt(domElement, AttrAxisP2, NULL_ID_STR);
@ -1341,13 +1341,13 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 firstPointId = GetParametrUInt(domElement, AttrFirstPoint, NULL_ID_STR);
const quint32 secondPointId = GetParametrUInt(domElement, AttrSecondPoint, NULL_ID_STR);
@ -1369,13 +1369,13 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
@ -1412,13 +1412,13 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
@ -1456,13 +1456,13 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const QString formula = GetParametrString(domElement, AttrLength, "0");
QString f = formula;//need for saving fixed formula;
@ -1498,15 +1498,15 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
@ -1548,15 +1548,15 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
QString typeLine;
QString lineColor;
PointsCommonAttributes(domElement, id, name, mx, my, typeLine, lineColor);
const quint32 basePointId = GetParametrUInt(domElement, AttrBasePoint, NULL_ID_STR);
@ -1596,13 +1596,13 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 firstArcId = GetParametrUInt(domElement, AttrFirstArc, NULL_ID_STR);
const quint32 secondArcId = GetParametrUInt(domElement, AttrSecondArc, NULL_ID_STR);
@ -1628,13 +1628,13 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 c1CenterId = GetParametrUInt(domElement, AttrC1Center, NULL_ID_STR);
const quint32 c2CenterId = GetParametrUInt(domElement, AttrC2Center, NULL_ID_STR);
@ -1670,13 +1670,13 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 cCenterId = GetParametrUInt(domElement, AttrCCenter, NULL_ID_STR);
const quint32 tangentId = GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
@ -1710,13 +1710,13 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
try
{
quint32 id = 0;
QString name;
qreal mx = 0;
qreal my = 0;
PointsCommonAttributes(domElement, id, name, mx, my);
const quint32 arcId = GetParametrUInt(domElement, AttrArc, NULL_ID_STR);
const quint32 tangentId = GetParametrUInt(domElement, AttrTangent, NULL_ID_STR);
@ -1741,10 +1741,10 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 p1Id = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR);
@ -1783,10 +1783,10 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, const QDomElement &dom
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 point1 = GetParametrUInt(domElement, AttrPoint1, NULL_ID_STR);
const quint32 point4 = GetParametrUInt(domElement, AttrPoint4, NULL_ID_STR);
@ -1814,10 +1814,10 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const qreal kCurve = GetParametrDouble(domElement, AttrKCurve, "1.0");
const QString color = GetParametrString(domElement, AttrColor, ColorBlack);
@ -1866,12 +1866,12 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
{
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
quint32 idObject = 0;
quint32 idTool = 0;
try
{
quint32 id = 0;
quint32 idObject = 0;
quint32 idTool = 0;
SplinesCommonAttributes(domElement, id, idObject, idTool);
VSpline *spl = new VSpline(*data->GeometricObject<VSpline>(idObject));
spl->setIdObject(idObject);
@ -1892,12 +1892,12 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document
{
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
quint32 idObject = 0;
quint32 idTool = 0;
try
{
quint32 id = 0;
quint32 idObject = 0;
quint32 idTool = 0;
SplinesCommonAttributes(domElement, id, idObject, idTool);
VSplinePath *path = new VSplinePath(*data->GeometricObject<VSplinePath>(idObject));
path->setIdObject(idObject);
@ -1919,10 +1919,10 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
const QString radius = GetParametrString(domElement, AttrRadius, "10");
@ -1962,10 +1962,10 @@ void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse
{
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, NULL_ID_STR);
const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR);
@ -1989,10 +1989,10 @@ void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &do
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 center = GetParametrUInt(domElement, AttrCenter, NULL_ID_STR);
const QString radius = GetParametrString(domElement, AttrRadius, "10");

View File

@ -43,7 +43,7 @@ class VException : public QException
{
Q_DECLARE_TR_FUNCTIONS(VException)
public:
VException(const QString &what);
explicit VException(const QString &what);
VException(const VException &e);
VException &operator=(const VException &e);
virtual ~VException() V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE {}

View File

@ -34,7 +34,7 @@
class VExceptionUndo : public VException
{
public:
VExceptionUndo(const QString &what);
explicit VExceptionUndo(const QString &what);
VExceptionUndo(const VExceptionUndo &e);
virtual ~VExceptionUndo() V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE;
};

View File

@ -35,7 +35,7 @@ class VAbstractConverter :public VDomDocument
{
Q_DECLARE_TR_FUNCTIONS(VAbstractConverter)
public:
VAbstractConverter(const QString &fileName);
explicit VAbstractConverter(const QString &fileName);
virtual ~VAbstractConverter() Q_DECL_OVERRIDE;
void Convert();

View File

@ -34,7 +34,7 @@
class VAbstractMConverter : public VAbstractConverter
{
public:
VAbstractMConverter(const QString &fileName);
explicit VAbstractMConverter(const QString &fileName);
virtual ~VAbstractMConverter() Q_DECL_OVERRIDE;
protected:

View File

@ -45,7 +45,7 @@ class VAbstractPattern : public QObject, public VDomDocument
{
Q_OBJECT
public:
VAbstractPattern(QObject *parent = nullptr);
explicit VAbstractPattern(QObject *parent = nullptr);
virtual ~VAbstractPattern() Q_DECL_OVERRIDE;
QStringList ListMeasurements() const;

View File

@ -35,7 +35,7 @@ class VPatternConverter : public VAbstractConverter
{
Q_DECLARE_TR_FUNCTIONS(VPatternConverter)
public:
VPatternConverter(const QString &fileName);
explicit VPatternConverter(const QString &fileName);
virtual ~VPatternConverter() Q_DECL_OVERRIDE;
static const QString PatternMaxVerStr;

View File

@ -35,7 +35,7 @@ class VVITConverter : public VAbstractMConverter
{
Q_DECLARE_TR_FUNCTIONS(VVITConverter)
public:
VVITConverter(const QString &fileName);
explicit VVITConverter(const QString &fileName);
virtual ~VVITConverter() Q_DECL_OVERRIDE;
static const QString MeasurementMaxVerStr;

View File

@ -35,7 +35,7 @@ class VVSTConverter : public VAbstractMConverter
{
Q_DECLARE_TR_FUNCTIONS(VVSTConverter)
public:
VVSTConverter(const QString &fileName);
explicit VVSTConverter(const QString &fileName);
virtual ~VVSTConverter() Q_DECL_OVERRIDE;
static const QString MeasurementMaxVerStr;

View File

@ -134,7 +134,7 @@ qreal QmuParser::FMod(qreal number, qreal denom)
*/
qreal QmuParser::Sum(const qreal *a_afArg, int a_iArgc)
{
if (a_iArgc == false)
if (a_iArgc == 0)
{
throw QmuParserError("too few arguments for function sum.");
}
@ -154,7 +154,7 @@ qreal QmuParser::Sum(const qreal *a_afArg, int a_iArgc)
*/
qreal QmuParser::Avg(const qreal *a_afArg, int a_iArgc)
{
if (a_iArgc == false)
if (a_iArgc == 0)
{
throw QmuParserError("too few arguments for function sum.");
}
@ -174,7 +174,7 @@ qreal QmuParser::Avg(const qreal *a_afArg, int a_iArgc)
*/
qreal QmuParser::Min(const qreal *a_afArg, int a_iArgc)
{
if (a_iArgc == false)
if (a_iArgc == 0)
{
throw QmuParserError("too few arguments for function min.");
}
@ -194,7 +194,7 @@ qreal QmuParser::Min(const qreal *a_afArg, int a_iArgc)
*/
qreal QmuParser::Max(const qreal *a_afArg, int a_iArgc)
{
if (a_iArgc == false)
if (a_iArgc == 0)
{
throw QmuParserError("too few arguments for function min.");
}

View File

@ -331,6 +331,7 @@ void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallbac
*
* @throw ParserException if the name contains invalid charakters.
*/
// cppcheck-suppress
void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback,
const QString &a_szCharSet) const
{
@ -361,6 +362,7 @@ void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a
*
* @throw ParserException if the name contains invalid charakters.
*/
// cppcheck-suppress
void QmuParserBase::CheckName(const QString &a_sName, const QString &a_szCharSet) const
{
std::wstring a_sNameStd = a_sName.toStdWString();

View File

@ -54,7 +54,7 @@ class QMUPARSERSHARED_EXPORT QmuParserBase
friend class QmuParserTokenReader;
public:
QmuParserBase();
QmuParserBase(const QmuParserBase &a_Parser);
explicit QmuParserBase(const QmuParserBase &a_Parser);
QmuParserBase& operator=(const QmuParserBase &a_Parser);
virtual ~QmuParserBase();
@ -248,7 +248,9 @@ private:
qreal ParseString() const;
qreal ParseCmdCode() const;
qreal ParseCmdCodeBulk(int nOffset, int nThreadID) const;
// cppcheck-suppress functionStatic
void CheckName(const QString &a_strName, const QString &a_CharSet) const;
// cppcheck-suppress functionStatic
void CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback,
const QString &a_szCharSet) const;
void StackDump(const QStack<token_type > &a_stVal, const QStack<token_type > &a_stOprt) const;

View File

@ -34,7 +34,6 @@ namespace qmu
/**
* @brief Bytecode default constructor.
*/
// cppcheck-suppress uninitMemberVar
QmuParserByteCode::QmuParserByteCode()
:m_iStackPos(0), m_iMaxStackSize(0), m_vRPN(), m_bEnableOptimizer(true)
{
@ -47,7 +46,6 @@ QmuParserByteCode::QmuParserByteCode()
*
* Implemented in Terms of Assign(const QParserByteCode &a_ByteCode)
*/
// cppcheck-suppress uninitMemberVar
QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode)
:m_iStackPos(a_ByteCode.m_iStackPos), m_iMaxStackSize(a_ByteCode.m_iMaxStackSize), m_vRPN(a_ByteCode.m_vRPN),
m_bEnableOptimizer(true)
@ -61,7 +59,6 @@ QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode)
*
* Implemented in Terms of Assign(const QParserByteCode &a_ByteCode)
*/
// cppcheck-suppress operatorEqVarError
QmuParserByteCode& QmuParserByteCode::operator=(const QmuParserByteCode &a_ByteCode)
{
Assign(a_ByteCode);

View File

@ -184,7 +184,7 @@ private:
static qreal FirstArg ( const qreal* a_afArg, int a_iArgc )
{
if ( a_iArgc == false)
if ( a_iArgc == 0)
{
throw QmuParserError ( "too few arguments for function FirstArg." );
}
@ -194,7 +194,7 @@ private:
static qreal LastArg ( const qreal* a_afArg, int a_iArgc )
{
if ( a_iArgc == false)
if ( a_iArgc == 0)
{
throw QmuParserError ( "too few arguments for function LastArg." );
}
@ -204,7 +204,7 @@ private:
static qreal Sum ( const qreal* a_afArg, int a_iArgc )
{
if ( a_iArgc == false)
if ( a_iArgc == 0)
{
throw QmuParserError ( "too few arguments for function sum." );
}

View File

@ -335,6 +335,7 @@ public:
FunctionPtr func;
} var;
// cppcheck-suppress duplicateExpression
Q_STATIC_ASSERT_X(sizeof(void *) == sizeof(void (*)(void)),
"object pointer and function pointer sizes must equal");

View File

@ -44,7 +44,7 @@ class QmuParserTokenReader
private:
typedef QmuParserToken<qreal, QString> token_type;
public:
QmuParserTokenReader(QmuParserBase *a_pParent);
explicit QmuParserTokenReader(QmuParserBase *a_pParent);
QmuParserTokenReader* Clone(QmuParserBase *a_pParent) const;
void AddValIdent(identfun_type a_pCallback);

View File

@ -237,7 +237,7 @@ public:
inPaperSpace = on;
}
bool isInPaperSpace()
bool isInPaperSpace() const
{
return inPaperSpace;
}

View File

@ -346,7 +346,7 @@ public:
}
/** @return the current attributes used for new entities. */
DL_Attributes getAttributes()
DL_Attributes getAttributes() const
{
return attributes;
}

View File

@ -68,7 +68,7 @@ DL_Dxf::DL_Dxf()
firstHatchLoop(), hatchEdge(), hatchEdges(),
xRecordHandle(), xRecordValues(), groupCodeTmp(), groupCode(), groupValue(),
currentObjectType(), settingKey(), values(), firstCall(), attrib(),
currentObjectType(), settingValue(), settingKey(), values(), firstCall(), attrib(),
libVersion(), appDictionaryHandle(), styleHandleStd()
{
}
@ -189,18 +189,13 @@ bool DL_Dxf::in(std::stringstream& stream,
*/
bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
{
static int line = 1;
// Read one group of the DXF file and strip the lines:
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, fp) &&
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, fp) )
{
groupCode = static_cast<unsigned int>(toInt(groupCodeTmp));
creationInterface->processCodeValuePair(groupCode, groupValue);
line+=2;
processDXFGroup(creationInterface, groupCode, groupValue);
}
@ -215,17 +210,12 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
bool DL_Dxf::readDxfGroups(std::stringstream& stream,
DL_CreationInterface* creationInterface)
{
static int line = 1;
// Read one group of the DXF file and chop the lines:
if (DL_Dxf::getStrippedLine(groupCodeTmp, DL_DXF_MAXLINE, stream) &&
DL_Dxf::getStrippedLine(groupValue, DL_DXF_MAXLINE, stream) )
{
groupCode = static_cast<unsigned int>(toInt(groupCodeTmp));
line+=2;
processDXFGroup(creationInterface, groupCode, groupValue);
}
return !stream.eof();
@ -2593,7 +2583,7 @@ DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version)
* @brief Writes a DXF header to the file currently opened
* by the given DXF writer object.
*/
void DL_Dxf::writeHeader(DL_WriterA& dw)
void DL_Dxf::writeHeader(DL_WriterA& dw) const
{
dw.comment("dxflib " DL_VERSION);
dw.sectionHeader();
@ -2800,7 +2790,7 @@ void DL_Dxf::writeVertex(DL_WriterA& dw,
/**
* Writes the polyline end. Only needed for DXF R12.
*/
void DL_Dxf::writePolylineEnd(DL_WriterA& dw)
void DL_Dxf::writePolylineEnd(DL_WriterA& dw) const
{
if (version==DL_VERSION_2000)
{
@ -3248,7 +3238,7 @@ void DL_Dxf::writeAttribute(DL_WriterA& dw,
}
void DL_Dxf::writeDimStyleOverrides(DL_WriterA& dw,
const DL_DimensionData& data)
const DL_DimensionData& data) const
{
if (version==DL_VERSION_2000)
@ -3781,7 +3771,7 @@ void DL_Dxf::writeLeader(DL_WriterA& dw,
* @param data Entity data
*/
void DL_Dxf::writeLeaderVertex(DL_WriterA& dw,
const DL_LeaderVertexData& data)
const DL_LeaderVertexData& data) const
{
if (version>DL_VERSION_R12)
{
@ -3843,7 +3833,7 @@ void DL_Dxf::writeHatch1(DL_WriterA& dw,
*/
void DL_Dxf::writeHatch2(DL_WriterA& dw,
const DL_HatchData& data,
const DL_Attributes& /*attrib*/)
const DL_Attributes& /*attrib*/) const
{
dw.dxfInt(75, 0); // odd parity
@ -4076,7 +4066,7 @@ int DL_Dxf::writeImage(DL_WriterA& dw,
*/
void DL_Dxf::writeImageDef(DL_WriterA& dw,
int handle,
const DL_ImageData& data)
const DL_ImageData& data) const
{
/*if (data.file.empty()) {
@ -4187,7 +4177,7 @@ void DL_Dxf::writeLayer(DL_WriterA& dw,
* tables section of a DXF file.
*/
void DL_Dxf::writeLinetype(DL_WriterA& dw,
const DL_LinetypeData& data)
const DL_LinetypeData& data) const
{
std::string nameUpper = data.name;
@ -4376,7 +4366,7 @@ void DL_Dxf::writeEndBlock(DL_WriterA& dw, const std::string& name)
* Note that this method currently only writes a faked VPORT section
* to make the file readable by Aut*cad.
*/
void DL_Dxf::writeVPort(DL_WriterA& dw)
void DL_Dxf::writeVPort(DL_WriterA& dw) const
{
dw.dxfString(0, "TABLE");
dw.dxfString(2, "VPORT");
@ -4533,7 +4523,7 @@ void DL_Dxf::writeStyle(DL_WriterA& dw, const DL_StyleData& style)
* Note that this method currently only writes a faked VIEW section
* to make the file readable by Aut*cad.
*/
void DL_Dxf::writeView(DL_WriterA& dw)
void DL_Dxf::writeView(DL_WriterA& dw) const
{
dw.dxfString( 0, "TABLE");
dw.dxfString( 2, "VIEW");
@ -4557,7 +4547,7 @@ void DL_Dxf::writeView(DL_WriterA& dw)
* Note that this method currently only writes a faked UCS section
* to make the file readable by Aut*cad.
*/
void DL_Dxf::writeUcs(DL_WriterA& dw)
void DL_Dxf::writeUcs(DL_WriterA& dw) const
{
dw.dxfString( 0, "TABLE");
dw.dxfString( 2, "UCS");
@ -4701,7 +4691,7 @@ void DL_Dxf::writeDimStyle(DL_WriterA& dw,
* Note that this method currently only writes a faked BLOCKRECORD section
* to make the file readable by Aut*cad.
*/
void DL_Dxf::writeBlockRecord(DL_WriterA& dw)
void DL_Dxf::writeBlockRecord(DL_WriterA& dw) const
{
dw.dxfString( 0, "TABLE");
dw.dxfString( 2, "BLOCK_RECORD");
@ -4772,7 +4762,7 @@ void DL_Dxf::writeBlockRecord(DL_WriterA& dw)
/**
* Writes a single block record with the given name.
*/
void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name)
void DL_Dxf::writeBlockRecord(DL_WriterA& dw, const std::string& name) const
{
dw.dxfString( 0, "BLOCK_RECORD");
if (version==DL_VERSION_2000)
@ -5815,9 +5805,6 @@ int DL_Dxf::getLibVersion(const std::string& str)
{
int d[4];
int idx = 0;
//char v[4][5];
std::string v[4];
int ret = 0;
for (unsigned int i=0; i<str.length() && idx<3; ++i)
{
@ -5832,6 +5819,8 @@ int DL_Dxf::getLibVersion(const std::string& str)
{
d[3] = static_cast<int>(str.length());
std::string v[4];
v[0] = str.substr(0, d[0]);
v[1] = str.substr(d[0]+1, d[1]-d[0]-1);
v[2] = str.substr(d[1]+1, d[2]-d[1]-1);
@ -5844,10 +5833,10 @@ int DL_Dxf::getLibVersion(const std::string& str)
v[3] = "0";
}
ret = (atoi(v[0].c_str())<<(3*8)) +
(atoi(v[1].c_str())<<(2*8)) +
(atoi(v[2].c_str())<<(1*8)) +
(atoi(v[3].c_str())<<(0*8));
const int ret = (atoi(v[0].c_str())<<(3*8)) +
(atoi(v[1].c_str())<<(2*8)) +
(atoi(v[2].c_str())<<(1*8)) +
(atoi(v[3].c_str())<<(0*8));
return ret;
}

View File

@ -143,7 +143,7 @@ public:
void addLayer(DL_CreationInterface* creationInterface);
void addLinetype(DL_CreationInterface *creationInterface);
void addBlock(DL_CreationInterface* creationInterface);
void endBlock(DL_CreationInterface* creationInterface);
static void endBlock(DL_CreationInterface* creationInterface);
void addTextStyle(DL_CreationInterface* creationInterface);
void addPoint(DL_CreationInterface* creationInterface);
@ -189,7 +189,7 @@ public:
void addImage(DL_CreationInterface* creationInterface);
void addImageDef(DL_CreationInterface* creationInterface);
void addComment(DL_CreationInterface* creationInterface, const std::string& comment);
static void addComment(DL_CreationInterface* creationInterface, const std::string& comment);
void addDictionary(DL_CreationInterface* creationInterface);
void addDictionaryEntry(DL_CreationInterface* creationInterface);
@ -204,16 +204,16 @@ public:
bool handleLeaderData(DL_CreationInterface* creationInterface);
bool handleLinetypeData(DL_CreationInterface* creationInterface);
void endEntity(DL_CreationInterface* creationInterface);
static void endEntity(DL_CreationInterface* creationInterface);
void endSequence(DL_CreationInterface* creationInterface);
static void endSequence(DL_CreationInterface* creationInterface);
//int stringToInt(const char* s, bool* ok=NULL);
DL_WriterA* out(const char* file,
DL_Codes::version version=DL_VERSION_2000);
void writeHeader(DL_WriterA& dw);
void writeHeader(DL_WriterA& dw) const;
void writePoint(DL_WriterA& dw,
const DL_PointData& data,
@ -232,16 +232,16 @@ public:
const DL_Attributes& attrib);
void writeVertex(DL_WriterA& dw,
const DL_VertexData& data);
void writePolylineEnd(DL_WriterA& dw);
void writePolylineEnd(DL_WriterA& dw) const;
void writeSpline(DL_WriterA& dw,
const DL_SplineData& data,
const DL_Attributes& attrib);
void writeControlPoint(DL_WriterA& dw,
const DL_ControlPointData& data);
void writeFitPoint(DL_WriterA& dw,
const DL_FitPointData& data);
void writeKnot(DL_WriterA& dw,
const DL_KnotData& data);
static void writeControlPoint(DL_WriterA& dw,
const DL_ControlPointData& data);
static void writeFitPoint(DL_WriterA& dw,
const DL_FitPointData& data);
static void writeKnot(DL_WriterA& dw,
const DL_KnotData& data);
void writeCircle(DL_WriterA& dw,
const DL_CircleData& data,
const DL_Attributes& attrib);
@ -273,7 +273,7 @@ public:
const DL_AttributeData& data,
const DL_Attributes& attrib);
void writeDimStyleOverrides(DL_WriterA& dw,
const DL_DimensionData& data);
const DL_DimensionData& data) const;
void writeDimAligned(DL_WriterA& dw,
const DL_DimensionData& data,
const DL_DimAlignedData& edata,
@ -306,59 +306,59 @@ public:
const DL_LeaderData& data,
const DL_Attributes& attrib);
void writeLeaderVertex(DL_WriterA& dw,
const DL_LeaderVertexData& data);
const DL_LeaderVertexData& data) const;
void writeHatch1(DL_WriterA& dw,
const DL_HatchData& data,
const DL_Attributes& attrib);
void writeHatch2(DL_WriterA& dw,
const DL_HatchData& data,
const DL_Attributes& attrib);
void writeHatchLoop1(DL_WriterA& dw,
const DL_HatchLoopData& data);
void writeHatchLoop2(DL_WriterA& dw,
const DL_HatchLoopData& data);
void writeHatchEdge(DL_WriterA& dw,
const DL_HatchEdgeData& data);
const DL_Attributes& attrib) const;
static void writeHatchLoop1(DL_WriterA& dw,
const DL_HatchLoopData& data);
static void writeHatchLoop2(DL_WriterA& dw,
const DL_HatchLoopData& data);
static void writeHatchEdge(DL_WriterA& dw,
const DL_HatchEdgeData& data);
int writeImage(DL_WriterA& dw,
const DL_ImageData& data,
const DL_Attributes& attrib);
void writeImageDef(DL_WriterA& dw, int handle,
const DL_ImageData& data);
const DL_ImageData& data) const;
void writeLayer(DL_WriterA& dw,
const DL_LayerData& data,
const DL_Attributes& attrib);
void writeLinetype(DL_WriterA& dw,
const DL_LinetypeData& data);
const DL_LinetypeData& data) const;
void writeAppid(DL_WriterA& dw, const std::string& name);
static void writeAppid(DL_WriterA& dw, const std::string& name);
void writeBlock(DL_WriterA& dw,
const DL_BlockData& data);
void writeEndBlock(DL_WriterA& dw, const std::string& name);
static void writeBlock(DL_WriterA& dw,
const DL_BlockData& data);
static void writeEndBlock(DL_WriterA& dw, const std::string& name);
void writeVPort(DL_WriterA& dw);
void writeVPort(DL_WriterA& dw) const;
void writeStyle(DL_WriterA& dw, const DL_StyleData& style);
void writeView(DL_WriterA& dw);
void writeUcs(DL_WriterA& dw);
void writeView(DL_WriterA& dw) const;
void writeUcs(DL_WriterA& dw) const;
void writeDimStyle(DL_WriterA& dw,
double dimasz, double dimexe, double dimexo,
double dimgap, double dimtxt);
void writeBlockRecord(DL_WriterA& dw);
void writeBlockRecord(DL_WriterA& dw, const std::string& name);
void writeBlockRecord(DL_WriterA& dw) const;
void writeBlockRecord(DL_WriterA& dw, const std::string& name) const;
void writeObjects(DL_WriterA& dw, const std::string& appDictionaryName = "");
void writeAppDictionary(DL_WriterA& dw);
int writeDictionaryEntry(DL_WriterA& dw, const std::string& name);
static int writeDictionaryEntry(DL_WriterA& dw, const std::string& name);
void writeXRecord(DL_WriterA& dw, int handle, int value);
void writeXRecord(DL_WriterA& dw, int handle, double value);
void writeXRecord(DL_WriterA& dw, int handle, bool value);
void writeXRecord(DL_WriterA& dw, int handle, const std::string& value);
void writeObjectsEnd(DL_WriterA& dw);
static void writeObjectsEnd(DL_WriterA& dw);
void writeComment(DL_WriterA& dw, const std::string& comment);
static void writeComment(DL_WriterA& dw, const std::string& comment);
/**
* Converts the given string into a double or returns the given
@ -392,12 +392,12 @@ public:
static bool checkVariable(const char* var, DL_Codes::version version);
DL_Codes::version getVersion()
DL_Codes::version getVersion() const
{
return version;
}
int getLibVersion(const std::string &str);
static int getLibVersion(const std::string &str);
static void test();
@ -415,13 +415,13 @@ public:
return toInt(values[code]);
}
int toInt(const std::string& str)
static int toInt(const std::string& str)
{
char* p;
return static_cast<int>(strtol(str.c_str(), &p, 10));
}
bool toBool(const std::string& str)
static bool toBool(const std::string& str)
{
char* p;
return static_cast<bool>(strtol(str.c_str(), &p, 10));
@ -445,7 +445,7 @@ public:
return toReal(values[code]);
}
double toReal(const std::string& str)
static double toReal(const std::string& str)
{
double ret;
// make sure the real value uses '.' not ',':

View File

@ -568,7 +568,7 @@ struct DXFLIB_EXPORT DL_KnotData
* Constructor.
* Parameters: see member variables.
*/
DL_KnotData(double pk)
explicit DL_KnotData(double pk)
: k(pk)
{
}
@ -1425,7 +1425,7 @@ struct DXFLIB_EXPORT DL_HatchLoopData
* Constructor.
* Parameters: see member variables.
*/
DL_HatchLoopData(int hNumEdges)
explicit DL_HatchLoopData(int hNumEdges)
: numEdges(hNumEdges)
{
}
@ -1725,7 +1725,7 @@ struct DXFLIB_EXPORT DL_ImageDefData
*/
struct DXFLIB_EXPORT DL_DictionaryData
{
DL_DictionaryData(const std::string& handle) : handle(handle) {}
explicit DL_DictionaryData(const std::string& handle) : handle(handle) {}
std::string handle;
};

View File

@ -59,8 +59,9 @@ public:
}
DL_Extrusion(const DL_Extrusion &L)
: direction(L.direction), elevation(L.elevation)
: direction(new double[3]), elevation(L.elevation)
{
setDirection(L.direction[0], L.direction[1], L.direction[0]);
}
/**

View File

@ -62,7 +62,8 @@ public:
/**
* @param version DXF version. Defaults to DL_VERSION_2002.
*/
DL_Writer(DL_Codes::version version) : m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version)
explicit DL_Writer(DL_Codes::version version)
: m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version)
{
}
@ -616,12 +617,13 @@ public:
* Sets the handle of the model space. Entities refer to
* this handle.
*/
// cppcheck-suppress functionConst
void setModelSpaceHandle(unsigned long h)
{
modelSpaceHandle = h;
}
unsigned long getModelSpaceHandle()
unsigned long getModelSpaceHandle() const
{
return modelSpaceHandle;
}
@ -630,12 +632,13 @@ public:
* Sets the handle of the paper space. Some special blocks refer to
* this handle.
*/
// cppcheck-suppress functionConst
void setPaperSpaceHandle(unsigned long h)
{
paperSpaceHandle = h;
}
unsigned long getPaperSpaceHandle()
unsigned long getPaperSpaceHandle() const
{
return paperSpaceHandle;
}
@ -644,12 +647,13 @@ public:
* Sets the handle of the paper space 0. Some special blocks refer to
* this handle.
*/
// cppcheck-suppress functionConst
void setPaperSpace0Handle(unsigned long h)
{
paperSpace0Handle = h;
}
unsigned long getPaperSpace0Handle()
unsigned long getPaperSpace0Handle() const
{
return paperSpace0Handle;
}

View File

@ -38,7 +38,7 @@ class VMeasurements : public VDomDocument
{
Q_DECLARE_TR_FUNCTIONS(VMeasurements)
public:
VMeasurements(VContainer *data);
explicit VMeasurements(VContainer *data);
VMeasurements(Unit unit, VContainer *data);
VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer *data);
virtual ~VMeasurements() Q_DECL_OVERRIDE;

View File

@ -42,7 +42,7 @@ class VAbstractCurve :public VGObject
{
public:
VAbstractCurve(const GOType &type, const quint32 &idObject = NULL_ID, const Draw &mode = Draw::Calculation);
VAbstractCurve(const VAbstractCurve &curve);
explicit VAbstractCurve(const VAbstractCurve &curve);
VAbstractCurve& operator= (const VAbstractCurve &curve);
virtual QVector<QPointF> GetPoints() const =0;

View File

@ -43,11 +43,12 @@ class VPointF:public VGObject
public:
VPointF ();
VPointF (const VPointF &point );
// cppcheck-suppress noExplicitConstructor
VPointF (const QPointF &point );
VPointF (qreal x, qreal y, const QString &name, qreal mx, qreal my, quint32 idObject = 0,
const Draw &mode = Draw::Calculation);
const Draw &mode = Draw::Calculation);
VPointF (const QPointF &point, const QString &name, qreal mx, qreal my, quint32 idObject = 0,
const Draw &mode = Draw::Calculation);
const Draw &mode = Draw::Calculation);
virtual ~VPointF() Q_DECL_OVERRIDE;
VPointF &operator=(const VPointF &point);
qreal mx() const;

View File

@ -50,7 +50,7 @@ public:
:QSharedData(point), _mx(point._mx), _my(point._my), _x(point._x), _y(point._y)
{}
VPointFData(const QPointF &point)
explicit VPointFData(const QPointF &point)
:_mx(0), _my(0), _x(point.x()), _y(point.y())
{}

View File

@ -371,7 +371,6 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2,
const double da2 = y3 - y1;
d3 = k * (da1*dx + da2*dy);
}
// cppcheck-suppress incorrectLogicOperator
if (d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1)
{
// Simple collinear case, 1---2---3---4

View File

@ -45,7 +45,7 @@ public:
: path(QVector<VSplinePoint>()), kCurve(1)
{}
VSplinePathData(qreal kCurve)
explicit VSplinePathData(qreal kCurve)
: path(QVector<VSplinePoint>()), kCurve(kCurve)
{}

View File

@ -45,7 +45,7 @@ class VAbstractDetail
{
public:
VAbstractDetail();
VAbstractDetail(const QString &name);
explicit VAbstractDetail(const QString &name);
VAbstractDetail(const VAbstractDetail &detail);
VAbstractDetail &operator=(const VAbstractDetail &detail);
virtual ~VAbstractDetail();

View File

@ -44,7 +44,7 @@ public:
:name(QString()), seamAllowance(false), closed(true), width(0)
{}
VAbstractDetailData(const QString &name)
explicit VAbstractDetailData(const QString &name)
:name(name), seamAllowance(false), closed(true), width(0)
{}

View File

@ -44,7 +44,7 @@ class VLayoutGenerator :public QObject
{
Q_OBJECT
public:
VLayoutGenerator(QObject *parent = 0);
explicit VLayoutGenerator(QObject *parent = 0);
virtual ~VLayoutGenerator() Q_DECL_OVERRIDE;
void SetDetails(const QVector<VLayoutDetail> &details);

View File

@ -39,7 +39,7 @@ class VPoster
{
Q_DECLARE_TR_FUNCTIONS(VPoster)
public:
VPoster(const QPrinter *printer);
explicit VPoster(const QPrinter *printer);
QVector<QImage> Generate(const QImage &image, int page, int sheets = 1) const;
private:

View File

@ -75,6 +75,7 @@ private:
std::shared_ptr<QLockFile> lock;
#endif
// cppcheck-suppress functionStatic
bool TryLock(const QString &lockName, int stale, int timeout);
};

View File

@ -48,7 +48,7 @@ VIncrement::VIncrement()
* @param description description of increment
*/
VIncrement::VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula,
bool ok, const QString description)
bool ok, const QString &description)
:VVariable(name, base, description), d(new VIncrementData(data, index, formula, ok))
{
SetType(VarType::Increment);

View File

@ -42,7 +42,7 @@ class VIncrement :public VVariable
public:
VIncrement();
VIncrement(VContainer *data, const QString &name, quint32 index, qreal base, const QString &formula, bool ok,
const QString description = QString());
const QString &description = QString());
VIncrement(const VIncrement &incr);
VIncrement &operator=(const VIncrement &incr);
virtual ~VIncrement() Q_DECL_OVERRIDE;

View File

@ -96,7 +96,7 @@ const QSharedPointer<VGObject> VContainer::GetGObject(quint32 id)const
}
//---------------------------------------------------------------------------------------------------------------------
const QSharedPointer<VGObject> VContainer::GetFakeGObject(quint32 id) const
const QSharedPointer<VGObject> VContainer::GetFakeGObject(quint32 id)
{
VGObject *obj = new VGObject();
obj->setId(id);

View File

@ -103,7 +103,7 @@ public:
template <typename T>
const QSharedPointer<T> GeometricObject(const quint32 &id) const;
const QSharedPointer<VGObject> GetGObject(quint32 id) const;
const QSharedPointer<VGObject> GetFakeGObject(quint32 id) const;
static const QSharedPointer<VGObject> GetFakeGObject(quint32 id);
const VDetail GetDetail(quint32 id) const;
qreal GetTableValue(const QString& name, MeasurementsType patternType) const;
template <typename T>

View File

@ -45,7 +45,7 @@ public:
:_id(NULL_ID), nodes(QVector<VNodeDetail>()), mx(0), my(0)
{}
VDetailData(const QVector<VNodeDetail> &nodes)
explicit VDetailData(const QVector<VNodeDetail> &nodes)
:_id(NULL_ID), nodes(nodes), mx(0), my(0)
{}

View File

@ -34,7 +34,7 @@
class VTranslateVars : public VTranslateMeasurements
{
public:
VTranslateVars(bool osSeparator);
explicit VTranslateVars(bool osSeparator);
virtual ~VTranslateVars() Q_DECL_OVERRIDE;
bool VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const;

View File

@ -42,7 +42,7 @@ namespace Utils
class CheckableMessageBoxPrivate
{
public:
CheckableMessageBoxPrivate(QDialog *q)
explicit CheckableMessageBoxPrivate(QDialog *q)
: pixmapLabel(nullptr), messageLabel(nullptr), checkBox(nullptr), buttonBox(nullptr), clickedButton(nullptr)
{
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);

View File

@ -53,7 +53,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT QVector3DProperty : public VProperty
{
Q_OBJECT
public:
QVector3DProperty(const QString& name);
explicit QVector3DProperty(const QString& name);
virtual ~QVector3DProperty() Q_DECL_OVERRIDE {}

View File

@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VBoolProperty : public VProperty
Q_OBJECT
public:
//! Default constructor
VBoolProperty(const QString& name);
explicit VBoolProperty(const QString& name);
//! Destructor
virtual ~VBoolProperty() Q_DECL_OVERRIDE {}

View File

@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VColorProperty : public VProperty
{
Q_OBJECT
public:
VColorProperty(const QString &name);
explicit VColorProperty(const QString &name);
//! Get the data how it should be displayed
virtual QVariant data (int column = DPC_Name, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;

View File

@ -38,7 +38,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VColorPropertyEditor : public QWidget
public:
//! Constructor taking a widget as parent
VColorPropertyEditor(QWidget *parent);
explicit VColorPropertyEditor(QWidget *parent);
//! Destructor
virtual ~VColorPropertyEditor() Q_DECL_OVERRIDE;

View File

@ -65,7 +65,7 @@ public:
protected:
//! Protected constructor
VEmptyProperty(VPropertyPrivate* d);
explicit VEmptyProperty(VPropertyPrivate* d);
private:
Q_DISABLE_COPY(VEmptyProperty)

View File

@ -33,7 +33,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VEnumProperty : public VProperty
Q_OBJECT
public:
//! Constructor
VEnumProperty(const QString& name);
explicit VEnumProperty(const QString& name);
//! Destructor
virtual ~VEnumProperty() Q_DECL_OVERRIDE {}

View File

@ -34,7 +34,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VFileProperty : public VProperty
{
Q_OBJECT
public:
VFileProperty(const QString &name);
explicit VFileProperty(const QString &name);
//! The destructor
virtual ~VFileProperty() Q_DECL_OVERRIDE;

View File

@ -42,7 +42,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VLineColorProperty : public VProperty
Q_OBJECT
public:
//! Constructor
VLineColorProperty(const QString& name);
explicit VLineColorProperty(const QString& name);
//! Destructor
virtual ~VLineColorProperty() Q_DECL_OVERRIDE {}

View File

@ -43,7 +43,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VLineTypeProperty : public VProperty
Q_OBJECT
public:
//! Constructor
VLineTypeProperty(const QString& name);
explicit VLineTypeProperty(const QString& name);
//! Destructor
virtual ~VLineTypeProperty() Q_DECL_OVERRIDE {}

View File

@ -35,7 +35,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VIntegerProperty : public VProperty
public:
VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings);
VIntegerProperty(const QString& name);
explicit VIntegerProperty(const QString& name);
//! Returns an editor widget, or NULL if it doesn't supply one
//! \param parent The widget to which the editor will be added as a child
@ -89,7 +89,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VDoubleProperty : public VIntegerProperty
public:
VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings);
VDoubleProperty(const QString& name);
explicit VDoubleProperty(const QString& name);
//! Returns an editor widget, or NULL if it doesn't supply one
//! \param parent The widget to which the editor will be added as a child

View File

@ -35,7 +35,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VObjectProperty : public VProperty
Q_OBJECT
public:
//! Constructor
VObjectProperty(const QString& name);
explicit VObjectProperty(const QString& name);
//! Destructor
virtual ~VObjectProperty() Q_DECL_OVERRIDE {}

View File

@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPointFProperty : public VProperty
{
Q_OBJECT
public:
VPointFProperty(const QString& name);
explicit VPointFProperty(const QString& name);
virtual ~VPointFProperty() Q_DECL_OVERRIDE {}

View File

@ -32,7 +32,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VShortcutProperty : public VProperty
{
Q_OBJECT
public:
VShortcutProperty(const QString &name);
explicit VShortcutProperty(const QString &name);
//! The destructor
virtual ~VShortcutProperty() Q_DECL_OVERRIDE;

View File

@ -37,7 +37,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VShortcutEditWidget : public QWidget
Q_OBJECT
public:
VShortcutEditWidget(QWidget* parent);
explicit VShortcutEditWidget(QWidget* parent);
virtual ~VShortcutEditWidget() Q_DECL_OVERRIDE;
//! Needed for proper event handling

View File

@ -35,7 +35,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VStringProperty : public VProperty
public:
VStringProperty(const QString& name, const QMap<QString, QVariant>& settings);
VStringProperty(const QString& name);
explicit VStringProperty(const QString& name);
//! Returns an editor widget, or NULL if it doesn't supply one
//! \param parent The widget to which the editor will be added as a child

View File

@ -203,7 +203,7 @@ signals:
protected:
//! Protected constructor
VProperty(VPropertyPrivate* d);
explicit VProperty(VPropertyPrivate* d);
//! The protected structure holding the member variables (to assure binary compatibility)
VPropertyPrivate* d_ptr;

View File

@ -36,7 +36,7 @@ class VPROPERTYEXPLORERSHARED_EXPORT VPropertyFactoryManager : public QObject
Q_OBJECT
public:
//! Constructor
VPropertyFactoryManager(QObject* parent = nullptr);
explicit VPropertyFactoryManager(QObject* parent = nullptr);
//! Destructor
virtual ~VPropertyFactoryManager() Q_DECL_OVERRIDE;

View File

@ -56,12 +56,12 @@ public:
IgnoreDataChangedSignal(false)
{}
VPropertyFormViewPrivate(VPropertyModel* prop_model)
explicit VPropertyFormViewPrivate(VPropertyModel* prop_model)
: VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false),
IgnoreDataChangedSignal(false)
{}
VPropertyFormViewPrivate(VPropertySet* prop_set)
explicit VPropertyFormViewPrivate(VPropertySet* prop_set)
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false),
IgnoreDataChangedSignal(false)
{}

View File

@ -41,8 +41,8 @@ public:
struct SEditorWidget
{
SEditorWidget() : FormWidget(nullptr), Editor(nullptr) {}
SEditorWidget(VPropertyFormWidget* form_widget) : FormWidget(form_widget), Editor(nullptr) {}
SEditorWidget(QWidget* editor_widget) : FormWidget(nullptr), Editor(editor_widget) {}
explicit SEditorWidget(VPropertyFormWidget* form_widget) : FormWidget(form_widget), Editor(nullptr) {}
explicit SEditorWidget(QWidget* editor_widget) : FormWidget(nullptr), Editor(editor_widget) {}
VPropertyFormWidget* FormWidget;
QWidget* Editor;
@ -64,7 +64,7 @@ public:
{}
//! Constructor
VPropertyFormWidgetPrivate(const QList<VProperty*>& properties)
explicit VPropertyFormWidgetPrivate(const QList<VProperty*>& properties)
: Properties(properties), EditorWidgets(QList<SEditorWidget>()), UpdateEditors(true)
{}

View File

@ -38,7 +38,7 @@ public:
VPropertyDelegate* PropertyDelegate;
//! Constructor
VPropertyTreeViewPrivate(VPropertyDelegate* delegate)
explicit VPropertyTreeViewPrivate(VPropertyDelegate* delegate)
: PropertyDelegate(delegate) {}
//! Constructor

View File

@ -41,7 +41,7 @@ public:
//! Constructor
//! \param manager Registers this factory at the manager for all it's types
VStandardPropertyFactory(VPropertyFactoryManager* manager);
explicit VStandardPropertyFactory(VPropertyFactoryManager* manager);
//! Creates a new property of a certain type and assigns a name and description (otionally)
//! \param type The type of the property as string

View File

@ -43,7 +43,7 @@ class Visualization : public QObject
{
Q_OBJECT
public:
Visualization(const VContainer *data);
explicit Visualization(const VContainer *data);
virtual ~Visualization() Q_DECL_OVERRIDE;
virtual void RefreshGeometry()=0;

View File

@ -40,7 +40,7 @@ class VGraphicsSimpleTextItem : public QObject, public QGraphicsSimpleTextItem
{
Q_OBJECT
public:
VGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr);
explicit VGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr);
VGraphicsSimpleTextItem( const QString & text, QGraphicsItem *parent = nullptr );
virtual ~VGraphicsSimpleTextItem() Q_DECL_OVERRIDE;

View File

@ -69,7 +69,7 @@ class GraphicsViewZoom : public QObject
{
Q_OBJECT
public:
GraphicsViewZoom(QGraphicsView* view);
explicit GraphicsViewZoom(QGraphicsView* view);
void gentle_zoom(double factor);
void set_modifiers(Qt::KeyboardModifiers modifiers);
void set_zoom_factor_base(double value);

View File

@ -51,7 +51,7 @@ public:
If \a parent not specified (default), then popup widget gets
attribute Qt::WA_DeleteOnClose and will be deleted after close.
*/
VWidgetPopup(QWidget *parent = 0);
explicit VWidgetPopup(QWidget *parent = 0);
/** Sets widget to be popped up to \a widget.
If \a own is true then the widget will be reparented to the popup widget.

View File

@ -35,7 +35,7 @@ class TST_TapeCommandLine : public AbstractTest
{
Q_OBJECT
public:
TST_TapeCommandLine(QObject *parent = 0);
explicit TST_TapeCommandLine(QObject *parent = 0);
private slots:
void init();

View File

@ -35,7 +35,7 @@ class TST_ValentinaCommandLine : public AbstractTest
{
Q_OBJECT
public:
TST_ValentinaCommandLine(QObject *parent = 0);
explicit TST_ValentinaCommandLine(QObject *parent = 0);
private slots:
void init();

View File

@ -35,7 +35,7 @@ class TST_VLayoutDetail : public AbstractTest
{
Q_OBJECT
public:
TST_VLayoutDetail(QObject *parent = 0);
explicit TST_VLayoutDetail(QObject *parent = 0);
private slots:
void RemoveDublicates() const;