Refactoring.

Code style.
This commit is contained in:
Roman Telezhynskyi 2023-07-13 17:49:20 +03:00
parent de0ffa0148
commit 161918203a
358 changed files with 4714 additions and 4739 deletions

View file

@ -29,7 +29,6 @@
#ifndef VEXCEPTION_H #ifndef VEXCEPTION_H
#define VEXCEPTION_H #define VEXCEPTION_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QException> #include <QException>
#include <QString> #include <QString>
@ -46,11 +45,12 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
class VException : public QException class VException : public QException
{ {
Q_DECLARE_TR_FUNCTIONS(VException) // NOLINT Q_DECLARE_TR_FUNCTIONS(VException) // NOLINT
public: public:
explicit VException(const QString &error) V_NOEXCEPT_EXPR (true); explicit VException(const QString &error) V_NOEXCEPT_EXPR(true);
VException(const VException &e) V_NOEXCEPT_EXPR (true); VException(const VException &e) V_NOEXCEPT_EXPR(true);
auto operator=(const VException &e) V_NOEXCEPT_EXPR(true) -> VException &; auto operator=(const VException &e) V_NOEXCEPT_EXPR(true) -> VException &;
virtual ~VException() V_NOEXCEPT_EXPR (true) = default; virtual ~VException() V_NOEXCEPT_EXPR(true) = default;
Q_NORETURN virtual void raise() const override; Q_NORETURN virtual void raise() const override;
@ -68,7 +68,7 @@ protected:
QString error; QString error;
/** @brief moreInfo more information about error */ /** @brief moreInfo more information about error */
QString moreInfo {}; QString moreInfo{};
auto MoreInfo(const QString &detInfo) const -> QString; auto MoreInfo(const QString &detInfo) const -> QString;
}; };
@ -99,11 +99,12 @@ inline auto VException::MoreInformation() const -> QString
class VExceptionToolWasDeleted : public VException class VExceptionToolWasDeleted : public VException
{ {
Q_DECLARE_TR_FUNCTIONS(VExceptionToolDeleted) // NOLINT Q_DECLARE_TR_FUNCTIONS(VExceptionToolDeleted) // NOLINT
public: public:
explicit VExceptionToolWasDeleted(const QString &error) V_NOEXCEPT_EXPR (true); explicit VExceptionToolWasDeleted(const QString &error) V_NOEXCEPT_EXPR(true);
VExceptionToolWasDeleted(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR (true); VExceptionToolWasDeleted(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR(true);
auto operator=(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR(true) -> VExceptionToolWasDeleted &; auto operator=(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR(true) -> VExceptionToolWasDeleted &;
virtual ~VExceptionToolWasDeleted() V_NOEXCEPT_EXPR (true) = default; virtual ~VExceptionToolWasDeleted() V_NOEXCEPT_EXPR(true) = default;
Q_NORETURN virtual void raise() const override; Q_NORETURN virtual void raise() const override;
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction

View file

@ -29,7 +29,6 @@
#ifndef VEXCEPTIONBADID_H #ifndef VEXCEPTIONBADID_H
#define VEXCEPTIONBADID_H #define VEXCEPTIONBADID_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
@ -42,11 +41,11 @@
class VExceptionBadId final : public VException class VExceptionBadId final : public VException
{ {
public: public:
VExceptionBadId(const QString &error, const quint32 &id) V_NOEXCEPT_EXPR (true); VExceptionBadId(const QString &error, const quint32 &id) V_NOEXCEPT_EXPR(true);
VExceptionBadId(const QString &error, const QString &key) V_NOEXCEPT_EXPR (true); VExceptionBadId(const QString &error, const QString &key) V_NOEXCEPT_EXPR(true);
VExceptionBadId(const VExceptionBadId &e) V_NOEXCEPT_EXPR (true); VExceptionBadId(const VExceptionBadId &e) V_NOEXCEPT_EXPR(true);
auto operator=(const VExceptionBadId &e) V_NOEXCEPT_EXPR(true) -> VExceptionBadId &; auto operator=(const VExceptionBadId &e) V_NOEXCEPT_EXPR(true) -> VExceptionBadId &;
virtual ~VExceptionBadId() V_NOEXCEPT_EXPR (true) = default; virtual ~VExceptionBadId() V_NOEXCEPT_EXPR(true) = default;
Q_NORETURN virtual void raise() const override { throw *this; } Q_NORETURN virtual void raise() const override { throw *this; }

View file

@ -29,7 +29,7 @@
#ifndef VEXCEPTIONCONVERSIONERROR_H #ifndef VEXCEPTIONCONVERSIONERROR_H
#define VEXCEPTIONCONVERSIONERROR_H #define VEXCEPTIONCONVERSIONERROR_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include "../ifcdef.h" #include "../ifcdef.h"

View file

@ -29,7 +29,7 @@
#ifndef VEXCEPTIONEMPTYPARAMETER_H #ifndef VEXCEPTIONEMPTYPARAMETER_H
#define VEXCEPTIONEMPTYPARAMETER_H #define VEXCEPTIONEMPTYPARAMETER_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>

View file

@ -29,7 +29,7 @@
#ifndef VEXCEPTIONOBJECTERROR_H #ifndef VEXCEPTIONOBJECTERROR_H
#define VEXCEPTIONOBJECTERROR_H #define VEXCEPTIONOBJECTERROR_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>

View file

@ -29,7 +29,7 @@
#ifndef VEXCEPTIONUNDO_H #ifndef VEXCEPTIONUNDO_H
#define VEXCEPTIONUNDO_H #define VEXCEPTIONUNDO_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include "../ifcdef.h" #include "../ifcdef.h"

View file

@ -29,7 +29,7 @@
#ifndef VEXCEPTIONWRONGID_H #ifndef VEXCEPTIONWRONGID_H
#define VEXCEPTIONWRONGID_H #define VEXCEPTIONWRONGID_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTCONVERTER_H #ifndef VABSTRACTCONVERTER_H
#define VABSTRACTCONVERTER_H #define VABSTRACTCONVERTER_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QString> #include <QString>
#include <QTemporaryFile> #include <QTemporaryFile>
@ -41,12 +40,13 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types") QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods") QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
class VAbstractConverter :public VDomDocument class VAbstractConverter : public VDomDocument
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
explicit VAbstractConverter(const QString &fileName); explicit VAbstractConverter(const QString &fileName);
virtual ~VAbstractConverter() = default; ~VAbstractConverter() override = default;
auto Convert() -> QString; auto Convert() -> QString;
@ -69,12 +69,12 @@ protected:
virtual auto MaxVerStr() const -> QString = 0; virtual auto MaxVerStr() const -> QString = 0;
virtual auto XSDSchema(unsigned ver) const -> QString; virtual auto XSDSchema(unsigned ver) const -> QString;
virtual void ApplyPatches() =0; virtual void ApplyPatches() = 0;
virtual void DowngradeToCurrentMaxVersion() =0; virtual void DowngradeToCurrentMaxVersion() = 0;
virtual auto IsReadOnly() const -> bool = 0; virtual auto IsReadOnly() const -> bool = 0;
virtual auto Schemas() const -> QHash <unsigned, QString> =0; virtual auto Schemas() const -> QHash<unsigned, QString> = 0;
void Replace(QString &formula, const QString &newName, vsizetype position, const QString &token, void Replace(QString &formula, const QString &newName, vsizetype position, const QString &token,
vsizetype &bias) const; vsizetype &bias) const;

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTMCONVERTER_H #ifndef VABSTRACTMCONVERTER_H
#define VABSTRACTMCONVERTER_H #define VABSTRACTMCONVERTER_H
#include <qcompilerdetection.h>
#include <QMap> #include <QMap>
#include <QMultiMap> #include <QMultiMap>
#include <QString> #include <QString>
@ -41,7 +40,7 @@ class VAbstractMConverter : public VAbstractConverter
{ {
public: public:
explicit VAbstractMConverter(const QString &fileName); explicit VAbstractMConverter(const QString &fileName);
virtual ~VAbstractMConverter() = default; ~VAbstractMConverter() override = default;
auto Units() const -> Unit; auto Units() const -> Unit;

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTPATTERN_H #ifndef VABSTRACTPATTERN_H
#define VABSTRACTPATTERN_H #define VABSTRACTPATTERN_H
#include <qcompilerdetection.h>
#include <QHash> #include <QHash>
#include <QMap> #include <QMap>
#include <QMetaObject> #include <QMetaObject>
@ -37,9 +36,9 @@
#include <QPair> #include <QPair>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QUuid>
#include <QVector> #include <QVector>
#include <QtGlobal> #include <QtGlobal>
#include <QUuid>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "vdomdocument.h" #include "vdomdocument.h"
@ -51,14 +50,40 @@ class VPieceNode;
class VPatternImage; class VPatternImage;
class VBackgroundPatternImage; class VBackgroundPatternImage;
enum class Document : qint8 { FullLiteParse, LiteParse, LitePPParse, FullParse }; enum class Document : qint8
enum class LabelType : qint8 {NewPatternPiece, NewLabel}; {
FullLiteParse,
LiteParse,
LitePPParse,
FullParse
};
enum class LabelType : qint8
{
NewPatternPiece,
NewLabel
};
// Don't touch values!!!. Same values stored in xml. // Don't touch values!!!. Same values stored in xml.
enum class CrossCirclesPoint : qint8 {FirstPoint = 1, SecondPoint = 2}; enum class CrossCirclesPoint : qint8
enum class VCrossCurvesPoint : qint8 {HighestPoint = 1, LowestPoint = 2}; {
enum class HCrossCurvesPoint : qint8 {LeftmostPoint = 1, RightmostPoint = 2}; FirstPoint = 1,
enum class AxisType : qint8 {VerticalAxis = 1, HorizontalAxis = 2}; SecondPoint = 2
};
enum class VCrossCurvesPoint : qint8
{
HighestPoint = 1,
LowestPoint = 2
};
enum class HCrossCurvesPoint : qint8
{
LeftmostPoint = 1,
RightmostPoint = 2
};
enum class AxisType : qint8
{
VerticalAxis = 1,
HorizontalAxis = 2
};
class VContainer; class VContainer;
class VDataTool; class VDataTool;
@ -97,6 +122,7 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
class VAbstractPattern : public VDomDocument class VAbstractPattern : public VDomDocument
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
explicit VAbstractPattern(QObject *parent = nullptr); explicit VAbstractPattern(QObject *parent = nullptr);
virtual ~VAbstractPattern(); virtual ~VAbstractPattern();
@ -428,7 +454,7 @@ signals:
void BackgroundImageOpacityChanged(const QUuid &id); void BackgroundImageOpacityChanged(const QUuid &id);
public slots: public slots:
virtual void LiteParseTree(const Document &parse)=0; virtual void LiteParseTree(const Document &parse) = 0;
void haveLiteChange(); void haveLiteChange();
void NeedFullParsing(); void NeedFullParsing();
void ClearScene(); void ClearScene();
@ -443,7 +469,7 @@ protected:
/** @brief cursor cursor keep id tool after which we will add new tool in file. */ /** @brief cursor cursor keep id tool after which we will add new tool in file. */
quint32 cursor; quint32 cursor;
QVector<VDataTool*> toolsOnRemove; QVector<VDataTool *> toolsOnRemove;
/** @brief history history records. */ /** @brief history history records. */
QVector<VToolRecord> history; QVector<VToolRecord> history;
@ -463,7 +489,7 @@ protected:
QString m_companyName{}; QString m_companyName{};
/** @brief tools list with pointer on tools. */ /** @brief tools list with pointer on tools. */
static QHash<quint32, VDataTool*> tools; static QHash<quint32, VDataTool *> tools;
/** @brief patternLabelLines list to speed up reading a template by many pieces. */ /** @brief patternLabelLines list to speed up reading a template by many pieces. */
static QVector<VLabelTemplateLine> patternLabelLines; static QVector<VLabelTemplateLine> patternLabelLines;
/** @brief patternMaterials list to speed up reading materials by many pieces. */ /** @brief patternMaterials list to speed up reading materials by many pieces. */
@ -474,12 +500,12 @@ protected:
static auto ParsePathNodes(const QDomElement &domElement) -> VPiecePath; static auto ParsePathNodes(const QDomElement &domElement) -> VPiecePath;
static auto ParseSANode(const QDomElement &domElement) -> VPieceNode; static auto ParseSANode(const QDomElement &domElement) -> VPieceNode;
void SetActivPP(const QString& name); void SetActivPP(const QString &name);
auto CheckTagExists(const QString &tag) -> QDomElement; auto CheckTagExists(const QString &tag) -> QDomElement;
void InsertTag(const QStringList &tags, const QDomElement &element); void InsertTag(const QStringList &tags, const QDomElement &element);
void SetChildTag(const QString& qsParent, const QString& qsChild, const QString& qsValue); void SetChildTag(const QString &qsParent, const QString &qsChild, const QString &qsValue);
auto GetIndexActivPP() const -> int; auto GetIndexActivPP() const -> int;
auto GetActivDrawElement(QDomElement &element) const -> bool; auto GetActivDrawElement(QDomElement &element) const -> bool;
@ -489,10 +515,10 @@ protected:
auto GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId) -> bool; auto GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId) -> bool;
auto ReadUnits() const -> Unit; auto ReadUnits() const -> Unit;
auto ReadPatternNumber() const ->QString; auto ReadPatternNumber() const -> QString;
auto ReadLabelDateFormat() const ->QString; auto ReadLabelDateFormat() const -> QString;
auto ReadPatternName() const ->QString; auto ReadPatternName() const -> QString;
auto ReadMPath() const ->QString; auto ReadMPath() const -> QString;
auto ReadWatermarkPath() const -> QString; auto ReadWatermarkPath() const -> QString;
auto ReadCompanyName() const -> QString; auto ReadCompanyName() const -> QString;

View file

@ -29,7 +29,6 @@
#include "vdomdocument.h" #include "vdomdocument.h"
#include <QSaveFile> #include <QSaveFile>
#include <qcompilerdetection.h>
#include <qdom.h> #include <qdom.h>
#include "../exception/vexception.h" #include "../exception/vexception.h"

View file

@ -29,7 +29,7 @@
#ifndef VPATTERNCONVERTER_H #ifndef VPATTERNCONVERTER_H
#define VPATTERNCONVERTER_H #define VPATTERNCONVERTER_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDomElement> #include <QDomElement>
#include <QMap> #include <QMap>

View file

@ -29,7 +29,7 @@
#ifndef VVITCONVERTER_H #ifndef VVITCONVERTER_H
#define VVITCONVERTER_H #define VVITCONVERTER_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>

View file

@ -29,7 +29,7 @@
#ifndef VMEASUREMENTCONVERTER_H #ifndef VMEASUREMENTCONVERTER_H
#define VMEASUREMENTCONVERTER_H #define VMEASUREMENTCONVERTER_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>

View file

@ -22,7 +22,6 @@
#ifndef QMUFORMULABASE_H #ifndef QMUFORMULABASE_H
#define QMUFORMULABASE_H #define QMUFORMULABASE_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
@ -38,9 +37,9 @@ class QMUPARSERSHARED_EXPORT QmuFormulaBase : public QmuParser
{ {
public: public:
QmuFormulaBase(); QmuFormulaBase();
virtual ~QmuFormulaBase() override; ~QmuFormulaBase() override;
virtual void InitCharSets() override; void InitCharSets() override;
void SetSepForTr(bool osSeparator, bool fromUser); void SetSepForTr(bool osSeparator, bool fromUser);
@ -49,6 +48,7 @@ public:
protected: protected:
static auto AddVariable(const QString &a_szName, void *a_pUserData) -> qreal *; static auto AddVariable(const QString &a_szName, void *a_pUserData) -> qreal *;
void SetSepForEval(); void SetSepForEval();
private: private:
Q_DISABLE_COPY_MOVE(QmuFormulaBase) // NOLINT Q_DISABLE_COPY_MOVE(QmuFormulaBase) // NOLINT
}; };

View file

@ -22,7 +22,6 @@
#ifndef QMUPARSER_H #ifndef QMUPARSER_H
#define QMUPARSER_H #define QMUPARSER_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
#include <locale> #include <locale>
@ -37,10 +36,10 @@
namespace qmu namespace qmu
{ {
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types") QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
/** @brief Mathematical expressions parser. /** @brief Mathematical expressions parser.
* *
* Standard implementation of the mathematical expressions parser. * Standard implementation of the mathematical expressions parser.
* Can be used as a reference implementation for subclassing the parser. * Can be used as a reference implementation for subclassing the parser.
@ -50,20 +49,20 @@ namespace qmu
* muparser(at)gmx.de * muparser(at)gmx.de
* </small> * </small>
*/ */
/* final */ class QMUPARSERSHARED_EXPORT QmuParser : public QmuParserBase /* final */ class QMUPARSERSHARED_EXPORT QmuParser : public QmuParserBase
{ {
public: public:
QmuParser(); QmuParser();
virtual void InitCharSets() override; void InitCharSets() override;
virtual void InitFun() override; void InitFun() override;
virtual void InitConst() override; void InitConst() override;
virtual void InitOprt() override; void InitOprt() override;
virtual void OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd) override; void OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd) override;
auto Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const -> qreal; auto Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const -> qreal;
protected: protected:
static auto IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, static auto IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int; const QChar &decimal, const QChar &thousand) -> int;
// hyperbolic functions // hyperbolic functions
static auto Sinh(qreal) -> qreal; static auto Sinh(qreal) -> qreal;
static auto Cosh(qreal) -> qreal; static auto Cosh(qreal) -> qreal;
@ -101,9 +100,9 @@ namespace qmu
static auto Avg(const qreal *, qmusizetype) -> qreal; // mean value static auto Avg(const qreal *, qmusizetype) -> qreal; // mean value
static auto Min(const qreal *, qmusizetype) -> qreal; // minimum static auto Min(const qreal *, qmusizetype) -> qreal; // minimum
static auto Max(const qreal *, qmusizetype) -> qreal; // maximum static auto Max(const qreal *, qmusizetype) -> qreal; // maximum
}; };
QT_WARNING_POP QT_WARNING_POP
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -111,8 +110,8 @@ namespace qmu
* @param v The value to negate * @param v The value to negate
* @return -v * @return -v
*/ */
inline auto QmuParser::UnaryMinus(qreal v) -> qreal inline auto QmuParser::UnaryMinus(qreal v) -> qreal
{ {
return -v; return -v;
} }

View file

@ -22,19 +22,18 @@
#ifndef QMUQPARSERBASE_H #ifndef QMUQPARSERBASE_H
#define QMUQPARSERBASE_H #define QMUQPARSERBASE_H
#include <climits>
#include <qcompilerdetection.h>
#include <QChar> #include <QChar>
#include <QLocale>
#include <QMap> #include <QMap>
#include <QStack> #include <QStack>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QVector> #include <QVector>
#include <QtCore/qcontainerfwd.h>
#include <QtGlobal> #include <QtGlobal>
#include <climits>
#include <memory> #include <memory>
#include <string> #include <string>
#include <QLocale>
#include <QtCore/qcontainerfwd.h>
#include "qmuparser_global.h" #include "qmuparser_global.h"
#include "qmuparserbytecode.h" #include "qmuparserbytecode.h"
@ -69,6 +68,7 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
class QMUPARSERSHARED_EXPORT QmuParserBase class QMUPARSERSHARED_EXPORT QmuParserBase
{ {
friend class QmuParserTokenReader; friend class QmuParserTokenReader;
public: public:
QmuParserBase(); QmuParserBase();
explicit QmuParserBase(const QmuParserBase &a_Parser); explicit QmuParserBase(const QmuParserBase &a_Parser);
@ -83,18 +83,17 @@ public:
void SetExpr(const QString &a_sExpr); void SetExpr(const QString &a_sExpr);
void SetVarFactory(facfun_type a_pFactory, void *pUserData = nullptr); void SetVarFactory(facfun_type a_pFactory, void *pUserData = nullptr);
void ResetLocale(); void ResetLocale();
void EnableOptimizer(bool a_bIsOn=true); void EnableOptimizer(bool a_bIsOn = true);
void EnableBuiltInOprt(bool a_bIsOn=true); void EnableBuiltInOprt(bool a_bIsOn = true);
auto HasBuiltInOprt() const -> bool; auto HasBuiltInOprt() const -> bool;
void AddValIdent(identfun_type a_pCallback); void AddValIdent(identfun_type a_pCallback);
void DefineOprt(const QString &a_sName, fun_type2 a_pFun, unsigned a_iPrec=0, void DefineOprt(const QString &a_sName, fun_type2 a_pFun, unsigned a_iPrec = 0,
EOprtAssociativity a_eAssociativity = oaLEFT, bool a_bAllowOpt = false); EOprtAssociativity a_eAssociativity = oaLEFT, bool a_bAllowOpt = false);
void DefineConst(const QString &a_sName, qreal a_fVal); void DefineConst(const QString &a_sName, qreal a_fVal);
void DefineStrConst(const QString &a_strName, const QString &a_strVal); void DefineStrConst(const QString &a_strName, const QString &a_strVal);
void DefineVar(const QString &a_sName, qreal *a_pVar); void DefineVar(const QString &a_sName, qreal *a_pVar);
void DefinePostfixOprt(const QString &a_sFun, fun_type1 a_pFun, bool a_bAllowOpt=true); void DefinePostfixOprt(const QString &a_sFun, fun_type1 a_pFun, bool a_bAllowOpt = true);
void DefineInfixOprt(const QString &a_sName, fun_type1 a_pFun, int a_iPrec=prINFIX, void DefineInfixOprt(const QString &a_sName, fun_type1 a_pFun, int a_iPrec = prINFIX, bool a_bAllowOpt = true);
bool a_bAllowOpt=true);
// Clear user defined variables, constants or functions // Clear user defined variables, constants or functions
void ClearVar(); void ClearVar();
void ClearFun(); void ClearFun();
@ -120,10 +119,9 @@ public:
auto ValidInfixOprtChars() const -> const QString &; auto ValidInfixOprtChars() const -> const QString &;
void SetArgSep(char_type cArgSep); void SetArgSep(char_type cArgSep);
auto GetArgSep() const -> QChar; auto GetArgSep() const -> QChar;
Q_NORETURN void Error(EErrorCodes a_iErrc, qmusizetype a_iPos = -1, const QString &a_sTok = QString() ) const; Q_NORETURN void Error(EErrorCodes a_iErrc, qmusizetype a_iPos = -1, const QString &a_sTok = QString()) const;
template<typename T> template <typename T> void DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt = true);
void DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt = true);
void setAllowSubexpressions(bool value); void setAllowSubexpressions(bool value);
@ -146,7 +144,7 @@ protected:
typedef QmuParserTokenReader token_reader_type; typedef QmuParserTokenReader token_reader_type;
static const QStringList c_DefaultOprt; static const QStringList c_DefaultOprt;
QLocale m_locale;///< The locale used by the parser QLocale m_locale; ///< The locale used by the parser
QChar m_decimalPoint; QChar m_decimalPoint;
QChar m_thousandsSeparator; QChar m_thousandsSeparator;
bool m_cNumbers{false}; ///< Search numbers in c locale bool m_cNumbers{false}; ///< Search numbers in c locale
@ -155,7 +153,7 @@ protected:
static bool g_DbgDumpCmdCode; static bool g_DbgDumpCmdCode;
static bool g_DbgDumpStack; static bool g_DbgDumpStack;
void AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback, funmap_type &a_Storage, void AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback, funmap_type &a_Storage,
const QString &a_szCharSet ); const QString &a_szCharSet);
void Init(); void Init();
virtual void InitCharSets() = 0; virtual void InitCharSets() = 0;
virtual void InitFun() = 0; virtual void InitFun() = 0;
@ -165,13 +163,17 @@ protected:
/** /**
* @brief A facet class used to change decimal and thousands separator. * @brief A facet class used to change decimal and thousands separator.
*/ */
template<class TChar> template <class TChar> class change_dec_sep : public std::numpunct<TChar>
class change_dec_sep : public std::numpunct<TChar>
{ {
public: public:
explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3) explicit change_dec_sep(char_type cDecSep, char_type cThousandsSep = 0, int nGroup = 3)
:std::numpunct<TChar>(), m_nGroup(nGroup), m_cDecPoint(cDecSep), m_cThousandsSep(cThousandsSep) : std::numpunct<TChar>(),
{} m_nGroup(nGroup),
m_cDecPoint(cDecSep),
m_cThousandsSep(cThousandsSep)
{
}
protected: protected:
virtual auto do_decimal_point() const -> char_type override { return m_cDecPoint; } virtual auto do_decimal_point() const -> char_type override { return m_cDecPoint; }
@ -186,11 +188,13 @@ protected:
// new code: // new code:
return std::string(1, static_cast<char>(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX)); return std::string(1, static_cast<char>(m_cThousandsSep > 0 ? m_nGroup : CHAR_MAX));
} }
private: private:
int m_nGroup; int m_nGroup;
char_type m_cDecPoint; char_type m_cDecPoint;
char_type m_cThousandsSep; char_type m_cThousandsSep;
}; };
private: private:
/** /**
* @brief Typedef for the parse functions. * @brief Typedef for the parse functions.
@ -249,8 +253,8 @@ private:
// items merely used for caching state information // items merely used for caching state information
mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine
mutable int m_nFinalResultIdx; mutable int m_nFinalResultIdx;
mutable QMap<qmusizetype, QString> m_Tokens;///< Keep all tokens that we can translate mutable QMap<qmusizetype, QString> m_Tokens; ///< Keep all tokens that we can translate
mutable QMap<qmusizetype, QString> m_Numbers;///< Keep all numbers what exist in formula mutable QMap<qmusizetype, QString> m_Numbers; ///< Keep all numbers what exist in formula
bool allowSubexpressions; bool allowSubexpressions;
@ -271,9 +275,8 @@ private:
// cppcheck-suppress functionStatic // cppcheck-suppress functionStatic
void CheckName(const QString &a_sName, const QString &a_szCharSet) const; void CheckName(const QString &a_sName, const QString &a_szCharSet) const;
// cppcheck-suppress functionStatic // cppcheck-suppress functionStatic
void CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback, void CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback, const QString &a_szCharSet) const;
const QString &a_szCharSet) const; void StackDump(const QStack<token_type> &a_stVal, const QStack<token_type> &a_stOprt) const;
void StackDump(const QStack<token_type > &a_stVal, const QStack<token_type > &a_stOprt) const;
}; };
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
@ -288,10 +291,9 @@ QT_WARNING_POP
* @param a_pFun Pointer to the callback function * @param a_pFun Pointer to the callback function
* @param a_bAllowOpt A flag indicating this function may be optimized * @param a_bAllowOpt A flag indicating this function may be optimized
*/ */
template<typename T> template <typename T> inline void QmuParserBase::DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt)
inline void QmuParserBase::DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt)
{ {
AddCallback( a_strName, QmuParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars() ); AddCallback(a_strName, QmuParserCallback(a_pFun, a_bAllowOpt), m_FunDef, ValidNameChars());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View file

@ -29,23 +29,26 @@
namespace qmu namespace qmu
{ {
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type0 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode ) QmuParserCallback::QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti, a_iPrec, a_iCode)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti, a_iPrec, a_iCode))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Constructor for constructing funcstion callbacks taking two arguments. * @brief Constructor for constructing funcstion callbacks taking two arguments.
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -56,128 +59,152 @@ QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti )
* @param a_eOprtAsct The operators associativity * @param a_eOprtAsct The operators associativity
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback (fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct) QmuParserCallback::QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti, a_iPrec, a_eOprtAsct)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti, a_iPrec, a_eOprtAsct))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type3 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type4 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type4 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type5 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type5 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type6 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type6 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type7 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type7 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type8 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type8 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type9 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type9 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( fun_type10 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(fun_type10 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type0 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type0 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type1 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type1 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Constructor for constructing funcstion callbacks taking two arguments. * @brief Constructor for constructing funcstion callbacks taking two arguments.
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback ( bulkfun_type2 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type2 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type3 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type3 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type4 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type4 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type5 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type5 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type6 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type6 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type7 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type7 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type8 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type8 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type9 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type9 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( bulkfun_type10 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( multfun_type a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(multfun_type a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( strfun_type1 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( strfun_type2 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback ( strfun_type3 a_pFun, bool a_bAllowOpti ) QmuParserCallback::QmuParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti)
: d (new QmuParserCallbackData(a_pFun, a_bAllowOpti)) : d(new QmuParserCallbackData(a_pFun, a_bAllowOpti))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -185,22 +212,24 @@ QmuParserCallback::QmuParserCallback ( strfun_type3 a_pFun, bool a_bAllowOpti )
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback() QmuParserCallback::QmuParserCallback()
: d (new QmuParserCallbackData) : d(new QmuParserCallbackData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Copy constructor. * @brief Copy constructor.
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback (const QmuParserCallback &a_Fun ) QmuParserCallback::QmuParserCallback(const QmuParserCallback &a_Fun)
: d (a_Fun.d) : d(a_Fun.d)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto QmuParserCallback::operator=(const QmuParserCallback &a_Fun) -> QmuParserCallback & auto QmuParserCallback::operator=(const QmuParserCallback &a_Fun) -> QmuParserCallback &
{ {
if ( &a_Fun == this ) if (&a_Fun == this)
{ {
return *this; return *this;
} }
@ -210,12 +239,13 @@ auto QmuParserCallback::operator=(const QmuParserCallback &a_Fun) -> QmuParserCa
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallback::QmuParserCallback(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW QmuParserCallback::QmuParserCallback(QmuParserCallback &&a_Fun) noexcept
: d (std::move(a_Fun.d)) : d(std::move(a_Fun.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto QmuParserCallback::operator=(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW->QmuParserCallback & auto QmuParserCallback::operator=(QmuParserCallback &&a_Fun) noexcept -> QmuParserCallback &
{ {
std::swap(d, a_Fun.d); std::swap(d, a_Fun.d);
return *this; return *this;
@ -252,7 +282,7 @@ auto QmuParserCallback::GetAddr() const -> void *
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Return the callback code. * @brief Return the callback code.
*/ */
auto QmuParserCallback::GetCode() const -> ECmdCode auto QmuParserCallback::GetCode() const -> ECmdCode
{ {
return d->m_iCode; return d->m_iCode;
@ -298,266 +328,438 @@ auto QmuParserCallback::GetArgc() const -> int
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
//Supressing specific warnings on gcc/g++ http://www.mr-edd.co.uk/blog/supressing_gcc_warnings // Supressing specific warnings on gcc/g++ http://www.mr-edd.co.uk/blog/supressing_gcc_warnings
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData() QmuParserCallbackData::QmuParserCallbackData()
: m_pFun ( nullptr ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), m_iCode ( cmUNKNOWN ), : m_pFun(nullptr),
m_iType ( tpVOID ), m_bAllowOpti ( 0 ) m_iArgc(0),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmUNKNOWN),
m_iType(tpVOID),
m_bAllowOpti(0)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type0 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type0 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(0),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode ) QmuParserCallbackData::QmuParserCallbackData(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( a_iPrec ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( a_iCode ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(1),
{} m_iPri(a_iPrec),
m_eOprtAsct(oaNONE),
m_iCode(a_iCode),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type2 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type2 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(2),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData (fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct) QmuParserCallbackData::QmuParserCallbackData(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec,
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( a_iPrec ), m_eOprtAsct ( a_eOprtAsct ), EOprtAssociativity a_eOprtAsct)
m_iCode ( cmOPRT_BIN ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) : m_pFun(reinterpret_cast<void *>(a_pFun)),
{} m_iArgc(2),
m_iPri(a_iPrec),
m_eOprtAsct(a_eOprtAsct),
m_iCode(cmOPRT_BIN),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type3 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type3 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 3 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(3),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type4 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type4 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 4 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(4),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type5 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type5 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 5 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(5),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type6 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type6 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 6 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(6),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type7 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type7 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 7 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(7),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type8 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type8 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 8 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(8),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type9 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type9 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 9 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(9),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( fun_type10 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(fun_type10 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 10 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(10),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type0 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type0 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(0),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type1 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type1 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(1),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type2 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type2 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(2),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type3 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type3 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 3 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(3),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type4 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type4 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 4 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(4),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type5 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type5 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 5 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(5),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type6 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type6 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 6 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(6),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type7 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type7 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 7 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(7),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type8 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type8 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 8 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(8),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type9 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type9 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 9 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(9),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( bulkfun_type10 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(bulkfun_type10 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 10 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(10),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_BULK),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( multfun_type a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(multfun_type a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( -1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(-1),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC),
m_iType(tpDBL),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( strfun_type1 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(strfun_type1 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(0),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_STR),
m_iType(tpSTR),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( strfun_type2 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(strfun_type2 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(1),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_STR),
m_iType(tpSTR),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallbackData::QmuParserCallbackData ( strfun_type3 a_pFun, bool a_bAllowOpti ) QmuParserCallbackData::QmuParserCallbackData(strfun_type3 a_pFun, bool a_bAllowOpti)
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun(reinterpret_cast<void *>(a_pFun)),
m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti ) m_iArgc(2),
{} m_iPri(-1),
m_eOprtAsct(oaNONE),
m_iCode(cmFUNC_STR),
m_iType(tpSTR),
m_bAllowOpti(a_bAllowOpti)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserCallbackData::QmuParserCallbackData(const QmuParserCallbackData &a_Fun) QmuParserCallbackData::QmuParserCallbackData(const QmuParserCallbackData &a_Fun)
: QSharedData(a_Fun), m_pFun(a_Fun.m_pFun), m_iArgc(a_Fun.m_iArgc), m_iPri(a_Fun.m_iPri), : QSharedData(a_Fun),
m_eOprtAsct(a_Fun.m_eOprtAsct), m_iCode(a_Fun.m_iCode), m_iType(a_Fun.m_iType), m_bAllowOpti(a_Fun.m_bAllowOpti) m_pFun(a_Fun.m_pFun),
{} m_iArgc(a_Fun.m_iArgc),
m_iPri(a_Fun.m_iPri),
//--------------------------------------------------------------------------------------------------------------------- m_eOprtAsct(a_Fun.m_eOprtAsct),
QmuParserCallbackData::~QmuParserCallbackData() m_iCode(a_Fun.m_iCode),
{} m_iType(a_Fun.m_iType),
m_bAllowOpti(a_Fun.m_bAllowOpti)
{
}
} // namespace qmu } // namespace qmu

View file

@ -22,15 +22,14 @@
#ifndef QMUPARSERCALLBACK_H #ifndef QMUPARSERCALLBACK_H
#define QMUPARSERCALLBACK_H #define QMUPARSERCALLBACK_H
#include <qcompilerdetection.h>
#include <QString>
#include <map>
#include <QTypeInfo>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QString>
#include <QTypeInfo>
#include <map>
#include "qmuparser_global.h" #include "qmuparser_global.h"
#include "qmuparserdef.h"
#include "qmuparsercallback_p.h" #include "qmuparsercallback_p.h"
#include "qmuparserdef.h"
/** /**
* @file * @file
@ -54,7 +53,7 @@ class QMUPARSERSHARED_EXPORT QmuParserCallback
{ {
public: public:
QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti); QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC); QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode = cmFUNC);
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct); QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct);
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti); QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti); QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti);
@ -87,8 +86,8 @@ public:
auto operator=(const QmuParserCallback &a_Fun) -> QmuParserCallback &; auto operator=(const QmuParserCallback &a_Fun) -> QmuParserCallback &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
QmuParserCallback(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW; QmuParserCallback(QmuParserCallback &&a_Fun) noexcept;
auto operator=(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW->QmuParserCallback &; auto operator=(QmuParserCallback &&a_Fun) noexcept -> QmuParserCallback &;
#endif #endif
Q_REQUIRED_RESULT auto Clone() const -> QmuParserCallback *; Q_REQUIRED_RESULT auto Clone() const -> QmuParserCallback *;
@ -117,7 +116,7 @@ typedef std::map<QString, QmuParserCallback> funmap_type;
*/ */
inline auto QmuParserCallback::Clone() const -> QmuParserCallback * inline auto QmuParserCallback::Clone() const -> QmuParserCallback *
{ {
return new QmuParserCallback ( *this ); return new QmuParserCallback(*this);
} }
} // namespace qmu } // namespace qmu

View file

@ -25,8 +25,8 @@
#ifndef QMUPARSERCALLBACK_P_H #ifndef QMUPARSERCALLBACK_P_H
#define QMUPARSERCALLBACK_P_H #define QMUPARSERCALLBACK_P_H
#include <QSharedData>
#include "qmuparserdef.h" #include "qmuparserdef.h"
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
@ -44,7 +44,7 @@ class QmuParserCallbackData : public QSharedData
public: public:
QmuParserCallbackData(); QmuParserCallbackData();
QmuParserCallbackData(fun_type0 a_pFun, bool a_bAllowOpti); QmuParserCallbackData(fun_type0 a_pFun, bool a_bAllowOpti);
QmuParserCallbackData(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC); QmuParserCallbackData(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode = cmFUNC);
QmuParserCallbackData(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct); QmuParserCallbackData(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eOprtAsct);
QmuParserCallbackData(fun_type2 a_pFun, bool a_bAllowOpti); QmuParserCallbackData(fun_type2 a_pFun, bool a_bAllowOpti);
QmuParserCallbackData(fun_type3 a_pFun, bool a_bAllowOpti); QmuParserCallbackData(fun_type3 a_pFun, bool a_bAllowOpti);
@ -73,7 +73,7 @@ public:
QmuParserCallbackData(strfun_type2 a_pFun, bool a_bAllowOpti); QmuParserCallbackData(strfun_type2 a_pFun, bool a_bAllowOpti);
QmuParserCallbackData(strfun_type3 a_pFun, bool a_bAllowOpti); QmuParserCallbackData(strfun_type3 a_pFun, bool a_bAllowOpti);
QmuParserCallbackData(const QmuParserCallbackData &a_Fun); QmuParserCallbackData(const QmuParserCallbackData &a_Fun);
virtual ~QmuParserCallbackData(); ~QmuParserCallbackData() = default;
void *m_pFun; ///< Pointer to the callback function, casted to void void *m_pFun; ///< Pointer to the callback function, casted to void
@ -96,5 +96,5 @@ private:
QT_WARNING_POP QT_WARNING_POP
} } // namespace qmu
#endif // QMUPARSERCALLBACK_P_H #endif // QMUPARSERCALLBACK_P_H

View file

@ -22,7 +22,6 @@
#ifndef QMUPARSERERROR_H #ifndef QMUPARSERERROR_H
#define QMUPARSERERROR_H #define QMUPARSERERROR_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QException> #include <QException>
#include <QMap> #include <QMap>
@ -99,7 +98,7 @@ enum EErrorCodes
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
/** @brief A class that handles the error messages. /** @brief A class that handles the error messages.
*/ */
class QMUPARSERSHARED_EXPORT QmuParserErrorMsg class QMUPARSERSHARED_EXPORT QmuParserErrorMsg
{ {
public: public:
@ -134,11 +133,11 @@ inline auto QmuParserErrorMsg::operator[](int a_iIdx) const -> QString
class QMUPARSERSHARED_EXPORT QmuParserWarning : public QException class QMUPARSERSHARED_EXPORT QmuParserWarning : public QException
{ {
public: public:
explicit QmuParserWarning ( const QString &sMsg ); explicit QmuParserWarning(const QString &sMsg);
QmuParserWarning ( const QmuParserWarning &a_Obj ); QmuParserWarning(const QmuParserWarning &a_Obj);
auto operator=(const QmuParserWarning &a_Obj) -> QmuParserWarning &; auto operator=(const QmuParserWarning &a_Obj) -> QmuParserWarning &;
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
virtual ~QmuParserWarning() QMUP_NOEXCEPT_EXPR (true) override {} virtual ~QmuParserWarning() QMUP_NOEXCEPT_EXPR(true) override {}
auto GetMsg() const -> const QString &; auto GetMsg() const -> const QString &;
@ -168,16 +167,17 @@ class QMUPARSERSHARED_EXPORT QmuParserError : public QException
{ {
public: public:
QmuParserError(); QmuParserError();
explicit QmuParserError ( EErrorCodes a_iErrc ); explicit QmuParserError(EErrorCodes a_iErrc);
explicit QmuParserError ( const QString &sMsg ); explicit QmuParserError(const QString &sMsg);
QmuParserError ( EErrorCodes a_iErrc, const QString &sTok, const QString &sFormula = QString(), qmusizetype a_iPos = -1 ); QmuParserError(EErrorCodes a_iErrc, const QString &sTok, const QString &sFormula = QString(),
QmuParserError ( EErrorCodes a_iErrc, int a_iPos, const QString &sTok ); qmusizetype a_iPos = -1);
QmuParserError ( const QString &szMsg, int iPos, const QString &sTok = QString() ); QmuParserError(EErrorCodes a_iErrc, int a_iPos, const QString &sTok);
QmuParserError ( const QmuParserError &a_Obj ); QmuParserError(const QString &szMsg, int iPos, const QString &sTok = QString());
QmuParserError(const QmuParserError &a_Obj);
auto operator=(const QmuParserError &a_Obj) -> QmuParserError &; auto operator=(const QmuParserError &a_Obj) -> QmuParserError &;
virtual ~QmuParserError() QMUP_NOEXCEPT_EXPR (true) override {} virtual ~QmuParserError() QMUP_NOEXCEPT_EXPR(true) override {}
void SetFormula ( const QString &a_strFormula ); void SetFormula(const QString &a_strFormula);
auto GetExpr() const -> const QString &; auto GetExpr() const -> const QString &;
auto GetMsg() const -> const QString &; auto GetMsg() const -> const QString &;
auto GetPos() const -> qmusizetype; auto GetPos() const -> qmusizetype;
@ -200,7 +200,7 @@ private:
/** /**
* @brief Set the expression related to this error. * @brief Set the expression related to this error.
*/ */
inline void QmuParserError::SetFormula ( const QString &a_strFormula ) inline void QmuParserError::SetFormula(const QString &a_strFormula)
{ {
m_sExpr = a_strFormula; m_sExpr = a_strFormula;
} }

View file

@ -22,7 +22,6 @@
#ifndef QMUPARSERTOKENREADER_H #ifndef QMUPARSERTOKENREADER_H
#define QMUPARSERTOKENREADER_H #define QMUPARSERTOKENREADER_H
#include <qcompilerdetection.h>
#include <QChar> #include <QChar>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
@ -52,25 +51,26 @@ class QmuParserTokenReader
{ {
private: private:
using token_type = QmuParserToken<qreal, QString>; using token_type = QmuParserToken<qreal, QString>;
public: public:
explicit QmuParserTokenReader(QmuParserBase *a_pParent); explicit QmuParserTokenReader(QmuParserBase *a_pParent);
~QmuParserTokenReader()=default; ~QmuParserTokenReader() = default;
auto Clone(QmuParserBase *a_pParent) const -> QmuParserTokenReader*; auto Clone(QmuParserBase *a_pParent) const -> QmuParserTokenReader *;
void AddValIdent(identfun_type a_pCallback); void AddValIdent(identfun_type a_pCallback);
void SetVarCreator(facfun_type a_pFactory, void *pUserData); void SetVarCreator(facfun_type a_pFactory, void *pUserData);
void SetFormula(const QString &a_strFormula); void SetFormula(const QString &a_strFormula);
void SetArgSep(char_type cArgSep); void SetArgSep(char_type cArgSep);
auto GetPos() const -> qmusizetype; auto GetPos() const -> qmusizetype;
auto GetExpr() const -> const QString&; auto GetExpr() const -> const QString &;
auto GetUsedVar() -> varmap_type&; auto GetUsedVar() -> varmap_type &;
auto GetArgSep() const -> QChar; auto GetArgSep() const -> QChar;
void IgnoreUndefVar(bool bIgnore); void IgnoreUndefVar(bool bIgnore);
void ReInit(); void ReInit();
auto ReadNextToken(const QLocale &locale, bool cNumbers, const QChar &decimal, const QChar &thousand) -> token_type; auto ReadNextToken(const QLocale &locale, bool cNumbers, const QChar &decimal, const QChar &thousand) -> token_type;
private:
private:
/** /**
* @brief Syntax codes. * @brief Syntax codes.
* *
@ -94,7 +94,8 @@ private:
noASSIGN = 1 << 11, ///< to block assignement to constant i.e. "4=7" NOLINT(hicpp-signed-bitwise) noASSIGN = 1 << 11, ///< to block assignement to constant i.e. "4=7" NOLINT(hicpp-signed-bitwise)
noIF = 1 << 12, // NOLINT(hicpp-signed-bitwise) noIF = 1 << 12, // NOLINT(hicpp-signed-bitwise)
noELSE = 1 << 13, // NOLINT(hicpp-signed-bitwise) noELSE = 1 << 13, // NOLINT(hicpp-signed-bitwise)
sfSTART_OF_LINE = noOPT | noBC | noPOSTOP | noASSIGN | noIF | noELSE | noARG_SEP, // NOLINT(hicpp-signed-bitwise) sfSTART_OF_LINE =
noOPT | noBC | noPOSTOP | noASSIGN | noIF | noELSE | noARG_SEP, // NOLINT(hicpp-signed-bitwise)
noANY = ~0 ///< All of he above flags set NOLINT(hicpp-signed-bitwise) noANY = ~0 ///< All of he above flags set NOLINT(hicpp-signed-bitwise)
}; };
@ -121,7 +122,7 @@ private:
QChar m_cArgSep{';'}; ///< The character used for separating function arguments QChar m_cArgSep{';'}; ///< The character used for separating function arguments
QmuParserTokenReader(const QmuParserTokenReader &a_Reader); QmuParserTokenReader(const QmuParserTokenReader &a_Reader);
auto operator=(const QmuParserTokenReader &a_Reader) -> QmuParserTokenReader&; auto operator=(const QmuParserTokenReader &a_Reader) -> QmuParserTokenReader &;
void Assign(const QmuParserTokenReader &a_Reader); void Assign(const QmuParserTokenReader &a_Reader);
@ -136,15 +137,15 @@ private:
auto IsFunTok(token_type &a_Tok) -> bool; auto IsFunTok(token_type &a_Tok) -> bool;
auto IsPostOpTok(token_type &a_Tok) -> bool; auto IsPostOpTok(token_type &a_Tok) -> bool;
auto IsOprt(token_type &a_Tok) -> bool; auto IsOprt(token_type &a_Tok) -> bool;
auto IsValTok(token_type &a_Tok, const QLocale &locale, bool cNumbers, const QChar &decimal, auto IsValTok(token_type &a_Tok, const QLocale &locale, bool cNumbers, const QChar &decimal, const QChar &thousand)
const QChar &thousand) -> bool; -> bool;
auto IsVarTok(token_type &a_Tok) -> bool; auto IsVarTok(token_type &a_Tok) -> bool;
auto IsStrVarTok(token_type &a_Tok) -> bool; auto IsStrVarTok(token_type &a_Tok) -> bool;
auto IsUndefVarTok(token_type &a_Tok) -> bool; auto IsUndefVarTok(token_type &a_Tok) -> bool;
auto IsString(token_type &a_Tok) -> bool; auto IsString(token_type &a_Tok) -> bool;
Q_NORETURN void Error(EErrorCodes a_iErrc, qmusizetype a_iPos = -1, const QString &a_sTok = QString() ) const; Q_NORETURN void Error(EErrorCodes a_iErrc, qmusizetype a_iPos = -1, const QString &a_sTok = QString()) const;
auto SaveBeforeReturn(const token_type &tok) -> token_type&; auto SaveBeforeReturn(const token_type &tok) -> token_type &;
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -166,7 +167,7 @@ inline auto QmuParserTokenReader::GetPos() const -> qmusizetype
* @return #m_strFormula * @return #m_strFormula
* @throw nothrow * @throw nothrow
*/ */
inline auto QmuParserTokenReader::GetExpr() const -> const QString& inline auto QmuParserTokenReader::GetExpr() const -> const QString &
{ {
return m_strFormula; return m_strFormula;
} }
@ -175,7 +176,7 @@ inline auto QmuParserTokenReader::GetExpr() const -> const QString&
/** /**
* @brief Return a map containing the used variables only. * @brief Return a map containing the used variables only.
*/ */
inline auto QmuParserTokenReader::GetUsedVar() -> varmap_type& inline auto QmuParserTokenReader::GetUsedVar() -> varmap_type &
{ {
return m_UsedVar; return m_UsedVar;
} }
@ -189,13 +190,13 @@ inline auto QmuParserTokenReader::GetUsedVar() -> varmap_type&
* Those function should return a complete list of variables including * Those function should return a complete list of variables including
* those the are not defined by the time of it's call. * those the are not defined by the time of it's call.
*/ */
inline void QmuParserTokenReader::IgnoreUndefVar ( bool bIgnore ) inline void QmuParserTokenReader::IgnoreUndefVar(bool bIgnore)
{ {
m_bIgnoreUndefVar = bIgnore; m_bIgnoreUndefVar = bIgnore;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline void QmuParserTokenReader::SetArgSep ( char_type cArgSep ) inline void QmuParserTokenReader::SetArgSep(char_type cArgSep)
{ {
m_cArgSep = QChar(cArgSep); m_cArgSep = QChar(cArgSep);
} }

View file

@ -22,7 +22,6 @@
#ifndef QMUTOKENPARSER_H #ifndef QMUTOKENPARSER_H
#define QMUTOKENPARSER_H #define QMUTOKENPARSER_H
#include <qcompilerdetection.h>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>

View file

@ -35,7 +35,6 @@
#include <QSize> #include <QSize>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
#include <qcompilerdetection.h>
#include <string> #include <string>
#include "../vmisc/def.h" #include "../vmisc/def.h"

View file

@ -33,7 +33,6 @@
#include <QSize> #include <QSize>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
#include <qcompilerdetection.h>
#include "dxfdef.h" #include "dxfdef.h"
#include "libdxfrw/drw_base.h" #include "libdxfrw/drw_base.h"

View file

@ -29,7 +29,7 @@
#ifndef VMEASUREMENTS_H #ifndef VMEASUREMENTS_H
#define VMEASUREMENTS_H #define VMEASUREMENTS_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDomElement> #include <QDomElement>
#include <QString> #include <QString>

View file

@ -36,40 +36,48 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const GOType &type, const quint32 &idObject, const Draw &mode) VAbstractArc::VAbstractArc(const GOType &type, const quint32 &idObject, const Draw &mode)
: VAbstractCurve(type, idObject, mode), d (new VAbstractArcData()) : VAbstractCurve(type, idObject, mode),
{} d(new VAbstractArcData())
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1, const QString &formulaF1, qreal f2, VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1, const QString &formulaF1, qreal f2,
const QString &formulaF2, quint32 idObject, Draw mode) const QString &formulaF2, quint32 idObject, Draw mode)
: VAbstractCurve(type, idObject, mode), d (new VAbstractArcData(center, f1, formulaF1, f2, formulaF2)) : VAbstractCurve(type, idObject, mode),
{} d(new VAbstractArcData(center, f1, formulaF1, f2, formulaF2))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1, qreal f2, quint32 idObject, Draw mode) VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1, qreal f2, quint32 idObject, Draw mode)
: VAbstractCurve(type, idObject, mode), d (new VAbstractArcData(center, f1, f2)) : VAbstractCurve(type, idObject, mode),
{} d(new VAbstractArcData(center, f1, f2))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const GOType &type, const QString &formulaLength, const VPointF &center, VAbstractArc::VAbstractArc(const GOType &type, const QString &formulaLength, const VPointF &center, qreal f1,
qreal f1, const QString &formulaF1, quint32 idObject, Draw mode) const QString &formulaF1, quint32 idObject, Draw mode)
: VAbstractCurve(type, idObject, mode), d (new VAbstractArcData(formulaLength, center, f1, formulaF1)) : VAbstractCurve(type, idObject, mode),
{} d(new VAbstractArcData(formulaLength, center, f1, formulaF1))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1, quint32 idObject, Draw mode) VAbstractArc::VAbstractArc(const GOType &type, const VPointF &center, qreal f1, quint32 idObject, Draw mode)
: VAbstractCurve(type, idObject, mode), d (new VAbstractArcData(center, f1)) : VAbstractCurve(type, idObject, mode),
{} d(new VAbstractArcData(center, f1))
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(const VAbstractArc &arc) VAbstractArc::VAbstractArc(const VAbstractArc &arc) = default;
: VAbstractCurve(arc), d (arc.d)
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractArc::operator=(const VAbstractArc &arc) -> VAbstractArc & auto VAbstractArc::operator=(const VAbstractArc &arc) -> VAbstractArc &
{ {
if ( &arc == this ) if (&arc == this)
{ {
return *this; return *this;
} }
@ -80,13 +88,14 @@ auto VAbstractArc::operator=(const VAbstractArc &arc) -> VAbstractArc &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::VAbstractArc(VAbstractArc &&arc) Q_DECL_NOTHROW VAbstractArc::VAbstractArc(VAbstractArc &&arc) noexcept
: VAbstractCurve(std::move(arc)), : VAbstractCurve(std::move(arc)),
d(std::move(arc.d)) d(std::move(arc.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractArc::operator=(VAbstractArc &&arc) Q_DECL_NOTHROW -> VAbstractArc & auto VAbstractArc::operator=(VAbstractArc &&arc) noexcept -> VAbstractArc &
{ {
VAbstractCurve::operator=(arc); VAbstractCurve::operator=(arc);
std::swap(d, arc.d); std::swap(d, arc.d);
@ -95,8 +104,7 @@ auto VAbstractArc::operator=(VAbstractArc &&arc) Q_DECL_NOTHROW -> VAbstractArc
#endif #endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArc::~VAbstractArc() // NOLINT(hicpp-use-equals-default, modernize-use-equals-default) VAbstractArc::~VAbstractArc() = default;
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractArc::GetFormulaF1() const -> QString auto VAbstractArc::GetFormulaF1() const -> QString
@ -171,26 +179,26 @@ void VAbstractArc::setId(const quint32 &id)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractArc::NameForHistory(const QString &toolName) const -> QString auto VAbstractArc::NameForHistory(const QString &toolName) const -> QString
{ {
QString name = toolName + QString(" %1").arg(GetCenter().name()); QString name = toolName + QStringLiteral(" %1").arg(GetCenter().name());
if (VAbstractCurve::id() != NULL_ID) if (VAbstractCurve::id() != NULL_ID)
{ {
name += QString("_%1").arg(VAbstractCurve::id()); name += QStringLiteral("_%1").arg(VAbstractCurve::id());
} }
if (GetDuplicate() > 0) if (GetDuplicate() > 0)
{ {
name += QString("_%1").arg(GetDuplicate()); name += QStringLiteral("_%1").arg(GetDuplicate());
} }
QString alias; QString alias;
if (not GetAliasSuffix().isEmpty()) if (not GetAliasSuffix().isEmpty())
{ {
alias = QString("%1 %2").arg(toolName, GetAliasSuffix()); alias = QStringLiteral("%1 %2").arg(toolName, GetAliasSuffix());
} }
return not alias.isEmpty() ? QString("%1 (%2)").arg(alias, name) : name; return not alias.isEmpty() ? QStringLiteral("%1 (%2)").arg(alias, name) : name;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTARC_H #ifndef VABSTRACTARC_H
#define VABSTRACTARC_H #define VABSTRACTARC_H
#include <qcompilerdetection.h>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
@ -58,35 +57,37 @@ public:
VAbstractArc(const VAbstractArc &arc); VAbstractArc(const VAbstractArc &arc);
~VAbstractArc() override; ~VAbstractArc() override;
auto operator= (const VAbstractArc &arc) -> VAbstractArc&; auto operator=(const VAbstractArc &arc) -> VAbstractArc &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VAbstractArc(VAbstractArc &&arc) Q_DECL_NOTHROW; VAbstractArc(VAbstractArc &&arc) noexcept;
auto operator=(VAbstractArc &&arc) Q_DECL_NOTHROW -> VAbstractArc &; auto operator=(VAbstractArc &&arc) noexcept -> VAbstractArc &;
#endif #endif
auto GetFormulaF1 () const -> QString; auto GetFormulaF1() const -> QString;
void SetFormulaF1 (const QString &formula, qreal value); void SetFormulaF1(const QString &formula, qreal value);
auto GetStartAngle () const -> qreal override; auto GetStartAngle() const -> qreal override;
auto GetFormulaF2 () const -> QString; auto GetFormulaF2() const -> QString;
void SetFormulaF2 (const QString &formula, qreal value); void SetFormulaF2(const QString &formula, qreal value);
auto GetEndAngle () const -> qreal override; auto GetEndAngle() const -> qreal override;
auto GetCenter () const -> VPointF; auto GetCenter() const -> VPointF;
void SetCenter (const VPointF &point); void SetCenter(const VPointF &point);
auto GetFormulaLength () const -> QString; auto GetFormulaLength() const -> QString;
void SetFormulaLength (const QString &formula, qreal value); void SetFormulaLength(const QString &formula, qreal value);
void setId(const quint32 &id) override; void setId(const quint32 &id) override;
auto NameForHistory(const QString &toolName) const -> QString override; auto NameForHistory(const QString &toolName) const -> QString override;
auto IsFlipped() const -> bool; auto IsFlipped() const -> bool;
auto AngleArc() const -> qreal; auto AngleArc() const -> qreal;
protected: protected:
void SetFlipped(bool value); void SetFlipped(bool value);
virtual void FindF2(qreal length)=0; virtual void FindF2(qreal length) = 0;
void SetFormulaLength(const QString &formula); void SetFormulaLength(const QString &formula);
private: private:
QSharedDataPointer<VAbstractArcData> d; QSharedDataPointer<VAbstractArcData> d;
}; };

View file

@ -42,109 +42,77 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractArcData final : public QSharedData class VAbstractArcData final : public QSharedData
{ {
public: public:
VAbstractArcData(); VAbstractArcData() = default;
VAbstractArcData(const VPointF &center, qreal f1, const QString &formulaF1, qreal f2, const QString &formulaF2); VAbstractArcData(const VPointF &center, qreal f1, const QString &formulaF1, qreal f2, const QString &formulaF2);
VAbstractArcData(const QString &formulaLength, const VPointF &center, qreal f1, const QString &formulaF1); VAbstractArcData(const QString &formulaLength, const VPointF &center, qreal f1, const QString &formulaF1);
VAbstractArcData(const VPointF &center, qreal f1); VAbstractArcData(const VPointF &center, qreal f1);
VAbstractArcData(const VPointF &center, qreal f1, qreal f2); VAbstractArcData(const VPointF &center, qreal f1, qreal f2);
VAbstractArcData(const VAbstractArcData &arc); VAbstractArcData(const VAbstractArcData &arc) = default;
virtual ~VAbstractArcData(); ~VAbstractArcData() = default;
/** @brief f1 start angle in degree. */ /** @brief f1 start angle in degree. */
qreal f1; qreal f1{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief formulaF1 formula for start angle. */ /** @brief formulaF1 formula for start angle. */
QString formulaF1; QString formulaF1{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief f2 end angle in degree. */ /** @brief f2 end angle in degree. */
qreal f2; qreal f2{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief formulaF2 formula for end angle. */ /** @brief formulaF2 formula for end angle. */
QString formulaF2; QString formulaF2{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief center center point of arc. */ /** @brief center center point of arc. */
VPointF center; VPointF center{}; // NOLINT(misc-non-private-member-variables-in-classes)
bool isFlipped; bool isFlipped{false}; // NOLINT(misc-non-private-member-variables-in-classes)
QString formulaLength; QString formulaLength{}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VAbstractArcData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VAbstractArcData) // NOLINT
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::VAbstractArcData() inline VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1, const QString &formulaF1, qreal f2,
: f1(0),
formulaF1(),
f2(0),
formulaF2(),
center(),
isFlipped(false),
formulaLength()
{}
//---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1, const QString &formulaF1, qreal f2,
const QString &formulaF2) const QString &formulaF2)
: f1(f1), : f1(f1),
formulaF1(formulaF1), formulaF1(formulaF1),
f2(f2), f2(f2),
formulaF2(formulaF2), formulaF2(formulaF2),
center(center), center(center)
isFlipped(false), {
formulaLength() }
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::VAbstractArcData(const QString &formulaLength, const VPointF &center, qreal f1, inline VAbstractArcData::VAbstractArcData(const QString &formulaLength, const VPointF &center, qreal f1,
const QString &formulaF1) const QString &formulaF1)
: f1(f1), : f1(f1),
formulaF1(formulaF1), formulaF1(formulaF1),
f2(0),
formulaF2('0'), formulaF2('0'),
center(center), center(center),
isFlipped(false),
formulaLength(formulaLength) formulaLength(formulaLength)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1) inline VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1)
: f1(f1), : f1(f1),
formulaF1(QString().number(f1)), formulaF1(QString::number(f1)),
f2(0),
formulaF2('0'), formulaF2('0'),
center(center), center(center)
isFlipped(false), {
formulaLength() }
{}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1, qreal f2) inline VAbstractArcData::VAbstractArcData(const VPointF &center, qreal f1, qreal f2)
: f1(f1), : f1(f1),
formulaF1(QString().number(f1)), formulaF1(QString::number(f1)),
f2(f2), f2(f2),
formulaF2(QString().number(f2)), formulaF2(QString::number(f2)),
center(center), center(center)
isFlipped(false), {
formulaLength() }
{}
//---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::VAbstractArcData(const VAbstractArcData &arc)
: QSharedData(arc),
f1(arc.f1),
formulaF1(arc.formulaF1),
f2(arc.f2),
formulaF2(arc.formulaF2),
center(arc.center),
isFlipped(arc.isFlipped),
formulaLength(arc.formulaLength)
{}
//---------------------------------------------------------------------------------------------------------------------
VAbstractArcData::~VAbstractArcData()
{}
QT_WARNING_POP QT_WARNING_POP

View file

@ -43,8 +43,8 @@ public:
~VAbstractBezier() override =default; ~VAbstractBezier() override =default;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VAbstractBezier(VAbstractBezier &&curve) Q_DECL_NOTHROW =default; VAbstractBezier(VAbstractBezier &&curve) noexcept =default;
auto operator=(VAbstractBezier &&curve) Q_DECL_NOTHROW -> VAbstractBezier & =default; auto operator=(VAbstractBezier &&curve) noexcept -> VAbstractBezier & =default;
#endif #endif
virtual auto GetC1Length() const -> qreal =0; virtual auto GetC1Length() const -> qreal =0;

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTCUBICBEZIER_H #ifndef VABSTRACTCUBICBEZIER_H
#define VABSTRACTCUBICBEZIER_H #define VABSTRACTCUBICBEZIER_H
#include <qcompilerdetection.h>
#include <QPointF> #include <QPointF>
#include <QString> #include <QString>
#include <QVector> #include <QVector>
@ -49,18 +48,18 @@ public:
explicit VAbstractCubicBezier(const GOType &type, const quint32 &idObject = NULL_ID, explicit VAbstractCubicBezier(const GOType &type, const quint32 &idObject = NULL_ID,
const Draw &mode = Draw::Calculation); const Draw &mode = Draw::Calculation);
VAbstractCubicBezier(const VAbstractCubicBezier &curve) = default; VAbstractCubicBezier(const VAbstractCubicBezier &curve) = default;
auto operator= (const VAbstractCubicBezier &curve) -> VAbstractCubicBezier&; auto operator=(const VAbstractCubicBezier &curve) -> VAbstractCubicBezier &;
~VAbstractCubicBezier() override = default; ~VAbstractCubicBezier() override = default;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VAbstractCubicBezier(VAbstractCubicBezier &&curve) Q_DECL_NOTHROW =default; VAbstractCubicBezier(VAbstractCubicBezier &&curve) noexcept = default;
auto operator=(VAbstractCubicBezier &&curve) Q_DECL_NOTHROW -> VAbstractCubicBezier & =default; auto operator=(VAbstractCubicBezier &&curve) noexcept -> VAbstractCubicBezier & = default;
#endif #endif
virtual auto GetP1 () const -> VPointF =0; virtual auto GetP1() const -> VPointF = 0;
virtual auto GetP2 () const -> VPointF =0; virtual auto GetP2() const -> VPointF = 0;
virtual auto GetP3 () const -> VPointF =0; virtual auto GetP3() const -> VPointF = 0;
virtual auto GetP4 () const -> VPointF =0; virtual auto GetP4() const -> VPointF = 0;
auto CutSpline(qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3, auto CutSpline(qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3,
const QString &pointName) const -> QPointF; const QString &pointName) const -> QPointF;
@ -74,14 +73,14 @@ protected:
void CreateName() override; void CreateName() override;
void CreateAlias() override; void CreateAlias() override;
static auto GetCubicBezierPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, static auto GetCubicBezierPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4,
const QPointF &p4, qreal approximationScale) -> QVector<QPointF>; qreal approximationScale) -> QVector<QPointF>;
static auto LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4, static auto LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4,
qreal approximationScale) -> qreal; qreal approximationScale) -> qreal;
virtual auto GetControlPoint1() const -> QPointF =0; virtual auto GetControlPoint1() const -> QPointF = 0;
virtual auto GetControlPoint2() const -> QPointF =0; virtual auto GetControlPoint2() const -> QPointF = 0;
virtual auto GetRealLength() const -> qreal =0; virtual auto GetRealLength() const -> qreal = 0;
}; };
QT_WARNING_POP QT_WARNING_POP

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTCUBICBEZIERPATH_H #ifndef VABSTRACTCUBICBEZIERPATH_H
#define VABSTRACTCUBICBEZIERPATH_H #define VABSTRACTCUBICBEZIERPATH_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QPointF> #include <QPointF>
#include <QString> #include <QString>
@ -50,18 +49,24 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
class VAbstractCubicBezierPath : public VAbstractBezier class VAbstractCubicBezierPath : public VAbstractBezier
{ {
Q_DECLARE_TR_FUNCTIONS(VAbstractCubicBezierPath) // NOLINT Q_DECLARE_TR_FUNCTIONS(VAbstractCubicBezierPath) // NOLINT
public: public:
explicit VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject = NULL_ID, explicit VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject = NULL_ID,
const Draw &mode = Draw::Calculation); const Draw &mode = Draw::Calculation);
VAbstractCubicBezierPath(const VAbstractCubicBezierPath &curve) = default; VAbstractCubicBezierPath(const VAbstractCubicBezierPath &curve) = default;
auto operator= (const VAbstractCubicBezierPath &curve) -> VAbstractCubicBezierPath&; auto operator=(const VAbstractCubicBezierPath &curve) -> VAbstractCubicBezierPath &;
~VAbstractCubicBezierPath() override; ~VAbstractCubicBezierPath() override;
virtual auto CountSubSpl() const -> vsizetype =0; #ifdef Q_COMPILER_RVALUE_REFS
virtual auto CountPoints() const -> vsizetype =0; VAbstractCubicBezierPath(VAbstractCubicBezierPath &&curve) noexcept = default;
virtual void Clear() =0; auto operator=(VAbstractCubicBezierPath &&curve) noexcept -> VAbstractCubicBezierPath & = default;
virtual auto GetSpline(vsizetype index) const -> VSpline =0; #endif
virtual auto GetSplinePath() const -> QVector<VSplinePoint> =0;
virtual auto CountSubSpl() const -> vsizetype = 0;
virtual auto CountPoints() const -> vsizetype = 0;
virtual void Clear() = 0;
virtual auto GetSpline(vsizetype index) const -> VSpline = 0;
virtual auto GetSplinePath() const -> QVector<VSplinePoint> = 0;
auto GetPath() const -> QPainterPath override; auto GetPath() const -> QPainterPath override;
auto GetPoints() const -> QVector<QPointF> override; auto GetPoints() const -> QVector<QPointF> override;
@ -80,8 +85,8 @@ protected:
void CreateName() override; void CreateName() override;
void CreateAlias() override; void CreateAlias() override;
virtual auto FirstPoint() const -> VPointF =0; virtual auto FirstPoint() const -> VPointF = 0;
virtual auto LastPoint() const -> VPointF =0; virtual auto LastPoint() const -> VPointF = 0;
}; };
QT_WARNING_POP QT_WARNING_POP

View file

@ -69,12 +69,12 @@ auto VAbstractCurve::operator=(const VAbstractCurve &curve) -> VAbstractCurve &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractCurve::VAbstractCurve(VAbstractCurve &&curve) Q_DECL_NOTHROW VAbstractCurve::VAbstractCurve(VAbstractCurve &&curve) noexcept
:VGObject(std::move(curve)), d (std::move(curve.d)) :VGObject(std::move(curve)), d (std::move(curve.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractCurve::operator=(VAbstractCurve &&curve) Q_DECL_NOTHROW -> VAbstractCurve & auto VAbstractCurve::operator=(VAbstractCurve &&curve) noexcept -> VAbstractCurve &
{ {
VGObject::operator=(curve); VGObject::operator=(curve);
std::swap(d, curve.d); std::swap(d, curve.d);

View file

@ -29,7 +29,6 @@
#ifndef VABSTRACTCURVE_H #ifndef VABSTRACTCURVE_H
#define VABSTRACTCURVE_H #define VABSTRACTCURVE_H
#include <qcompilerdetection.h>
#include <QPointF> #include <QPointF>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QString> #include <QString>
@ -37,9 +36,9 @@
#include <QVector> #include <QVector>
#include <QtGlobal> #include <QtGlobal>
#include "../vmisc/typedef.h"
#include "vgeometrydef.h" #include "vgeometrydef.h"
#include "vgobject.h" #include "vgobject.h"
#include "../vmisc/typedef.h"
using DirectionArrow = QPair<QLineF, QLineF>; using DirectionArrow = QPair<QLineF, QLineF>;
@ -50,7 +49,7 @@ QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types") QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods") QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods")
class VAbstractCurve :public VGObject class VAbstractCurve : public VGObject
{ {
public: public:
explicit VAbstractCurve(const GOType &type, const quint32 &idObject = NULL_ID, explicit VAbstractCurve(const GOType &type, const quint32 &idObject = NULL_ID,
@ -58,20 +57,20 @@ public:
VAbstractCurve(const VAbstractCurve &curve); VAbstractCurve(const VAbstractCurve &curve);
~VAbstractCurve() override; ~VAbstractCurve() override;
auto operator= (const VAbstractCurve &curve) -> VAbstractCurve&; auto operator=(const VAbstractCurve &curve) -> VAbstractCurve &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VAbstractCurve(VAbstractCurve &&curve) Q_DECL_NOTHROW; VAbstractCurve(VAbstractCurve &&curve) noexcept;
auto operator=(VAbstractCurve &&curve) Q_DECL_NOTHROW -> VAbstractCurve &; auto operator=(VAbstractCurve &&curve) noexcept -> VAbstractCurve &;
#endif #endif
virtual auto GetPoints() const -> QVector<QPointF> =0; virtual auto GetPoints() const -> QVector<QPointF> = 0;
static auto GetSegmentPoints(const QVector<QPointF> &points, const QPointF &begin, const QPointF &end, static auto GetSegmentPoints(const QVector<QPointF> &points, const QPointF &begin, const QPointF &end, bool reverse,
bool reverse, QString &error) -> QVector<QPointF>; QString &error) -> QVector<QPointF>;
auto GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse, auto GetSegmentPoints(const QPointF &begin, const QPointF &end, bool reverse,
const QString &piece = QString()) const -> QVector<QPointF>; const QString &piece = QString()) const -> QVector<QPointF>;
virtual auto GetPath() const -> QPainterPath; virtual auto GetPath() const -> QPainterPath;
virtual auto GetLength() const -> qreal =0; virtual auto GetLength() const -> qreal = 0;
auto GetLengthByPoint(const QPointF &point) const -> qreal; auto GetLengthByPoint(const QPointF &point) const -> qreal;
virtual auto IntersectLine(const QLineF &line) const -> QVector<QPointF>; virtual auto IntersectLine(const QLineF &line) const -> QVector<QPointF>;
virtual auto IsIntersectLine(const QLineF &line) const -> bool; virtual auto IsIntersectLine(const QLineF &line) const -> bool;
@ -79,13 +78,13 @@ public:
static auto IsPointOnCurve(const QVector<QPointF> &points, const QPointF &p) -> bool; static auto IsPointOnCurve(const QVector<QPointF> &points, const QPointF &p) -> bool;
auto IsPointOnCurve(const QPointF &p) const -> bool; auto IsPointOnCurve(const QPointF &p) const -> bool;
static auto SubdividePath(const QVector<QPointF> &points, QPointF p, QVector<QPointF> &sub1, static auto SubdividePath(const QVector<QPointF> &points, QPointF p, QVector<QPointF> &sub1, QVector<QPointF> &sub2)
QVector<QPointF> &sub2) -> bool; -> bool;
auto ClosestPoint(QPointF scenePoint) const -> QPointF; auto ClosestPoint(QPointF scenePoint) const -> QPointF;
virtual auto GetStartAngle () const -> qreal=0; virtual auto GetStartAngle() const -> qreal = 0;
virtual auto GetEndAngle () const -> qreal=0; virtual auto GetEndAngle() const -> qreal = 0;
auto GetDuplicate() const -> quint32; auto GetDuplicate() const -> quint32;
void SetDuplicate(quint32 number); void SetDuplicate(quint32 number);
@ -105,7 +104,7 @@ public:
static auto CurveIntersectAxis(const QPointF &point, qreal angle, const QVector<QPointF> &curvePoints, static auto CurveIntersectAxis(const QPointF &point, qreal angle, const QVector<QPointF> &curvePoints,
QPointF *intersectionPoint) -> bool; QPointF *intersectionPoint) -> bool;
virtual auto NameForHistory(const QString &toolName) const -> QString=0; virtual auto NameForHistory(const QString &toolName) const -> QString = 0;
virtual auto DirectionArrows() const -> QVector<DirectionArrow>; virtual auto DirectionArrows() const -> QVector<DirectionArrow>;
static auto ShowDirection(const QVector<DirectionArrow> &arrows, qreal width) -> QPainterPath; static auto ShowDirection(const QVector<DirectionArrow> &arrows, qreal width) -> QPainterPath;
@ -116,8 +115,9 @@ public:
static constexpr qreal minLength = MmToPixel(1.); static constexpr qreal minLength = MmToPixel(1.);
protected: protected:
virtual void CreateName() =0; virtual void CreateName() = 0;
virtual void CreateAlias() =0; virtual void CreateAlias() = 0;
private: private:
QSharedDataPointer<VAbstractCurveData> d; QSharedDataPointer<VAbstractCurveData> d;

View file

@ -43,39 +43,22 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractCurveData final : public QSharedData class VAbstractCurveData final : public QSharedData
{ {
public: public:
VAbstractCurveData() = default;
VAbstractCurveData () VAbstractCurveData(const VAbstractCurveData &curve) = default;
: duplicate(0), ~VAbstractCurveData() = default;
color(ColorBlack),
penStyle(TypeLineLine),
approximationScale(defCurveApproximationScale)
{}
VAbstractCurveData(const VAbstractCurveData &curve)
: QSharedData(curve),
duplicate(curve.duplicate),
color(curve.color),
penStyle(curve.penStyle),
approximationScale(curve.approximationScale)
{}
virtual ~VAbstractCurveData();
/** @brief duplicate helps create unique name for curves that connects the same start and finish points. */ /** @brief duplicate helps create unique name for curves that connects the same start and finish points. */
quint32 duplicate; quint32 duplicate{0}; // NOLINT(misc-non-private-member-variables-in-classes)
QString color; QString color{ColorBlack}; // NOLINT(misc-non-private-member-variables-in-classes)
QString penStyle; QString penStyle{TypeLineLine}; // NOLINT(misc-non-private-member-variables-in-classes)
qreal approximationScale; qreal approximationScale{defCurveApproximationScale}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VAbstractCurveData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VAbstractCurveData) // NOLINT
}; };
VAbstractCurveData::~VAbstractCurveData()
{}
QT_WARNING_POP QT_WARNING_POP
#endif // VABSTRACTCURVE_P_H #endif // VABSTRACTCURVE_P_H

View file

@ -122,12 +122,12 @@ auto VArc::operator =(const VArc &arc) -> VArc &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VArc::VArc(VArc &&arc) Q_DECL_NOTHROW VArc::VArc(VArc &&arc) noexcept
: VAbstractArc(std::move(arc)), d (std::move(arc.d)) : VAbstractArc(std::move(arc)), d (std::move(arc.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VArc::operator=(VArc &&arc) Q_DECL_NOTHROW -> VArc & auto VArc::operator=(VArc &&arc) noexcept -> VArc &
{ {
VAbstractArc::operator=(arc); VAbstractArc::operator=(arc);
std::swap(d, arc.d); std::swap(d, arc.d);

View file

@ -29,7 +29,6 @@
#ifndef VARC_H #ifndef VARC_H
#define VARC_H #define VARC_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QPointF> #include <QPointF>
#include <QSharedDataPointer> #include <QSharedDataPointer>
@ -39,7 +38,6 @@
#include <QtGlobal> #include <QtGlobal>
#include "vabstractarc.h" #include "vabstractarc.h"
#include "vgeometrydef.h"
#include "vpointf.h" #include "vpointf.h"
class VArcData; class VArcData;
@ -50,6 +48,7 @@ class VArcData;
class VArc final : public VAbstractArc class VArc final : public VAbstractArc
{ {
Q_DECLARE_TR_FUNCTIONS(VArc) // NOLINT Q_DECLARE_TR_FUNCTIONS(VArc) // NOLINT
public: public:
VArc(); VArc();
VArc(const VPointF &center, qreal radius, const QString &formulaRadius, qreal f1, const QString &formulaF1, VArc(const VPointF &center, qreal radius, const QString &formulaRadius, qreal f1, const QString &formulaF1,
@ -64,10 +63,10 @@ public:
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VArc; auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VArc;
~VArc() override; ~VArc() override;
auto operator= (const VArc &arc) -> VArc&; auto operator=(const VArc &arc) -> VArc &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VArc(VArc &&arc) Q_DECL_NOTHROW; VArc(VArc &&arc) noexcept;
auto operator=(VArc &&arc) Q_DECL_NOTHROW -> VArc &; auto operator=(VArc &&arc) noexcept -> VArc &;
#endif #endif
auto GetFormulaRadius() const -> QString; auto GetFormulaRadius() const -> QString;
@ -83,10 +82,12 @@ public:
auto CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName) const -> QPointF; auto CutArc(qreal length, VArc &arc1, VArc &arc2, const QString &pointName) const -> QPointF;
auto CutArc(qreal length, const QString &pointName) const -> QPointF; auto CutArc(qreal length, const QString &pointName) const -> QPointF;
protected: protected:
void CreateName() override; void CreateName() override;
void CreateAlias() override; void CreateAlias() override;
void FindF2(qreal length) override; void FindF2(qreal length) override;
private: private:
QSharedDataPointer<VArcData> d; QSharedDataPointer<VArcData> d;

View file

@ -43,50 +43,35 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VArcData final : public QSharedData class VArcData final : public QSharedData
{ {
public: public:
VArcData(); VArcData() = default;
VArcData(qreal radius, const QString &formulaRadius); VArcData(qreal radius, const QString &formulaRadius);
explicit VArcData(qreal radius); explicit VArcData(qreal radius);
VArcData(const VArcData &arc); VArcData(const VArcData &arc) = default;
virtual ~VArcData(); ~VArcData() = default;
/** @brief radius arc radius. */ /** @brief radius arc radius. */
qreal radius; qreal radius{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief formulaRadius formula for arc radius. */ /** @brief formulaRadius formula for arc radius. */
QString formulaRadius; QString formulaRadius{}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VArcData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VArcData) // NOLINT
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VArcData::VArcData() inline VArcData::VArcData(qreal radius, const QString &formulaRadius)
: radius(0),
formulaRadius(QString())
{}
//---------------------------------------------------------------------------------------------------------------------
VArcData::VArcData(qreal radius, const QString &formulaRadius)
: radius(radius), : radius(radius),
formulaRadius(formulaRadius) formulaRadius(formulaRadius)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VArcData::VArcData(qreal radius) inline VArcData::VArcData(qreal radius)
: radius(radius), : radius(radius),
formulaRadius(QString().number(radius)) formulaRadius(QString::number(radius))
{} {
}
//---------------------------------------------------------------------------------------------------------------------
VArcData::VArcData(const VArcData &arc)
: QSharedData(arc),
radius(arc.radius),
formulaRadius(arc.formulaRadius)
{}
//---------------------------------------------------------------------------------------------------------------------
VArcData::~VArcData()
{}
QT_WARNING_POP QT_WARNING_POP

View file

@ -66,12 +66,12 @@ auto VCubicBezier::operator=(const VCubicBezier &curve) -> VCubicBezier &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezier::VCubicBezier(VCubicBezier &&curve) Q_DECL_NOTHROW VCubicBezier::VCubicBezier(VCubicBezier &&curve) noexcept
: VAbstractCubicBezier(std::move(curve)), d(std::move(curve.d)) : VAbstractCubicBezier(std::move(curve)), d(std::move(curve.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezier::operator=(VCubicBezier &&curve) Q_DECL_NOTHROW->VCubicBezier & auto VCubicBezier::operator=(VCubicBezier &&curve) noexcept->VCubicBezier &
{ {
VAbstractCubicBezier::operator=(curve); VAbstractCubicBezier::operator=(curve);
std::swap(d, curve.d); std::swap(d, curve.d);

View file

@ -29,7 +29,6 @@
#ifndef VCUBICBEZIER_H #ifndef VCUBICBEZIER_H
#define VCUBICBEZIER_H #define VCUBICBEZIER_H
#include <qcompilerdetection.h>
#include <QPointF> #include <QPointF>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QString> #include <QString>
@ -38,7 +37,6 @@
#include <QtGlobal> #include <QtGlobal>
#include "vabstractcubicbezier.h" #include "vabstractcubicbezier.h"
#include "vgeometrydef.h"
#include "vpointf.h" #include "vpointf.h"
class VCubicBezierData; class VCubicBezierData;
@ -57,8 +55,8 @@ public:
auto operator=(const VCubicBezier &curve) -> VCubicBezier &; auto operator=(const VCubicBezier &curve) -> VCubicBezier &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VCubicBezier(VCubicBezier &&curve) Q_DECL_NOTHROW; VCubicBezier(VCubicBezier &&curve) noexcept;
auto operator=(VCubicBezier &&curve) Q_DECL_NOTHROW->VCubicBezier &; auto operator=(VCubicBezier &&curve) noexcept -> VCubicBezier &;
#endif #endif
virtual auto GetP1() const -> VPointF override; virtual auto GetP1() const -> VPointF override;

View file

@ -29,8 +29,8 @@
#ifndef VCUBICBEZIER_P_H #ifndef VCUBICBEZIER_P_H
#define VCUBICBEZIER_P_H #define VCUBICBEZIER_P_H
#include <QSharedData>
#include <QLineF> #include <QLineF>
#include <QSharedData>
#include "vpointf.h" #include "vpointf.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
@ -44,48 +44,29 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VCubicBezierData final : public QSharedData class VCubicBezierData final : public QSharedData
{ {
public: public:
VCubicBezierData(); VCubicBezierData() = default;
VCubicBezierData(const VCubicBezierData &curve); VCubicBezierData(const VCubicBezierData &curve) = default;
VCubicBezierData(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4); VCubicBezierData(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4);
virtual ~VCubicBezierData(); ~VCubicBezierData() = default;
/** @brief p1 first spline point. */ /** @brief p1 first spline point. */
VPointF p1; VPointF p1{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief p2 fourth spline point. */ /** @brief p2 fourth spline point. */
VPointF p2; VPointF p2{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief p3 fourth spline point. */ /** @brief p3 fourth spline point. */
VPointF p3; VPointF p3{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief p4 fourth spline point. */ /** @brief p4 fourth spline point. */
VPointF p4; VPointF p4{}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VCubicBezierData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VCubicBezierData) // NOLINT
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierData::VCubicBezierData() inline VCubicBezierData::VCubicBezierData(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4)
: p1(),
p2(),
p3(),
p4()
{
}
//---------------------------------------------------------------------------------------------------------------------
VCubicBezierData::VCubicBezierData(const VCubicBezierData &curve)
: QSharedData(curve),
p1(curve.p1),
p2(curve.p2),
p3(curve.p3),
p4(curve.p4)
{
}
//---------------------------------------------------------------------------------------------------------------------
VCubicBezierData::VCubicBezierData(const VPointF &p1, const VPointF &p2, const VPointF &p3, const VPointF &p4)
: p1(p1), : p1(p1),
p2(p2), p2(p2),
p3(p3), p3(p3),
@ -93,11 +74,6 @@ VCubicBezierData::VCubicBezierData(const VPointF &p1, const VPointF &p2, const V
{ {
} }
//---------------------------------------------------------------------------------------------------------------------
VCubicBezierData::~VCubicBezierData()
{
}
QT_WARNING_POP QT_WARNING_POP
#endif // VCUBICBEZIER_P_H #endif // VCUBICBEZIER_P_H

View file

@ -32,12 +32,11 @@
#include <QPoint> #include <QPoint>
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h" #include "../vmisc/compatibility.h"
#include "vabstractcurve.h" #include "vabstractcurve.h"
#include "vcubicbezierpath_p.h" #include "vcubicbezierpath_p.h"
#include "vspline.h" #include "vspline.h"
#include "vsplinepoint.h" #include "vsplinepoint.h"
#include "../vmisc/compatibility.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(quint32 idObject, Draw mode) VCubicBezierPath::VCubicBezierPath(quint32 idObject, Draw mode)
@ -47,11 +46,7 @@ VCubicBezierPath::VCubicBezierPath(quint32 idObject, Draw mode)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(const VCubicBezierPath &curve) VCubicBezierPath::VCubicBezierPath(const VCubicBezierPath &curve) = default;
: VAbstractCubicBezierPath(curve),
d(curve.d)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject, Draw mode) VCubicBezierPath::VCubicBezierPath(const QVector<VPointF> &points, quint32 idObject, Draw mode)
@ -70,7 +65,7 @@ VCubicBezierPath::VCubicBezierPath(const QVector<VPointF> &points, quint32 idObj
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezierPath::operator=(const VCubicBezierPath &curve) -> VCubicBezierPath & auto VCubicBezierPath::operator=(const VCubicBezierPath &curve) -> VCubicBezierPath &
{ {
if ( &curve == this ) if (&curve == this)
{ {
return *this; return *this;
} }
@ -81,13 +76,14 @@ auto VCubicBezierPath::operator=(const VCubicBezierPath &curve) -> VCubicBezierP
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::VCubicBezierPath(VCubicBezierPath &&curve) Q_DECL_NOTHROW VCubicBezierPath::VCubicBezierPath(VCubicBezierPath &&curve) noexcept
: VAbstractCubicBezierPath(std::move(curve)), : VAbstractCubicBezierPath(std::move(curve)),
d(std::move(curve.d)) d(std::move(curve.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezierPath::operator=(VCubicBezierPath &&curve) Q_DECL_NOTHROW->VCubicBezierPath & auto VCubicBezierPath::operator=(VCubicBezierPath &&curve) noexcept -> VCubicBezierPath &
{ {
VAbstractCubicBezierPath::operator=(curve); VAbstractCubicBezierPath::operator=(curve);
std::swap(d, curve.d); std::swap(d, curve.d);
@ -163,9 +159,7 @@ auto VCubicBezierPath::Move(qreal length, qreal angle, const QString &prefix) co
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VCubicBezierPath::~VCubicBezierPath() VCubicBezierPath::~VCubicBezierPath() = default;
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCubicBezierPath::operator[](vsizetype indx) -> VPointF & auto VCubicBezierPath::operator[](vsizetype indx) -> VPointF &
@ -221,7 +215,7 @@ auto VCubicBezierPath::GetSpline(vsizetype index) const -> VSpline
const vsizetype base = SubSplOffset(index); const vsizetype base = SubSplOffset(index);
// Correction the first control point of each next spline curve except for the first. // Correction the first control point of each next spline curve except for the first.
QPointF p2 = static_cast<QPointF>(d->path.at(base + 1)); auto p2 = static_cast<QPointF>(d->path.at(base + 1));
if (base + 1 > 1) if (base + 1 > 1)
{ {
const QPointF b = static_cast<QPointF>(d->path.at(base)); const QPointF b = static_cast<QPointF>(d->path.at(base));
@ -283,18 +277,18 @@ auto VCubicBezierPath::GetC2Length() const -> qreal
auto VCubicBezierPath::GetSplinePath() const -> QVector<VSplinePoint> auto VCubicBezierPath::GetSplinePath() const -> QVector<VSplinePoint>
{ {
const vsizetype size = CountSubSpl(); const vsizetype size = CountSubSpl();
QVector<VSplinePoint> splPoints(size+1); QVector<VSplinePoint> splPoints(size + 1);
for (qint32 i = 1; i <= size; ++i) for (qint32 i = 1; i <= size; ++i)
{ {
const VSpline spl = GetSpline(i); const VSpline spl = GetSpline(i);
{ {
VSplinePoint p = splPoints.at(i-1); VSplinePoint p = splPoints.at(i - 1);
p.SetP(spl.GetP1()); p.SetP(spl.GetP1());
p.SetAngle2(spl.GetStartAngle(), spl.GetStartAngleFormula()); p.SetAngle2(spl.GetStartAngle(), spl.GetStartAngleFormula());
p.SetLength2(spl.GetC1Length(), spl.GetC1LengthFormula()); p.SetLength2(spl.GetC1Length(), spl.GetC1LengthFormula());
splPoints[i-1] = p; splPoints[i - 1] = p;
} }
{ {
@ -366,7 +360,7 @@ auto VCubicBezierPath::LastPoint() const -> VPointF
const vsizetype count = CountSubSpl(); const vsizetype count = CountSubSpl();
if (count >= 1) if (count >= 1)
{ {
return d->path.at(SubSplOffset(count) + 3);// Take last point of the last real spline return d->path.at(SubSplOffset(count) + 3); // Take last point of the last real spline
} }
return {}; return {};

View file

@ -29,7 +29,6 @@
#ifndef VCUBICBEZIERPATH_H #ifndef VCUBICBEZIERPATH_H
#define VCUBICBEZIERPATH_H #define VCUBICBEZIERPATH_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QPointF> #include <QPointF>
#include <QSharedDataPointer> #include <QSharedDataPointer>
@ -39,7 +38,6 @@
#include <QtGlobal> #include <QtGlobal>
#include "vabstractcubicbezierpath.h" #include "vabstractcubicbezierpath.h"
#include "vgeometrydef.h"
#include "vpointf.h" #include "vpointf.h"
class VCubicBezierPathData; class VCubicBezierPathData;
@ -47,6 +45,7 @@ class VCubicBezierPathData;
class VCubicBezierPath final : public VAbstractCubicBezierPath class VCubicBezierPath final : public VAbstractCubicBezierPath
{ {
Q_DECLARE_TR_FUNCTIONS(VCubicBezierPath) // NOLINT Q_DECLARE_TR_FUNCTIONS(VCubicBezierPath) // NOLINT
public: public:
explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation); explicit VCubicBezierPath(quint32 idObject = 0, Draw mode = Draw::Calculation);
VCubicBezierPath(const VCubicBezierPath &curve); VCubicBezierPath(const VCubicBezierPath &curve);
@ -58,8 +57,8 @@ public:
auto operator=(const VCubicBezierPath &curve) -> VCubicBezierPath &; auto operator=(const VCubicBezierPath &curve) -> VCubicBezierPath &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VCubicBezierPath(VCubicBezierPath &&curve) Q_DECL_NOTHROW; VCubicBezierPath(VCubicBezierPath &&curve) noexcept;
auto operator=(VCubicBezierPath &&curve) Q_DECL_NOTHROW->VCubicBezierPath &; auto operator=(VCubicBezierPath &&curve) noexcept -> VCubicBezierPath &;
#endif #endif
auto operator[](vsizetype indx) -> VPointF &; auto operator[](vsizetype indx) -> VPointF &;

View file

@ -43,28 +43,17 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VCubicBezierPathData final : public QSharedData class VCubicBezierPathData final : public QSharedData
{ {
public: public:
VCubicBezierPathData() = default;
VCubicBezierPathData() VCubicBezierPathData(const VCubicBezierPathData &splPath) = default;
: path() ~VCubicBezierPathData() = default;
{}
VCubicBezierPathData(const VCubicBezierPathData &splPath)
: QSharedData(splPath),
path(splPath.path)
{}
virtual ~VCubicBezierPathData();
/** @brief path list of points. */ /** @brief path list of points. */
QVector<VPointF> path; QVector<VPointF> path{}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VCubicBezierPathData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VCubicBezierPathData) // NOLINT
}; };
VCubicBezierPathData::~VCubicBezierPathData()
{}
QT_WARNING_POP QT_WARNING_POP
#endif // VCUBICBEZIERPATH_P_H #endif // VCUBICBEZIERPATH_P_H

View file

@ -315,13 +315,13 @@ auto VEllipticalArc::operator =(const VEllipticalArc &arc) -> VEllipticalArc &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VEllipticalArc::VEllipticalArc(VEllipticalArc &&arc) Q_DECL_NOTHROW VEllipticalArc::VEllipticalArc(VEllipticalArc &&arc) noexcept
: VAbstractArc(std::move(arc)), : VAbstractArc(std::move(arc)),
d(std::move(arc.d)) d(std::move(arc.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VEllipticalArc::operator=(VEllipticalArc &&arc) Q_DECL_NOTHROW -> VEllipticalArc & auto VEllipticalArc::operator=(VEllipticalArc &&arc) noexcept -> VEllipticalArc &
{ {
VAbstractArc::operator=(arc); VAbstractArc::operator=(arc);
std::swap(d, arc.d); std::swap(d, arc.d);

View file

@ -29,7 +29,6 @@
#ifndef VELLIPTICALARC_H #ifndef VELLIPTICALARC_H
#define VELLIPTICALARC_H #define VELLIPTICALARC_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QPointF> #include <QPointF>
#include <QSharedDataPointer> #include <QSharedDataPointer>
@ -47,6 +46,7 @@ class VEllipticalArcData;
class VEllipticalArc final : public VAbstractArc class VEllipticalArc final : public VAbstractArc
{ {
Q_DECLARE_TR_FUNCTIONS(VEllipticalArc) // NOLINT Q_DECLARE_TR_FUNCTIONS(VEllipticalArc) // NOLINT
public: public:
VEllipticalArc(); VEllipticalArc();
VEllipticalArc(const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1, VEllipticalArc(const VPointF &center, qreal radius1, qreal radius2, const QString &formulaRadius1,
@ -67,10 +67,10 @@ public:
~VEllipticalArc() override; ~VEllipticalArc() override;
auto operator= (const VEllipticalArc &arc) -> VEllipticalArc&; auto operator=(const VEllipticalArc &arc) -> VEllipticalArc &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VEllipticalArc(VEllipticalArc &&arc) Q_DECL_NOTHROW; VEllipticalArc(VEllipticalArc &&arc) noexcept;
auto operator=(VEllipticalArc &&arc) Q_DECL_NOTHROW -> VEllipticalArc &; auto operator=(VEllipticalArc &&arc) noexcept -> VEllipticalArc &;
#endif #endif
auto GetFormulaRotationAngle() const -> QString; auto GetFormulaRotationAngle() const -> QString;
@ -101,15 +101,17 @@ public:
auto GetStartAngle() const -> qreal override; auto GetStartAngle() const -> qreal override;
auto GetEndAngle() const -> qreal override; auto GetEndAngle() const -> qreal override;
auto CutArc (const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2, auto CutArc(const qreal &length, VEllipticalArc &arc1, VEllipticalArc &arc2, const QString &pointName) const
const QString &pointName) const -> QPointF; -> QPointF;
auto CutArc (const qreal &length, const QString &pointName) const -> QPointF; auto CutArc(const qreal &length, const QString &pointName) const -> QPointF;
static auto OptimizeAngle(qreal angle) -> qreal; static auto OptimizeAngle(qreal angle) -> qreal;
protected: protected:
void CreateName() override; void CreateName() override;
void CreateAlias() override; void CreateAlias() override;
void FindF2(qreal length) override; void FindF2(qreal length) override;
private: private:
QSharedDataPointer<VEllipticalArcData> d; QSharedDataPointer<VEllipticalArcData> d;
@ -124,7 +126,7 @@ Q_DECLARE_TYPEINFO(VEllipticalArc, Q_MOVABLE_TYPE); // NOLINT
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline auto VEllipticalArc::OptimizeAngle(qreal angle) -> qreal inline auto VEllipticalArc::OptimizeAngle(qreal angle) -> qreal
{ {
return angle - 360.*qFloor(angle/360.); return angle - 360. * qFloor(angle / 360.);
} }
#endif // VELLIPTICALARC_H #endif // VELLIPTICALARC_H

View file

@ -15,45 +15,33 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VEllipticalArcData final : public QSharedData class VEllipticalArcData final : public QSharedData
{ {
public: public:
VEllipticalArcData (); VEllipticalArcData() = default;
VEllipticalArcData (qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2, VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1, const QString &formulaRadius2,
qreal rotationAngle, const QString &formulaRotationAngle); qreal rotationAngle, const QString &formulaRotationAngle);
VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle); VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle);
VEllipticalArcData(const VEllipticalArcData &arc); VEllipticalArcData(const VEllipticalArcData &arc) = default;
~VEllipticalArcData() = default;
virtual ~VEllipticalArcData();
/** @brief radius1 elliptical arc major radius. */ /** @brief radius1 elliptical arc major radius. */
qreal radius1; qreal radius1{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief radius2 elliptical arc minor radius. */ /** @brief radius2 elliptical arc minor radius. */
qreal radius2; qreal radius2{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief formulaRadius1 formula for elliptical arc major radius. */ /** @brief formulaRadius1 formula for elliptical arc major radius. */
QString formulaRadius1; QString formulaRadius1{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief formulaRadius2 formula for elliptical arc minor radius. */ /** @brief formulaRadius2 formula for elliptical arc minor radius. */
QString formulaRadius2; QString formulaRadius2{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief rotationAngle in degree. */ /** @brief rotationAngle in degree. */
qreal rotationAngle; qreal rotationAngle{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief formulaRotationAngle formula for rotationAngle. */ /** @brief formulaRotationAngle formula for rotationAngle. */
QString formulaRotationAngle; QString formulaRotationAngle{}; // NOLINT(misc-non-private-member-variables-in-classes)
QTransform m_transform; QTransform m_transform{}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VEllipticalArcData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VEllipticalArcData) // NOLINT
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VEllipticalArcData::VEllipticalArcData() inline VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1,
: radius1(0),
radius2(0),
formulaRadius1(),
formulaRadius2(),
rotationAngle(0),
formulaRotationAngle(),
m_transform()
{}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QString &formulaRadius1,
const QString &formulaRadius2, qreal rotationAngle, const QString &formulaRadius2, qreal rotationAngle,
const QString &formulaRotationAngle) const QString &formulaRotationAngle)
: radius1(radius1), : radius1(radius1),
@ -61,38 +49,21 @@ VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, const QStri
formulaRadius1(formulaRadius1), formulaRadius1(formulaRadius1),
formulaRadius2(formulaRadius2), formulaRadius2(formulaRadius2),
rotationAngle(rotationAngle), rotationAngle(rotationAngle),
formulaRotationAngle(formulaRotationAngle), formulaRotationAngle(formulaRotationAngle)
m_transform() {
{} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle) inline VEllipticalArcData::VEllipticalArcData(qreal radius1, qreal radius2, qreal rotationAngle)
: radius1(radius1), : radius1(radius1),
radius2(radius2), radius2(radius2),
formulaRadius1(QString().number(radius1)), formulaRadius1(QString::number(radius1)),
formulaRadius2(QString().number(radius2)), formulaRadius2(QString::number(radius2)),
rotationAngle(rotationAngle), rotationAngle(rotationAngle),
formulaRotationAngle(QString().number(rotationAngle)), formulaRotationAngle(QString::number(rotationAngle))
m_transform() {
{} }
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcData::VEllipticalArcData(const VEllipticalArcData &arc)
: QSharedData(arc),
radius1(arc.radius1),
radius2(arc.radius2),
formulaRadius1(arc.formulaRadius1),
formulaRadius2(arc.formulaRadius2),
rotationAngle(arc.rotationAngle),
formulaRotationAngle(arc.formulaRotationAngle),
m_transform(arc.m_transform)
{}
//---------------------------------------------------------------------------------------------------------------------
VEllipticalArcData::~VEllipticalArcData()
{}
QT_WARNING_POP QT_WARNING_POP
#endif // VELLIPTICALARC_P #endif // VELLIPTICALARC_P

View file

@ -64,8 +64,8 @@ public:
auto operator= (const VGObject &obj) -> VGObject&; auto operator= (const VGObject &obj) -> VGObject&;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VGObject(VGObject &&obj) Q_DECL_NOTHROW; VGObject(VGObject &&obj) noexcept;
auto operator=(VGObject &&obj) Q_DECL_NOTHROW -> VGObject &; auto operator=(VGObject &&obj) noexcept -> VGObject &;
#endif #endif
auto getIdObject() const -> quint32; auto getIdObject() const -> quint32;

View file

@ -29,8 +29,8 @@
#ifndef VGOBJECT_P_H #ifndef VGOBJECT_P_H
#define VGOBJECT_P_H #define VGOBJECT_P_H
#include <QSharedData>
#include "vgeometrydef.h" #include "vgeometrydef.h"
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
@ -45,14 +45,9 @@ class VGObjectData final : public QSharedData
{ {
public: public:
VGObjectData() = default; VGObjectData() = default;
VGObjectData(const GOType &type, const quint32 &idObject, const Draw &mode) VGObjectData(const GOType &type, const quint32 &idObject, const Draw &mode);
:type(type),
idObject(idObject),
mode(mode)
{}
VGObjectData(const VGObjectData &obj) = default; VGObjectData(const VGObjectData &obj) = default;
virtual ~VGObjectData() = default; ~VGObjectData() = default;
/** @brief _id id in container. Ned for arcs, spline and spline paths. */ /** @brief _id id in container. Ned for arcs, spline and spline paths. */
quint32 _id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes) quint32 _id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
@ -76,6 +71,14 @@ private:
Q_DISABLE_ASSIGN_MOVE(VGObjectData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VGObjectData) // NOLINT
}; };
//---------------------------------------------------------------------------------------------------------------------
inline VGObjectData::VGObjectData(const GOType &type, const quint32 &idObject, const Draw &mode)
: type(type),
idObject(idObject),
mode(mode)
{
}
QT_WARNING_POP QT_WARNING_POP
#endif // VGOBJECT_P_H #endif // VGOBJECT_P_H

View file

@ -227,12 +227,12 @@ auto VPlaceLabelItem::operator=(const VPlaceLabelItem &item) -> VPlaceLabelItem
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPlaceLabelItem::VPlaceLabelItem(VPlaceLabelItem &&item) Q_DECL_NOTHROW VPlaceLabelItem::VPlaceLabelItem(VPlaceLabelItem &&item) noexcept
: VPointF(std::move(item)), d(std::move(item.d)) : VPointF(std::move(item)), d(std::move(item.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPlaceLabelItem::operator=(VPlaceLabelItem &&item) Q_DECL_NOTHROW->VPlaceLabelItem & auto VPlaceLabelItem::operator=(VPlaceLabelItem &&item) noexcept->VPlaceLabelItem &
{ {
VPointF::operator=(item); VPointF::operator=(item);
std::swap(d, item.d); std::swap(d, item.d);

View file

@ -48,8 +48,8 @@ public:
auto operator=(const VPlaceLabelItem &item) -> VPlaceLabelItem &; auto operator=(const VPlaceLabelItem &item) -> VPlaceLabelItem &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VPlaceLabelItem(VPlaceLabelItem &&item) Q_DECL_NOTHROW; VPlaceLabelItem(VPlaceLabelItem &&item) noexcept;
auto operator=(VPlaceLabelItem &&item) Q_DECL_NOTHROW->VPlaceLabelItem &; auto operator=(VPlaceLabelItem &&item) noexcept->VPlaceLabelItem &;
#endif #endif
auto GetWidthFormula() const -> QString; auto GetWidthFormula() const -> QString;

View file

@ -28,8 +28,8 @@
#ifndef VPLACELABELITEM_P_H #ifndef VPLACELABELITEM_P_H
#define VPLACELABELITEM_P_H #define VPLACELABELITEM_P_H
#include <QSharedData>
#include "vgeometrydef.h" #include "vgeometrydef.h"
#include <QSharedData>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
@ -41,46 +41,27 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPlaceLabelItemData final : public QSharedData class VPlaceLabelItemData final : public QSharedData
{ {
public: public:
VPlaceLabelItemData() VPlaceLabelItemData() = default;
{} VPlaceLabelItemData(const VPlaceLabelItemData &item) = default;
~VPlaceLabelItemData() = default;
VPlaceLabelItemData(const VPlaceLabelItemData &item) QString width{}; // NOLINT(misc-non-private-member-variables-in-classes)
: QSharedData(item), QString height{}; // NOLINT(misc-non-private-member-variables-in-classes)
width(item.width), QString angle{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
height(item.height), QString visibilityTrigger{'1'}; // NOLINT(misc-non-private-member-variables-in-classes)
angle(item.angle), PlaceLabelType type{PlaceLabelType::Button}; // NOLINT(misc-non-private-member-variables-in-classes)
visibilityTrigger(item.visibilityTrigger), quint32 centerPoint{0}; // NOLINT(misc-non-private-member-variables-in-classes)
type(item.type),
centerPoint(item.centerPoint),
wValue(item.wValue),
hValue(item.hValue),
aValue(item.aValue),
correctionAngle(item.correctionAngle),
isVisible(item.isVisible)
{}
virtual ~VPlaceLabelItemData(); qreal wValue{0}; // NOLINT(misc-non-private-member-variables-in-classes)
qreal hValue{0}; // NOLINT(misc-non-private-member-variables-in-classes)
QString width{}; qreal aValue{0}; // NOLINT(misc-non-private-member-variables-in-classes)
QString height{}; qreal correctionAngle{0}; // NOLINT(misc-non-private-member-variables-in-classes)
QString angle{'0'}; qreal isVisible{1}; // NOLINT(misc-non-private-member-variables-in-classes)
QString visibilityTrigger{'1'};
PlaceLabelType type{PlaceLabelType::Button};
quint32 centerPoint{0};
qreal wValue{0};
qreal hValue{0};
qreal aValue{0};
qreal correctionAngle{0};
qreal isVisible{1};
private: private:
Q_DISABLE_ASSIGN_MOVE(VPlaceLabelItemData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VPlaceLabelItemData) // NOLINT
}; };
VPlaceLabelItemData::~VPlaceLabelItemData()
{}
QT_WARNING_POP QT_WARNING_POP
#endif // VPLACELABELITEM_P_H #endif // VPLACELABELITEM_P_H

View file

@ -104,12 +104,12 @@ auto VPointF::operator=(const VPointF &point) -> VPointF &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPointF::VPointF(VPointF &&point) Q_DECL_NOTHROW VPointF::VPointF(VPointF &&point) noexcept
:VGObject(std::move(point)), d(std::move(point.d)) :VGObject(std::move(point)), d(std::move(point.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VPointF::operator=(VPointF &&point) Q_DECL_NOTHROW->VPointF & auto VPointF::operator=(VPointF &&point) noexcept->VPointF &
{ {
VGObject::operator=(point); VGObject::operator=(point);
std::swap(d, point.d); std::swap(d, point.d);

View file

@ -29,7 +29,7 @@
#ifndef VPOINTF_H #ifndef VPOINTF_H
#define VPOINTF_H #define VPOINTF_H
#include <qcompilerdetection.h>
#include <QMetaType> #include <QMetaType>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QString> #include <QString>
@ -65,8 +65,8 @@ public:
auto operator=(const VPointF &point) -> VPointF &; auto operator=(const VPointF &point) -> VPointF &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VPointF(VPointF &&point) Q_DECL_NOTHROW; VPointF(VPointF &&point) noexcept;
auto operator=(VPointF &&point) Q_DECL_NOTHROW->VPointF &; auto operator=(VPointF &&point) noexcept->VPointF &;
#endif #endif
explicit operator QPointF() const; explicit operator QPointF() const;

View file

@ -33,8 +33,8 @@
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include <QPointF>
#include "../vmisc/defglobal.h" #include "../vmisc/defglobal.h"
#include <QPointF>
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -43,50 +43,56 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VPointFData final : public QSharedData class VPointFData final : public QSharedData
{ {
public: public:
VPointFData() = default;
VPointFData() VPointFData(const VPointFData &point) = default;
: _mx(0), _my(0), _x(0), _y(0), m_showLabel(true) explicit VPointFData(const QPointF &point);
{} VPointFData(qreal x, qreal y, qreal mx, qreal my);
VPointFData(const QPointF &point, qreal mx, qreal my);
VPointFData(const VPointFData &point) ~VPointFData() = default;
:QSharedData(point), _mx(point._mx), _my(point._my), _x(point._x), _y(point._y), m_showLabel(point.m_showLabel)
{}
explicit VPointFData(const QPointF &point)
:_mx(0), _my(0), _x(point.x()), _y(point.y()), m_showLabel(true)
{}
VPointFData(qreal x, qreal y, qreal mx, qreal my)
:_mx(mx), _my(my), _x(x), _y(y), m_showLabel(true)
{}
VPointFData(const QPointF &point, qreal mx, qreal my)
:_mx(mx), _my(my), _x(point.x()), _y(point.y()), m_showLabel(true)
{}
virtual ~VPointFData();
/** @brief _mx offset name respect to x */ /** @brief _mx offset name respect to x */
qreal _mx; qreal _mx{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief _my offset name respect to y */ /** @brief _my offset name respect to y */
qreal _my; qreal _my{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief _x x coordinate */ /** @brief _x x coordinate */
qreal _x; qreal _x{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief _y y coordinate */ /** @brief _y y coordinate */
qreal _y; qreal _y{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief m_hideLabel show or not label for this point */ /** @brief m_hideLabel show or not label for this point */
bool m_showLabel; bool m_showLabel{true}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VPointFData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VPointFData) // NOLINT
}; };
VPointFData::~VPointFData() //---------------------------------------------------------------------------------------------------------------------
{} inline VPointFData::VPointFData(const QPointF &point)
: _x(point.x()),
_y(point.y())
{
}
//---------------------------------------------------------------------------------------------------------------------
inline VPointFData::VPointFData(qreal x, qreal y, qreal mx, qreal my)
: _mx(mx),
_my(my),
_x(x),
_y(y)
{
}
//---------------------------------------------------------------------------------------------------------------------
inline VPointFData::VPointFData(const QPointF &point, qreal mx, qreal my)
: _mx(mx),
_my(my),
_x(point.x()),
_y(point.y())
{
}
QT_WARNING_POP QT_WARNING_POP

View file

@ -269,13 +269,13 @@ auto VSpline::operator =(const VSpline &spline) -> VSpline &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSpline::VSpline(VSpline &&spline) Q_DECL_NOTHROW VSpline::VSpline(VSpline &&spline) noexcept
: VAbstractCubicBezier(std::move(spline)), : VAbstractCubicBezier(std::move(spline)),
d(std::move(spline.d)) d(std::move(spline.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSpline::operator=(VSpline &&spline) Q_DECL_NOTHROW -> VSpline & auto VSpline::operator=(VSpline &&spline) noexcept -> VSpline &
{ {
VAbstractCubicBezier::operator=(spline); VAbstractCubicBezier::operator=(spline);
std::swap(d, spline.d); std::swap(d, spline.d);

View file

@ -29,7 +29,6 @@
#ifndef VSPLINE_H #ifndef VSPLINE_H
#define VSPLINE_H #define VSPLINE_H
#include <qcompilerdetection.h>
#include <QLineF> #include <QLineF>
#include <QMetaType> #include <QMetaType>
#include <QPointF> #include <QPointF>
@ -47,7 +46,7 @@ class VSplineData;
/** /**
* @brief VSpline class that implements the spline. * @brief VSpline class that implements the spline.
*/ */
class VSpline final :public VAbstractCubicBezier class VSpline final : public VAbstractCubicBezier
{ {
public: public:
VSpline(); VSpline();
@ -66,8 +65,8 @@ public:
auto operator=(const VSpline &spline) -> VSpline &; auto operator=(const VSpline &spline) -> VSpline &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VSpline(VSpline &&spline) Q_DECL_NOTHROW; VSpline(VSpline &&spline) noexcept;
auto operator=(VSpline &&spline) Q_DECL_NOTHROW -> VSpline &; auto operator=(VSpline &&spline) noexcept -> VSpline &;
#endif #endif
auto GetP1() const -> VPointF override; auto GetP1() const -> VPointF override;
@ -82,7 +81,7 @@ public:
auto GetStartAngle() const -> qreal override; auto GetStartAngle() const -> qreal override;
auto GetEndAngle() const -> qreal override; auto GetEndAngle() const -> qreal override;
auto GetStartAngleFormula () const -> QString; auto GetStartAngleFormula() const -> QString;
auto GetEndAngleFormula() const -> QString; auto GetEndAngleFormula() const -> QString;
void SetStartAngle(qreal angle, const QString &formula); void SetStartAngle(qreal angle, const QString &formula);
@ -107,8 +106,8 @@ public:
auto GetPoints() const -> QVector<QPointF> override; auto GetPoints() const -> QVector<QPointF> override;
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
static auto SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, static auto SplinePoints(const QPointF &p1, const QPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
qreal kAsm2, qreal kCurve, qreal approximationScale) -> QVector<QPointF>; qreal kCurve, qreal approximationScale) -> QVector<QPointF>;
auto ParamT(const QPointF &pBt) const -> qreal; auto ParamT(const QPointF &pBt) const -> qreal;
auto ToJson() const -> QJsonObject override; auto ToJson() const -> QJsonObject override;
@ -117,10 +116,11 @@ protected:
auto GetControlPoint1() const -> QPointF override; auto GetControlPoint1() const -> QPointF override;
auto GetControlPoint2() const -> QPointF override; auto GetControlPoint2() const -> QPointF override;
auto GetRealLength() const -> qreal override; auto GetRealLength() const -> qreal override;
private: private:
QSharedDataPointer<VSplineData> d; QSharedDataPointer<VSplineData> d;
static auto CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4, static auto CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4, qreal pointCoord)
qreal pointCoord) -> QVector<qreal>; -> QVector<qreal>;
static auto Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) -> qint32; static auto Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) -> qint32;
static auto Sign(long double ld) -> int; static auto Sign(long double ld) -> int;
}; };

View file

@ -29,8 +29,8 @@
#ifndef VSPLINE_P_H #ifndef VSPLINE_P_H
#define VSPLINE_P_H #define VSPLINE_P_H
#include <QSharedData>
#include <QLineF> #include <QLineF>
#include <QSharedData>
#include <QtMath> #include <QtMath>
#include "vpointf.h" #include "vpointf.h"
@ -42,96 +42,64 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VSplineData final : public QSharedData class VSplineData final : public QSharedData
{ {
public: public:
VSplineData(); VSplineData() = default;
VSplineData(const VSplineData &spline); VSplineData(const VSplineData &spline) = default;
VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve); VSplineData(const VPointF &p1, const VPointF &p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2,
VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4); qreal kCurve);
VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &angle1F, qreal angle2, const QString &angle2F, VSplineData(const VPointF &p1, QPointF p2, QPointF p3, const VPointF &p4);
qreal c1Length, const QString &c1LengthF, qreal c2Length, const QString &c2LengthF); VSplineData(const VPointF &p1, const VPointF &p4, qreal angle1, const QString &angle1F, qreal angle2,
virtual ~VSplineData(); const QString &angle2F, qreal c1Length, const QString &c1LengthF, qreal c2Length,
const QString &c2LengthF);
~VSplineData() = default;
static auto GetL(const QPointF &p1, const QPointF &p4, qreal kCurve) -> qreal; static auto GetL(const QPointF &p1, const QPointF &p4, qreal kCurve) -> qreal;
/** @brief p1 first spline point. */ /** @brief p1 first spline point. */
VPointF p1; VPointF p1{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief p4 fourth spline point. */ /** @brief p4 fourth spline point. */
VPointF p4; VPointF p4{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle1 first angle control line. */ /** @brief angle1 first angle control line. */
qreal angle1; qreal angle1{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle1F the first control point angle formula*/ /** @brief angle1F the first control point angle formula*/
QString angle1F; QString angle1F{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle2 second angle control line. */ /** @brief angle2 second angle control line. */
qreal angle2; qreal angle2{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle2F the second control point angle formula*/ /** @brief angle2F the second control point angle formula*/
QString angle2F; QString angle2F{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief c1Length the length from the first spline point to the first control point. */ /** @brief c1Length the length from the first spline point to the first control point. */
qreal c1Length; qreal c1Length{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief c1LengthF the formula from the first spline point to the first control point. */ /** @brief c1LengthF the formula from the first spline point to the first control point. */
QString c1LengthF; QString c1LengthF{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief c2Length the length from the fourth spline point to the second control point. */ /** @brief c2Length the length from the fourth spline point to the second control point. */
qreal c2Length; qreal c2Length{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief c2LengthF the formula length from the fourth spline point to the second control point. */ /** @brief c2LengthF the formula length from the fourth spline point to the second control point. */
QString c2LengthF; QString c2LengthF{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief kCurve coefficient of curvature spline. */ /** @brief kCurve coefficient of curvature spline. */
qreal kCurve; qreal kCurve{1}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VSplineData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VSplineData) // NOLINT
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData() inline VSplineData::VSplineData(const VPointF &p1, const VPointF &p4, qreal angle1, qreal angle2, qreal kAsm1,
: p1(), qreal kAsm2, qreal kCurve)
p4(),
angle1(0),
angle1F('0'),
angle2(0),
angle2F('0'),
c1Length(0),
c1LengthF('0'),
c2Length(0),
c2LengthF('0'),
kCurve(1)
{}
//---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData(const VSplineData &spline)
: QSharedData(spline),
p1(spline.p1),
p4(spline.p4),
angle1(spline.angle1),
angle1F(spline.angle1F),
angle2(spline.angle2),
angle2F(spline.angle2F),
c1Length(spline.c1Length),
c1LengthF(spline.c1LengthF),
c2Length(spline.c2Length),
c2LengthF(spline.c2LengthF),
kCurve(spline.kCurve)
{}
//---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve)
: p1(p1), : p1(p1),
p4(p4), p4(p4),
angle1(angle1), angle1(angle1),
angle1F(QString().number(angle1)), angle1F(QString::number(angle1)),
angle2(angle2), angle2(angle2),
angle2F(QString().number(angle2)), angle2F(QString::number(angle2)),
c1Length(0),
c1LengthF('0'),
c2Length(0),
c2LengthF('0'),
kCurve(kCurve) kCurve(kCurve)
{ {
const qreal L = GetL(static_cast<QPointF>(p1), static_cast<QPointF>(p4), kCurve); const qreal L = GetL(static_cast<QPointF>(p1), static_cast<QPointF>(p4), kCurve);
@ -148,23 +116,14 @@ VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, qreal angle2, qre
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4) inline VSplineData::VSplineData(const VPointF &p1, QPointF p2, QPointF p3, const VPointF &p4)
: p1(p1), : p1(p1),
p4(p4), p4(p4)
angle1(0),
angle1F('0'),
angle2(0),
angle2F('0'),
c1Length(0),
c1LengthF('0'),
c2Length(0),
c2LengthF('0'),
kCurve(1)
{ {
QLineF p1p2(static_cast<QPointF>(p1), static_cast<QPointF>(p2)); QLineF p1p2(static_cast<QPointF>(p1), static_cast<QPointF>(p2));
angle1 = p1p2.angle(); angle1 = p1p2.angle();
angle1F = QString().number(angle1); angle1F = QString::number(angle1);
c1Length = p1p2.length(); c1Length = p1p2.length();
c1LengthF = QString().number(c1Length); c1LengthF = QString().number(c1Length);
@ -172,15 +131,15 @@ VSplineData::VSplineData(VPointF p1, QPointF p2, QPointF p3, VPointF p4)
QLineF p4p3(static_cast<QPointF>(p4), static_cast<QPointF>(p3)); QLineF p4p3(static_cast<QPointF>(p4), static_cast<QPointF>(p3));
angle2 = p4p3.angle(); angle2 = p4p3.angle();
angle2F = QString().number(angle2); angle2F = QString::number(angle2);
c2Length = p4p3.length(); c2Length = p4p3.length();
c2LengthF = QString().number(c2Length); c2LengthF = QString().number(c2Length);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &angle1F, qreal angle2, inline VSplineData::VSplineData(const VPointF &p1, const VPointF &p4, qreal angle1, const QString &angle1F,
const QString &angle2F, qreal c1Length, const QString &c1LengthF, qreal angle2, const QString &angle2F, qreal c1Length, const QString &c1LengthF,
qreal c2Length, const QString &c2LengthF) qreal c2Length, const QString &c2LengthF)
: p1(p1), : p1(p1),
p4(p4), p4(p4),
@ -191,21 +150,17 @@ VSplineData::VSplineData(VPointF p1, VPointF p4, qreal angle1, const QString &an
c1Length(c1Length), c1Length(c1Length),
c1LengthF(c1LengthF), c1LengthF(c1LengthF),
c2Length(c2Length), c2Length(c2Length),
c2LengthF(c2LengthF), c2LengthF(c2LengthF)
kCurve(1) {
{} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplineData::~VSplineData() inline auto VSplineData::GetL(const QPointF &p1, const QPointF &p4, qreal kCurve) -> qreal
{}
//---------------------------------------------------------------------------------------------------------------------
auto VSplineData::GetL(const QPointF &p1, const QPointF &p4, qreal kCurve) -> qreal
{ {
static const qreal angle = 90; static const qreal angle = 90;
qreal length = VFuzzyComparePoints(p1, p4) ? accuracyPointOnLine*2 : QLineF(p1, p4).length(); qreal length = VFuzzyComparePoints(p1, p4) ? accuracyPointOnLine * 2 : QLineF(p1, p4).length();
const qreal radius = length/M_SQRT2; const qreal radius = length / M_SQRT2;
return kCurve * radius * 4 / 3 * qTan( angle * M_PI_4 / 180.0 ); return kCurve * radius * 4 / 3 * qTan(angle * M_PI_4 / 180.0);
} }
QT_WARNING_POP QT_WARNING_POP

View file

@ -33,7 +33,6 @@
#include <QPoint> #include <QPoint>
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#include "vabstractcurve.h" #include "vabstractcurve.h"
#include "vsplinepath_p.h" #include "vsplinepath_p.h"
@ -317,13 +316,13 @@ auto VSplinePath::operator=(const VSplinePath &path) -> VSplinePath &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePath::VSplinePath(VSplinePath &&splPath) Q_DECL_NOTHROW VSplinePath::VSplinePath(VSplinePath &&splPath) noexcept
: VAbstractCubicBezierPath(std::move(splPath)), : VAbstractCubicBezierPath(std::move(splPath)),
d(std::move(splPath.d)) d(std::move(splPath.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePath::operator=(VSplinePath &&path) Q_DECL_NOTHROW->VSplinePath & auto VSplinePath::operator=(VSplinePath &&path) noexcept->VSplinePath &
{ {
VAbstractCubicBezierPath::operator=(path); VAbstractCubicBezierPath::operator=(path);
std::swap(d, path.d); std::swap(d, path.d);

View file

@ -29,7 +29,6 @@
#ifndef VSPLINEPATH_H #ifndef VSPLINEPATH_H
#define VSPLINEPATH_H #define VSPLINEPATH_H
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QPainterPath> #include <QPainterPath>
#include <QPointF> #include <QPointF>
@ -50,53 +49,54 @@ class VSplinePathData;
/** /**
* @brief The VSplinePath class keep information about splinePath. * @brief The VSplinePath class keep information about splinePath.
*/ */
class VSplinePath final :public VAbstractCubicBezierPath class VSplinePath final : public VAbstractCubicBezierPath
{ {
Q_DECLARE_TR_FUNCTIONS(VSplinePath) // NOLINT Q_DECLARE_TR_FUNCTIONS(VSplinePath) // NOLINT
public: public:
explicit VSplinePath(quint32 idObject = 0, Draw mode = Draw::Calculation); explicit VSplinePath(quint32 idObject = 0, Draw mode = Draw::Calculation);
VSplinePath(const QVector<VFSplinePoint> &points, qreal kCurve = 1, quint32 idObject = 0, explicit VSplinePath(const QVector<VFSplinePoint> &points, qreal kCurve = 1, quint32 idObject = 0,
Draw mode = Draw::Calculation); Draw mode = Draw::Calculation);
VSplinePath(const QVector<VSplinePoint> &points, quint32 idObject = 0, Draw mode = Draw::Calculation); explicit VSplinePath(const QVector<VSplinePoint> &points, quint32 idObject = 0, Draw mode = Draw::Calculation);
VSplinePath(const VSplinePath& splPath); VSplinePath(const VSplinePath &splPath);
auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VSplinePath; auto Rotate(const QPointF &originPoint, qreal degrees, const QString &prefix = QString()) const -> VSplinePath;
auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VSplinePath; auto Flip(const QLineF &axis, const QString &prefix = QString()) const -> VSplinePath;
auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VSplinePath; auto Move(qreal length, qreal angle, const QString &prefix = QString()) const -> VSplinePath;
virtual ~VSplinePath() override; ~VSplinePath() override;
auto operator[](vsizetype indx) -> VSplinePoint &; auto operator[](vsizetype indx) -> VSplinePoint &;
auto operator=(const VSplinePath &path) -> VSplinePath &; auto operator=(const VSplinePath &path) -> VSplinePath &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VSplinePath(VSplinePath&& splPath) Q_DECL_NOTHROW; VSplinePath(VSplinePath &&splPath) noexcept;
auto operator=(VSplinePath &&path) Q_DECL_NOTHROW->VSplinePath &; auto operator=(VSplinePath &&path) noexcept -> VSplinePath &;
#endif #endif
void append(const VSplinePoint &point); void append(const VSplinePoint &point);
virtual auto CountSubSpl() const -> vsizetype override; auto CountSubSpl() const -> vsizetype override;
virtual auto CountPoints() const -> vsizetype override; auto CountPoints() const -> vsizetype override;
virtual void Clear() override; void Clear() override;
virtual auto GetSpline(vsizetype index) const -> VSpline override; auto GetSpline(vsizetype index) const -> VSpline override;
virtual auto GetSplinePath() const -> QVector<VSplinePoint> override; auto GetSplinePath() const -> QVector<VSplinePoint> override;
auto GetFSplinePath() const -> QVector<VFSplinePoint>; auto GetFSplinePath() const -> QVector<VFSplinePoint>;
virtual auto GetStartAngle() const -> qreal override; auto GetStartAngle() const -> qreal override;
virtual auto GetEndAngle() const -> qreal override; auto GetEndAngle() const -> qreal override;
virtual auto GetC1Length() const -> qreal override; auto GetC1Length() const -> qreal override;
virtual auto GetC2Length() const -> qreal override; auto GetC2Length() const -> qreal override;
void UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point); void UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point);
auto GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const -> VSplinePoint; auto GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const -> VSplinePoint;
auto at(vsizetype indx) const -> const VSplinePoint &; auto at(vsizetype indx) const -> const VSplinePoint &;
virtual auto ToJson() const -> QJsonObject override; auto ToJson() const -> QJsonObject override;
protected: protected:
virtual auto FirstPoint() const -> VPointF override; auto FirstPoint() const -> VPointF override;
virtual auto LastPoint() const -> VPointF override; auto LastPoint() const -> VPointF override;
private: private:
QSharedDataPointer<VSplinePathData> d; QSharedDataPointer<VSplinePathData> d;

View file

@ -29,8 +29,8 @@
#ifndef VSPLINEPATH_P_H #ifndef VSPLINEPATH_P_H
#define VSPLINEPATH_P_H #define VSPLINEPATH_P_H
#include <QSharedData>
#include "vsplinepoint.h" #include "vsplinepoint.h"
#include <QSharedData>
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -39,28 +39,19 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VSplinePathData final : public QSharedData class VSplinePathData final : public QSharedData
{ {
public: public:
VSplinePathData() = default; VSplinePathData() = default;
VSplinePathData(const VSplinePathData &splPath) = default;
VSplinePathData(const VSplinePathData &splPath) ~VSplinePathData() = default;
: QSharedData(splPath),
path(splPath.path)
{}
virtual ~VSplinePathData();
/** /**
* @brief path list spline point. * @brief path list spline point.
*/ */
QVector<VSplinePoint> path{}; QVector<VSplinePoint> path{}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VSplinePathData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VSplinePathData) // NOLINT
}; };
VSplinePathData::~VSplinePathData()
{}
QT_WARNING_POP QT_WARNING_POP
#endif // VSPLINEPATH_P_H #endif // VSPLINEPATH_P_H

View file

@ -77,12 +77,12 @@ auto VFSplinePoint::operator=(const VFSplinePoint &point) -> VFSplinePoint &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFSplinePoint::VFSplinePoint(VFSplinePoint &&point) Q_DECL_NOTHROW VFSplinePoint::VFSplinePoint(VFSplinePoint &&point) noexcept
:d(std::move(point.d)) :d(std::move(point.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VFSplinePoint::operator=(VFSplinePoint &&point) Q_DECL_NOTHROW->VFSplinePoint & auto VFSplinePoint::operator=(VFSplinePoint &&point) noexcept->VFSplinePoint &
{ {
std::swap(d, point.d); std::swap(d, point.d);
return *this; return *this;
@ -236,12 +236,12 @@ auto VSplinePoint::operator=(const VSplinePoint &point) -> VSplinePoint &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePoint::VSplinePoint(VSplinePoint &&point) Q_DECL_NOTHROW VSplinePoint::VSplinePoint(VSplinePoint &&point) noexcept
: d(std::move(point.d)) : d(std::move(point.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VSplinePoint::operator=(VSplinePoint &&point) Q_DECL_NOTHROW->VSplinePoint & auto VSplinePoint::operator=(VSplinePoint &&point) noexcept->VSplinePoint &
{ {
std::swap(d, point.d); std::swap(d, point.d);
return *this; return *this;
@ -288,7 +288,7 @@ void VSplinePoint::SetAngle1(const qreal &value, const QString &angle1F)
line.setAngle(d->angle1+180); line.setAngle(d->angle1+180);
d->angle2 = line.angle(); d->angle2 = line.angle();
d->angle2F = QString().number(d->angle2); d->angle2F = QString::number(d->angle2);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -314,7 +314,7 @@ void VSplinePoint::SetAngle2(const qreal &value, const QString &angle2F)
line.setAngle(d->angle2+180); line.setAngle(d->angle2+180);
d->angle1 = line.angle(); d->angle1 = line.angle();
d->angle1F = QString().number(d->angle1); d->angle1F = QString::number(d->angle1);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View file

@ -53,8 +53,8 @@ public:
auto operator=(const VFSplinePoint &point) -> VFSplinePoint &; auto operator=(const VFSplinePoint &point) -> VFSplinePoint &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VFSplinePoint(VFSplinePoint &&point) Q_DECL_NOTHROW; VFSplinePoint(VFSplinePoint &&point) noexcept;
auto operator=(VFSplinePoint &&point) Q_DECL_NOTHROW->VFSplinePoint &; auto operator=(VFSplinePoint &&point) noexcept->VFSplinePoint &;
#endif #endif
auto P() const -> VPointF; auto P() const -> VPointF;
@ -91,8 +91,8 @@ public:
auto operator=(const VSplinePoint &point) -> VSplinePoint &; auto operator=(const VSplinePoint &point) -> VSplinePoint &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VSplinePoint(VSplinePoint &&point) Q_DECL_NOTHROW; VSplinePoint(VSplinePoint &&point) noexcept;
auto operator=(VSplinePoint &&point) Q_DECL_NOTHROW->VSplinePoint &; auto operator=(VSplinePoint &&point) noexcept->VSplinePoint &;
#endif #endif
auto P() const -> VPointF; auto P() const -> VPointF;

View file

@ -33,9 +33,9 @@
#include <QSharedData> #include <QSharedData>
#include <QtDebug> #include <QtDebug>
#include "vpointf.h"
#include "../vmisc/def.h"
#include "../qmuparser/qmutokenparser.h" #include "../qmuparser/qmutokenparser.h"
#include "../vmisc/def.h"
#include "vpointf.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -44,131 +44,81 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VFSplinePointData final : public QSharedData class VFSplinePointData final : public QSharedData
{ {
public: public:
VFSplinePointData() = default;
VFSplinePointData() VFSplinePointData(const VPointF &pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2);
: pSpline(VPointF()), VFSplinePointData(const VFSplinePointData &point) = default;
angle1(0), ~VFSplinePointData() = default;
angle2(180),
kAsm1(1),
kAsm2(1)
{}
VFSplinePointData(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2)
: pSpline(pSpline),
angle1(angle1),
angle2(angle2),
kAsm1(kAsm1),
kAsm2(kAsm2)
{
if (VFuzzyComparePossibleNulls(angle1, angle2) || not qFuzzyCompare(qAbs(angle1-angle2), 180) )
{
this->angle2 = this->angle1 + 180;
}
}
VFSplinePointData(const VFSplinePointData &point)
: QSharedData(point),
pSpline(point.pSpline),
angle1(point.angle1),
angle2(point.angle2),
kAsm1(point.kAsm1),
kAsm2(point.kAsm2)
{}
virtual ~VFSplinePointData();
/** @brief pSpline point. */ /** @brief pSpline point. */
VPointF pSpline; VPointF pSpline{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle1 first angle spline. */ /** @brief angle1 first angle spline. */
qreal angle1; qreal angle1{0}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle2 second angle spline. */ /** @brief angle2 second angle spline. */
qreal angle2; qreal angle2{180}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief kAsm1 coefficient of length first control line. */ /** @brief kAsm1 coefficient of length first control line. */
qreal kAsm1; qreal kAsm1{1}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief kAsm2 coefficient of length second control line. */ /** @brief kAsm2 coefficient of length second control line. */
qreal kAsm2; qreal kAsm2{1}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VFSplinePointData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VFSplinePointData) // NOLINT
}; };
VFSplinePointData::~VFSplinePointData() //---------------------------------------------------------------------------------------------------------------------
{} inline VFSplinePointData::VFSplinePointData(const VPointF &pSpline, qreal kAsm1, qreal angle1, qreal kAsm2,
qreal angle2)
: pSpline(pSpline),
angle1(angle1),
angle2(angle2),
kAsm1(kAsm1),
kAsm2(kAsm2)
{
if (VFuzzyComparePossibleNulls(angle1, angle2) || not qFuzzyCompare(qAbs(angle1 - angle2), 180))
{
this->angle2 = this->angle1 + 180;
}
}
//--------------------------------------VSplinePointData--------------------------------------------------------------- //--------------------------------------VSplinePointData---------------------------------------------------------------
class VSplinePointData final : public QSharedData class VSplinePointData final : public QSharedData
{ {
public: public:
VSplinePointData() VSplinePointData() = default;
: pSpline(),
angle1(0),
angle1F('0'),
angle2(180),
angle2F("180"),
length1(ToPixel(0.01, Unit::Mm)),
length1F('0'),
length2(ToPixel(0.01, Unit::Mm)),
length2F('0')
{}
VSplinePointData(VPointF pSpline, qreal angle1, const QString &angle1F, qreal angle2, const QString &angle2F, VSplinePointData(VPointF pSpline, qreal angle1, const QString &angle1F, qreal angle2, const QString &angle2F,
qreal length1, const QString &length1F, qreal length2, const QString &length2F); qreal length1, const QString &length1F, qreal length2, const QString &length2F);
VSplinePointData(const VSplinePointData &point);
VSplinePointData(const VSplinePointData &point) ~VSplinePointData() = default;
: QSharedData(point),
pSpline(point.pSpline),
angle1(point.angle1),
angle1F(point.angle1F),
angle2(point.angle2),
angle2F(point.angle2F),
length1(point.length1),
length1F(point.length1F),
length2(point.length2),
length2F(point.length2F)
{
if (qFuzzyIsNull(this->length1))
{
this->length1 = ToPixel(0.01, Unit::Mm);
}
if (qFuzzyIsNull(this->length2))
{
this->length2 = ToPixel(0.01, Unit::Mm);
}
}
virtual ~VSplinePointData();
/** @brief pSpline point. */ /** @brief pSpline point. */
VPointF pSpline; VPointF pSpline{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle1 first angle spline. */ /** @brief angle1 first angle spline. */
qreal angle1; qreal angle1{0}; // NOLINT(misc-non-private-member-variables-in-classes)
QString angle1F; QString angle1F{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief angle2 second angle spline. */ /** @brief angle2 second angle spline. */
qreal angle2; qreal angle2{180}; // NOLINT(misc-non-private-member-variables-in-classes)
QString angle2F; QString angle2F{QStringLiteral("180")}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief length1 length a first control line. */ /** @brief length1 length a first control line. */
qreal length1; qreal length1{ToPixel(0.01, Unit::Mm)}; // NOLINT(misc-non-private-member-variables-in-classes)
QString length1F; QString length1F{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief length2 length a second control line. */ /** @brief length2 length a second control line. */
qreal length2; qreal length2{ToPixel(0.01, Unit::Mm)}; // NOLINT(misc-non-private-member-variables-in-classes)
QString length2F; QString length2F{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VSplinePointData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VSplinePointData) // NOLINT
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePointData::VSplinePointData(VPointF pSpline, qreal angle1, const QString &angle1F, qreal angle2, inline VSplinePointData::VSplinePointData(VPointF pSpline, qreal angle1, const QString &angle1F, qreal angle2,
const QString &angle2F, qreal length1, const QString &length1F, qreal length2, const QString &angle2F, qreal length1, const QString &length1F, qreal length2,
const QString &length2F) const QString &length2F)
: pSpline(pSpline), : pSpline(pSpline),
@ -181,21 +131,21 @@ VSplinePointData::VSplinePointData(VPointF pSpline, qreal angle1, const QString
length2(length2), length2(length2),
length2F(length2F) length2F(length2F)
{ {
if (not VFuzzyComparePossibleNulls(qAbs(angle1-angle2), 180)) if (not VFuzzyComparePossibleNulls(qAbs(angle1 - angle2), 180))
{ {
QLineF line (0, 0, 100, 0); QLineF line(0, 0, 100, 0);
if (not qmu::QmuTokenParser::IsSingle(angle1F) || qmu::QmuTokenParser::IsSingle(angle2F)) if (not qmu::QmuTokenParser::IsSingle(angle1F) || qmu::QmuTokenParser::IsSingle(angle2F))
{ {
line.setAngle(angle1 + 180); line.setAngle(angle1 + 180);
this->angle2 = line.angle(); this->angle2 = line.angle();
this->angle2F = QString().number(line.angle()); this->angle2F = QString::number(line.angle());
} }
else else
{ {
line.setAngle(angle2 + 180); line.setAngle(angle2 + 180);
this->angle1 = line.angle(); this->angle1 = line.angle();
this->angle1F = QString().number(line.angle()); this->angle1F = QString::number(line.angle());
} }
} }
@ -211,8 +161,28 @@ VSplinePointData::VSplinePointData(VPointF pSpline, qreal angle1, const QString
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSplinePointData::~VSplinePointData() inline VSplinePointData::VSplinePointData(const VSplinePointData &point)
{} : QSharedData(point),
pSpline(point.pSpline),
angle1(point.angle1),
angle1F(point.angle1F),
angle2(point.angle2),
angle2F(point.angle2F),
length1(point.length1),
length1F(point.length1F),
length2(point.length2),
length2F(point.length2F)
{
if (qFuzzyIsNull(this->length1))
{
this->length1 = ToPixel(0.01, Unit::Mm);
}
if (qFuzzyIsNull(this->length2))
{
this->length2 = ToPixel(0.01, Unit::Mm);
}
}
QT_WARNING_POP QT_WARNING_POP

View file

@ -931,12 +931,12 @@ auto VAbstractPiece::operator=(const VAbstractPiece &piece) -> VAbstractPiece &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractPiece::VAbstractPiece(VAbstractPiece &&piece) Q_DECL_NOTHROW VAbstractPiece::VAbstractPiece(VAbstractPiece &&piece) noexcept
:d (std::move(piece.d)) :d (std::move(piece.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractPiece::operator=(VAbstractPiece &&piece) Q_DECL_NOTHROW -> VAbstractPiece & auto VAbstractPiece::operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiece &
{ {
std::swap(d, piece.d); std::swap(d, piece.d);
return *this; return *this;

View file

@ -60,8 +60,8 @@ public:
auto operator=(const VAbstractPiece &piece) -> VAbstractPiece &; auto operator=(const VAbstractPiece &piece) -> VAbstractPiece &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VAbstractPiece(VAbstractPiece &&piece) Q_DECL_NOTHROW; VAbstractPiece(VAbstractPiece &&piece) noexcept;
auto operator=(VAbstractPiece &&piece) Q_DECL_NOTHROW -> VAbstractPiece &; auto operator=(VAbstractPiece &&piece) noexcept -> VAbstractPiece &;
#endif #endif
auto GetName() const -> QString; auto GetName() const -> QString;

View file

@ -29,9 +29,9 @@
#ifndef VABSTRACTPIECE_P_H #ifndef VABSTRACTPIECE_P_H
#define VABSTRACTPIECE_P_H #define VABSTRACTPIECE_P_H
#include <QCoreApplication>
#include <QSharedData> #include <QSharedData>
#include <QString> #include <QString>
#include <QCoreApplication>
#include <QUuid> #include <QUuid>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
@ -39,11 +39,11 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" #include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../vmisc/defglobal.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "../vmisc/defglobal.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -52,15 +52,14 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VAbstractPieceData : public QSharedData class VAbstractPieceData : public QSharedData
{ {
Q_DECLARE_TR_FUNCTIONS(VAbstractPieceData) // NOLINT Q_DECLARE_TR_FUNCTIONS(VAbstractPieceData) // NOLINT
public: public:
VAbstractPieceData() = default; VAbstractPieceData() = default;
VAbstractPieceData(const VAbstractPieceData &piece) = default; VAbstractPieceData(const VAbstractPieceData &piece) = default;
~VAbstractPieceData() = default; ~VAbstractPieceData() = default;
friend auto operator<<(QDataStream& dataStream, const VAbstractPieceData& piece) -> QDataStream&; friend auto operator<<(QDataStream &dataStream, const VAbstractPieceData &piece) -> QDataStream &;
friend auto operator>>(QDataStream& dataStream, VAbstractPieceData& piece) -> QDataStream&; friend auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QDataStream &;
QString m_name{tr("Detail")}; // NOLINT (misc-non-private-member-variables-in-classes) QString m_name{tr("Detail")}; // NOLINT (misc-non-private-member-variables-in-classes)
/** @brief forbidFlipping forbid piece be mirrored in a layout. */ /** @brief forbidFlipping forbid piece be mirrored in a layout. */
@ -142,7 +141,8 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD
{ {
QString message = QCoreApplication::tr("VAbstractPieceData compatibility error: actualClassVersion = %1 and " QString message = QCoreApplication::tr("VAbstractPieceData compatibility error: actualClassVersion = %1 and "
"classVersion = %2") "classVersion = %2")
.arg(actualClassVersion).arg(VAbstractPieceData::classVersion); .arg(actualClassVersion)
.arg(VAbstractPieceData::classVersion);
throw VException(message); throw VException(message);
} }
@ -175,4 +175,3 @@ inline auto operator>>(QDataStream &dataStream, VAbstractPieceData &piece) -> QD
} }
#endif // VABSTRACTPIECE_P_H #endif // VABSTRACTPIECE_P_H

View file

@ -71,12 +71,12 @@ auto VBestSquare::operator=(const VBestSquare &res) -> VBestSquare &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBestSquare::VBestSquare(VBestSquare &&res) Q_DECL_NOTHROW VBestSquare::VBestSquare(VBestSquare &&res) noexcept
: d(std::move(res.d)) : d(std::move(res.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VBestSquare::operator=(VBestSquare &&res) Q_DECL_NOTHROW->VBestSquare & auto VBestSquare::operator=(VBestSquare &&res) noexcept->VBestSquare &
{ {
std::swap(d, res.d); std::swap(d, res.d);
return *this; return *this;

View file

@ -49,8 +49,8 @@ public:
auto operator=(const VBestSquare &res) -> VBestSquare &; auto operator=(const VBestSquare &res) -> VBestSquare &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VBestSquare(VBestSquare &&res) Q_DECL_NOTHROW; VBestSquare(VBestSquare &&res) noexcept;
auto operator=(VBestSquare &&res) Q_DECL_NOTHROW->VBestSquare &; auto operator=(VBestSquare &&res) noexcept->VBestSquare &;
#endif #endif
void NewResult(const VBestSquareResData &data); void NewResult(const VBestSquareResData &data);

View file

@ -44,40 +44,20 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VBestSquareData : public QSharedData class VBestSquareData : public QSharedData
{ {
public: public:
VBestSquareData() VBestSquareData() = default;
{} VBestSquareData(const QSizeF &sheetSize, bool saveLength, bool isPortrait);
VBestSquareData(const QSizeF &sheetSize, bool saveLength, bool isPortrait) VBestSquareData(const VBestSquareData &res) = default;
: isValid(true), ~VBestSquareData() = default;
sheetSize(sheetSize),
saveLength(saveLength),
isPortrait(isPortrait)
{
data.bestSize = QSizeF(sheetSize.width()+10, sheetSize.height()+10);
}
VBestSquareData(const VBestSquareData &res) bool isValid{false}; // NOLINT (misc-non-private-member-variables-in-classes)
: QSharedData(res), QSizeF sheetSize{}; // NOLINT (misc-non-private-member-variables-in-classes)
isValid(res.isValid), bool valideResult{false}; // NOLINT (misc-non-private-member-variables-in-classes)
sheetSize(res.sheetSize), bool saveLength{false}; // NOLINT (misc-non-private-member-variables-in-classes)
valideResult(res.valideResult), VBestSquareResData data{}; // NOLINT (misc-non-private-member-variables-in-classes)
saveLength(res.saveLength), bool isPortrait{true}; // NOLINT (misc-non-private-member-variables-in-classes)
data(res.data), bool terminatedByException{false}; // NOLINT (misc-non-private-member-variables-in-classes)
isPortrait(res.isPortrait), QString exceptionReason{}; // NOLINT (misc-non-private-member-variables-in-classes)
terminatedByException(res.terminatedByException),
exceptionReason(res.exceptionReason)
{}
~VBestSquareData() {}
bool isValid{false};
QSizeF sheetSize{};
bool valideResult{false};
bool saveLength{false};
VBestSquareResData data{};
bool isPortrait{true};
bool terminatedByException{false};
QString exceptionReason{};
private: private:
Q_DISABLE_ASSIGN_MOVE(VBestSquareData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VBestSquareData) // NOLINT
@ -85,4 +65,14 @@ private:
QT_WARNING_POP QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
inline VBestSquareData::VBestSquareData(const QSizeF &sheetSize, bool saveLength, bool isPortrait)
: isValid(true),
sheetSize(sheetSize),
saveLength(saveLength),
isPortrait(isPortrait)
{
data.bestSize = QSizeF(sheetSize.width() + 10, sheetSize.height() + 10);
}
#endif // VBESTSQUARE_P_H #endif // VBESTSQUARE_P_H

View file

@ -38,7 +38,6 @@
#include "vcontour_p.h" #include "vcontour_p.h"
#include "vlayoutpiece.h" #include "vlayoutpiece.h"
#include "../vmisc/vmath.h"
#include "../vgeometry/vgeometrydef.h" #include "../vgeometry/vgeometrydef.h"
#include "../vgeometry/vgobject.h" #include "../vgeometry/vgobject.h"
@ -122,12 +121,12 @@ auto VContour::operator=(const VContour &contour) -> VContour &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VContour::VContour(VContour &&contour) Q_DECL_NOTHROW VContour::VContour(VContour &&contour) noexcept
:d (std::move(contour.d)) :d (std::move(contour.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VContour::operator=(VContour &&contour) Q_DECL_NOTHROW->VContour & auto VContour::operator=(VContour &&contour) noexcept->VContour &
{ {
std::swap(d, contour.d); std::swap(d, contour.d);
return *this; return *this;

View file

@ -56,8 +56,8 @@ public:
auto operator=(const VContour &contour) -> VContour &; auto operator=(const VContour &contour) -> VContour &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VContour(VContour &&contour) Q_DECL_NOTHROW; VContour(VContour &&contour) noexcept;
auto operator=(VContour &&contour) Q_DECL_NOTHROW->VContour &; auto operator=(VContour &&contour) noexcept->VContour &;
#endif #endif
void CeateEmptySheetContour(); void CeateEmptySheetContour();

View file

@ -29,11 +29,11 @@
#ifndef VCONTOUR_P_H #ifndef VCONTOUR_P_H
#define VCONTOUR_P_H #define VCONTOUR_P_H
#include <QSharedData>
#include <QPointF>
#include <QVector>
#include <QRectF>
#include <QPainterPath> #include <QPainterPath>
#include <QPointF>
#include <QRectF>
#include <QSharedData>
#include <QVector>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
@ -47,41 +47,25 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VContourData : public QSharedData class VContourData : public QSharedData
{ {
public: public:
VContourData() VContourData() = default;
{} VContourData(int height, int width, qreal layoutWidth);
VContourData(const VContourData &contour) = default;
VContourData(int height, int width, qreal layoutWidth) ~VContourData() = default;
: paperHeight(height),
paperWidth(width),
layoutWidth(layoutWidth)
{}
VContourData(const VContourData &contour)
: QSharedData(contour),
globalContour(contour.globalContour),
paperHeight(contour.paperHeight),
paperWidth(contour.paperWidth),
shift(contour.shift),
layoutWidth(contour.layoutWidth),
m_emptySheetEdgesCount(contour.m_emptySheetEdgesCount)
{}
~VContourData() {}
/** @brief globalContour list of global points contour. */ /** @brief globalContour list of global points contour. */
QVector<QPointF> globalContour{}; QVector<QPointF> globalContour{}; // NOLINT (misc-non-private-member-variables-in-classes)
/** @brief paperHeight height of paper in pixels*/ /** @brief paperHeight height of paper in pixels*/
int paperHeight{0}; int paperHeight{0}; // NOLINT (misc-non-private-member-variables-in-classes)
/** @brief paperWidth width of paper in pixels*/ /** @brief paperWidth width of paper in pixels*/
int paperWidth{0}; int paperWidth{0}; // NOLINT (misc-non-private-member-variables-in-classes)
qreal shift{0}; qreal shift{0}; // NOLINT (misc-non-private-member-variables-in-classes)
qreal layoutWidth{0}; qreal layoutWidth{0}; // NOLINT (misc-non-private-member-variables-in-classes)
vsizetype m_emptySheetEdgesCount{0}; vsizetype m_emptySheetEdgesCount{0}; // NOLINT (misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VContourData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VContourData) // NOLINT
@ -90,4 +74,12 @@ private:
// cppcheck-suppress unknownMacro // cppcheck-suppress unknownMacro
QT_WARNING_POP QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
inline VContourData::VContourData(int height, int width, qreal layoutWidth)
: paperHeight(height),
paperWidth(width),
layoutWidth(layoutWidth)
{
}
#endif // VCONTOUR_P_H #endif // VCONTOUR_P_H

View file

@ -29,7 +29,7 @@
#ifndef VLAYOUTGENERATOR_H #ifndef VLAYOUTGENERATOR_H
#define VLAYOUTGENERATOR_H #define VLAYOUTGENERATOR_H
#include <qcompilerdetection.h>
#include <QList> #include <QList>
#include <QMetaObject> #include <QMetaObject>
#include <QObject> #include <QObject>

View file

@ -47,33 +47,36 @@
#include <QMutex> #include <QMutex>
#endif #endif
#include "vbestsquare.h"
#include "vcontour.h"
#include "vlayoutpiece.h"
#include "vlayoutpaper_p.h"
#include "vposition.h"
#include "../ifc/exception/vexceptionterminatedposition.h" #include "../ifc/exception/vexceptionterminatedposition.h"
#include "../vmisc/compatibility.h" #include "../vmisc/compatibility.h"
#include "vbestsquare.h"
#include "vcontour.h"
#include "vlayoutpaper_p.h"
#include "vlayoutpiece.h"
#include "vposition.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::VLayoutPaper() VLayoutPaper::VLayoutPaper()
:d(new VLayoutPaperData) : d(new VLayoutPaperData)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::VLayoutPaper(int height, int width, qreal layoutWidth) VLayoutPaper::VLayoutPaper(int height, int width, qreal layoutWidth)
:d(new VLayoutPaperData(height, width, layoutWidth)) : d(new VLayoutPaperData(height, width, layoutWidth))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::VLayoutPaper(const VLayoutPaper &paper) VLayoutPaper::VLayoutPaper(const VLayoutPaper &paper)
:d (paper.d) : d(paper.d)
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPaper::operator=(const VLayoutPaper &paper) -> VLayoutPaper & auto VLayoutPaper::operator=(const VLayoutPaper &paper) -> VLayoutPaper &
{ {
if ( &paper == this ) if (&paper == this)
{ {
return *this; return *this;
} }
@ -83,12 +86,13 @@ auto VLayoutPaper::operator=(const VLayoutPaper &paper) -> VLayoutPaper &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::VLayoutPaper(VLayoutPaper &&paper) Q_DECL_NOTHROW VLayoutPaper::VLayoutPaper(VLayoutPaper &&paper) noexcept
:d (std::move(paper.d)) : d(std::move(paper.d))
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPaper::operator=(VLayoutPaper &&paper) Q_DECL_NOTHROW->VLayoutPaper & auto VLayoutPaper::operator=(VLayoutPaper &&paper) noexcept -> VLayoutPaper &
{ {
std::swap(d, paper.d); std::swap(d, paper.d);
return *this; return *this;
@ -97,7 +101,8 @@ auto VLayoutPaper::operator=(VLayoutPaper &&paper) Q_DECL_NOTHROW->VLayoutPaper
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPaper::~VLayoutPaper() VLayoutPaper::~VLayoutPaper()
{} {
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPaper::GetHeight() const -> int auto VLayoutPaper::GetHeight() const -> int
@ -229,7 +234,7 @@ auto VLayoutPaper::ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &s
{ {
if (detail.LayoutEdgesCount() < 3 || detail.DetailEdgesCount() < 3) if (detail.LayoutEdgesCount() < 3 || detail.DetailEdgesCount() < 3)
{ {
return false;//Not enough edges return false; // Not enough edges
} }
if ((detail.IsForceFlipping() || detail.IsForbidFlipping()) && not d->globalRotate) if ((detail.IsForceFlipping() || detail.IsForbidFlipping()) && not d->globalRotate)
@ -285,7 +290,7 @@ auto VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
if (bestResult.HasValidResult()) if (bestResult.HasValidResult())
{ {
VLayoutPiece workDetail = detail; VLayoutPiece workDetail = detail;
workDetail.SetMatrix(bestResult.Matrix());// Don't forget set matrix workDetail.SetMatrix(bestResult.Matrix()); // Don't forget set matrix
workDetail.SetMirror(bestResult.Mirror()); workDetail.SetMirror(bestResult.Mirror());
if (d->saveLength) if (d->saveLength)
@ -293,9 +298,8 @@ auto VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
d->globalContour.CeateEmptySheetContour(); d->globalContour.CeateEmptySheetContour();
} }
const QVector<QPointF> newGContour = d->globalContour.UniteWithContour(workDetail, bestResult.GContourEdge(), const QVector<QPointF> newGContour = d->globalContour.UniteWithContour(
bestResult.DetailEdge(), workDetail, bestResult.GContourEdge(), bestResult.DetailEdge(), bestResult.Type());
bestResult.Type());
if (newGContour.isEmpty()) if (newGContour.isEmpty())
{ {
return false; return false;
@ -310,9 +314,9 @@ auto VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutPiece
d->positionsCache.append(positionChache); d->positionsCache.append(positionChache);
#ifdef LAYOUT_DEBUG #ifdef LAYOUT_DEBUG
# ifdef SHOW_BEST #ifdef SHOW_BEST
VPosition::DumpFrame(d->globalContour, workDetail, mutex, d->details); VPosition::DumpFrame(d->globalContour, workDetail, mutex, d->details);
# endif #endif
#endif #endif
} }
else if (bestResult.IsTerminatedByException()) else if (bestResult.IsTerminatedByException())
@ -390,23 +394,23 @@ auto VLayoutPaper::GetGlobalContour() const -> QGraphicsPathItem *
const qreal radius = 1; const qreal radius = 1;
for (auto point : points) for (auto point : points)
{ {
path.addEllipse(point.x()-radius, point.y()-radius, radius*2, radius*2); path.addEllipse(point.x() - radius, point.y() - radius, radius * 2, radius * 2);
} }
for (int i=0; i < points.size()-1; ++i) for (int i = 0; i < points.size() - 1; ++i)
{ {
QLineF line(points.at(i), points.at(i+1)); QLineF line(points.at(i), points.at(i + 1));
line.setLength(line.length()/2); line.setLength(line.length() / 2);
path.moveTo(line.p2()); path.moveTo(line.p2());
QLineF side1(line.p2(), line.p1()); QLineF side1(line.p2(), line.p1());
side1.setAngle(side1.angle()+35); side1.setAngle(side1.angle() + 35);
side1.setLength(3); side1.setLength(3);
path.lineTo(side1.p2()); path.lineTo(side1.p2());
path.moveTo(line.p2()); path.moveTo(line.p2());
QLineF side2(line.p2(), line.p1()); QLineF side2(line.p2(), line.p1());
side2.setAngle(side2.angle()-35); side2.setAngle(side2.angle() - 35);
side2.setLength(3); side2.setLength(3);
path.lineTo(side2.p2()); path.lineTo(side2.p2());
} }

View file

@ -29,7 +29,7 @@
#ifndef VLAYOUTPAPER_H #ifndef VLAYOUTPAPER_H
#define VLAYOUTPAPER_H #define VLAYOUTPAPER_H
#include <qcompilerdetection.h>
#include <QSharedDataPointer> #include <QSharedDataPointer>
#include <QTypeInfo> #include <QTypeInfo>
#include <QtGlobal> #include <QtGlobal>
@ -58,8 +58,8 @@ public:
auto operator=(const VLayoutPaper &paper) -> VLayoutPaper &; auto operator=(const VLayoutPaper &paper) -> VLayoutPaper &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VLayoutPaper(VLayoutPaper &&paper) Q_DECL_NOTHROW; VLayoutPaper(VLayoutPaper &&paper) noexcept;
auto operator=(VLayoutPaper &&paper) Q_DECL_NOTHROW->VLayoutPaper &; auto operator=(VLayoutPaper &&paper) noexcept->VLayoutPaper &;
#endif #endif
auto GetHeight() const -> int; auto GetHeight() const -> int;

View file

@ -29,12 +29,12 @@
#ifndef VLAYOUTPAPER_P_H #ifndef VLAYOUTPAPER_P_H
#define VLAYOUTPAPER_P_H #define VLAYOUTPAPER_P_H
#include <QPointF>
#include <QSharedData> #include <QSharedData>
#include <QVector> #include <QVector>
#include <QPointF>
#include "vlayoutpiece.h"
#include "vcontour.h" #include "vcontour.h"
#include "vlayoutpiece.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -43,49 +43,28 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLayoutPaperData : public QSharedData class VLayoutPaperData : public QSharedData
{ {
public: public:
VLayoutPaperData() VLayoutPaperData() = default;
{} VLayoutPaperData(int height, int width, qreal layoutWidth);
VLayoutPaperData(const VLayoutPaperData &paper) = default;
VLayoutPaperData(int height, int width, qreal layoutWidth) ~VLayoutPaperData() = default;
: globalContour(VContour(height, width, layoutWidth)),
layoutWidth(layoutWidth)
{}
VLayoutPaperData(const VLayoutPaperData &paper)
: QSharedData(paper),
details(paper.details),
positionsCache(paper.positionsCache),
globalContour(paper.globalContour),
paperIndex(paper.paperIndex),
layoutWidth(paper.layoutWidth),
globalRotate(paper.globalRotate),
localRotate(paper.localRotate),
globalRotationNumber(paper.globalRotationNumber),
localRotationNumber(paper.localRotationNumber),
saveLength(paper.saveLength),
followGrainline(paper.followGrainline),
originPaperOrientation(paper.originPaperOrientation)
{}
~VLayoutPaperData() {}
/** @brief details list of arranged details. */ /** @brief details list of arranged details. */
QVector<VLayoutPiece> details{}; QVector<VLayoutPiece> details{}; // NOLINT (misc-non-private-member-variables-in-classes)
QVector<VCachedPositions> positionsCache{}; QVector<VCachedPositions> positionsCache{}; // NOLINT (misc-non-private-member-variables-in-classes)
/** @brief globalContour list of global points contour. */ /** @brief globalContour list of global points contour. */
VContour globalContour{}; VContour globalContour{}; // NOLINT (misc-non-private-member-variables-in-classes)
quint32 paperIndex{0}; quint32 paperIndex{0}; // NOLINT (misc-non-private-member-variables-in-classes)
qreal layoutWidth{0}; qreal layoutWidth{0}; // NOLINT (misc-non-private-member-variables-in-classes)
bool globalRotate{true}; bool globalRotate{true}; // NOLINT (misc-non-private-member-variables-in-classes)
bool localRotate{true}; bool localRotate{true}; // NOLINT (misc-non-private-member-variables-in-classes)
int globalRotationNumber{2}; int globalRotationNumber{2}; // NOLINT (misc-non-private-member-variables-in-classes)
int localRotationNumber{2}; int localRotationNumber{2}; // NOLINT (misc-non-private-member-variables-in-classes)
bool saveLength{false}; bool saveLength{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool followGrainline{false}; bool followGrainline{false}; // NOLINT (misc-non-private-member-variables-in-classes)
bool originPaperOrientation{true}; bool originPaperOrientation{true}; // NOLINT (misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VLayoutPaperData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VLayoutPaperData) // NOLINT
@ -93,4 +72,11 @@ private:
QT_WARNING_POP QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
inline VLayoutPaperData::VLayoutPaperData(int height, int width, qreal layoutWidth)
: globalContour(VContour(height, width, layoutWidth)),
layoutWidth(layoutWidth)
{
}
#endif // VLAYOUTPAPER_P_H #endif // VLAYOUTPAPER_P_H

View file

@ -615,13 +615,13 @@ auto VLayoutPiece::operator=(const VLayoutPiece &detail) -> VLayoutPiece &
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW : VAbstractPiece(std::move(detail)), VLayoutPiece::VLayoutPiece(VLayoutPiece &&detail) noexcept : VAbstractPiece(std::move(detail)),
d(std::move(detail.d)) d(std::move(detail.d))
{ {
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW auto VLayoutPiece::operator=(VLayoutPiece &&detail) noexcept
->VLayoutPiece & ->VLayoutPiece &
{ {
VAbstractPiece::operator=(detail); VAbstractPiece::operator=(detail);

View file

@ -90,8 +90,8 @@ public:
auto operator=(const VLayoutPiece &detail) -> VLayoutPiece &; auto operator=(const VLayoutPiece &detail) -> VLayoutPiece &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VLayoutPiece(VLayoutPiece &&detail) Q_DECL_NOTHROW; VLayoutPiece(VLayoutPiece &&detail) noexcept;
auto operator=(VLayoutPiece &&detail) Q_DECL_NOTHROW auto operator=(VLayoutPiece &&detail) noexcept
->VLayoutPiece &; ->VLayoutPiece &;
#endif #endif

View file

@ -29,10 +29,10 @@
#ifndef VLAYOUTDETAIL_P_H #ifndef VLAYOUTDETAIL_P_H
#define VLAYOUTDETAIL_P_H #define VLAYOUTDETAIL_P_H
#include <QSharedData>
#include <QPointF> #include <QPointF>
#include <QVector> #include <QSharedData>
#include <QTransform> #include <QTransform>
#include <QVector>
#include "../vpatterndb/floatItemData/floatitemdef.h" #include "../vpatterndb/floatItemData/floatitemdef.h"
#include "../vwidgets/vpiecegrainline.h" #include "../vwidgets/vpiecegrainline.h"
@ -43,15 +43,15 @@
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" #include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "vlayoutpiecepath.h"
#include "../vgeometry/vgeometrydef.h"
#include "vtextmanager.h"
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
#include "vlayoutpoint.h" #include "../vgeometry/vgeometrydef.h"
#include "../vgeometry/vlayoutplacelabel.h" #include "../vgeometry/vlayoutplacelabel.h"
#include "vlayoutpiecepath.h"
#include "vlayoutpoint.h"
#include "vtextmanager.h"
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++") QT_WARNING_DISABLE_GCC("-Weffc++")
@ -60,13 +60,12 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLayoutPieceData : public QSharedData class VLayoutPieceData : public QSharedData
{ {
public: public:
VLayoutPieceData(){} // NOLINT(modernize-use-equals-default) VLayoutPieceData() = default;
VLayoutPieceData(const VLayoutPieceData &detail) = default; VLayoutPieceData(const VLayoutPieceData &detail) = default;
~VLayoutPieceData() = default; ~VLayoutPieceData() = default;
friend auto operator<<(QDataStream& dataStream, const VLayoutPieceData& piece) -> QDataStream&; friend auto operator<<(QDataStream &dataStream, const VLayoutPieceData &piece) -> QDataStream &;
friend auto operator>>(QDataStream& dataStream, VLayoutPieceData& piece) -> QDataStream&; friend auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDataStream &;
/** @brief contour list of contour points. */ /** @brief contour list of contour points. */
QVector<VLayoutPoint> m_contour{}; // NOLINT(misc-non-private-member-variables-in-classes) QVector<VLayoutPoint> m_contour{}; // NOLINT(misc-non-private-member-variables-in-classes)
@ -187,7 +186,8 @@ inline auto operator>>(QDataStream &dataStream, VLayoutPieceData &piece) -> QDat
{ {
QString message = QCoreApplication::tr("VLayoutPieceData compatibility error: actualClassVersion = %1 and " QString message = QCoreApplication::tr("VLayoutPieceData compatibility error: actualClassVersion = %1 and "
"classVersion = %2") "classVersion = %2")
.arg(actualClassVersion).arg(VLayoutPieceData::classVersion); .arg(actualClassVersion)
.arg(VLayoutPieceData::classVersion);
throw VException(message); throw VException(message);
} }

View file

@ -77,12 +77,12 @@ auto VLayoutPiecePath::operator=(const VLayoutPiecePath &path) -> VLayoutPiecePa
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VLayoutPiecePath::VLayoutPiecePath(VLayoutPiecePath &&path) Q_DECL_NOTHROW VLayoutPiecePath::VLayoutPiecePath(VLayoutPiecePath &&path) noexcept
: d(std::move(path.d)) : d(std::move(path.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiecePath::operator=(VLayoutPiecePath &&path) Q_DECL_NOTHROW->VLayoutPiecePath & auto VLayoutPiecePath::operator=(VLayoutPiecePath &&path) noexcept->VLayoutPiecePath &
{ {
std::swap(d, path.d); std::swap(d, path.d);
return *this; return *this;

View file

@ -29,17 +29,17 @@
#ifndef VLAYOUTPIECEPATH_P_H #ifndef VLAYOUTPIECEPATH_P_H
#define VLAYOUTPIECEPATH_P_H #define VLAYOUTPIECEPATH_P_H
#include <QSharedData>
#include <QPointF>
#include <QVector>
#include <QDataStream> #include <QDataStream>
#include <QPointF>
#include <QSharedData>
#include <QVector>
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#include "../vmisc/diagnostic.h" #include "../vmisc/diagnostic.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
# include "../vmisc/vdatastreamenum.h" #include "../vmisc/vdatastreamenum.h"
#endif #endif
#include "../ifc/exception/vexception.h" #include "../ifc/exception/vexception.h"
@ -52,12 +52,8 @@ QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
class VLayoutPiecePathData : public QSharedData class VLayoutPiecePathData : public QSharedData
{ {
public: public:
VLayoutPiecePathData(){} // NOLINT(modernize-use-equals-default) VLayoutPiecePathData() = default;
explicit VLayoutPiecePathData(const QVector<VLayoutPoint> &points);
explicit VLayoutPiecePathData(const QVector<VLayoutPoint> &points)
: m_points(points)
{}
VLayoutPiecePathData(const VLayoutPiecePathData &path) = default; VLayoutPiecePathData(const VLayoutPiecePathData &path) = default;
~VLayoutPiecePathData() = default; ~VLayoutPiecePathData() = default;
@ -65,12 +61,12 @@ public:
friend auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> QDataStream &; friend auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> QDataStream &;
/** @brief m_points list of path points. */ /** @brief m_points list of path points. */
QVector<VLayoutPoint> m_points{}; QVector<VLayoutPoint> m_points{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief m_penStyle path pen style. */ /** @brief m_penStyle path pen style. */
Qt::PenStyle m_penStyle{Qt::SolidLine}; Qt::PenStyle m_penStyle{Qt::SolidLine}; // NOLINT(misc-non-private-member-variables-in-classes)
bool m_cut{false}; bool m_cut{false}; // NOLINT(misc-non-private-member-variables-in-classes)
private: private:
Q_DISABLE_ASSIGN_MOVE(VLayoutPiecePathData) // NOLINT Q_DISABLE_ASSIGN_MOVE(VLayoutPiecePathData) // NOLINT
@ -83,14 +79,20 @@ QT_WARNING_POP
// See https://stackoverflow.com/a/46719572/3045403 // See https://stackoverflow.com/a/46719572/3045403
#if __cplusplus < 201703L // C++17 #if __cplusplus < 201703L // C++17
constexpr quint32 VLayoutPiecePathData::streamHeader; // NOLINT(readability-redundant-declaration) constexpr quint32 VLayoutPiecePathData::streamHeader; // NOLINT(readability-redundant-declaration)
constexpr quint16 VLayoutPiecePathData::classVersion; // NOLINT(readability-redundant-declaration) constexpr quint16 VLayoutPiecePathData::classVersion; // NOLINT(readability-redundant-declaration)
#endif #endif
//---------------------------------------------------------------------------------------------------------------------
inline VLayoutPiecePathData::VLayoutPiecePathData(const QVector<VLayoutPoint> &points)
: m_points(points)
{
}
// Friend functions // Friend functions
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto operator<<(QDataStream &dataStream, const VLayoutPiecePathData &path) -> QDataStream & auto operator<<(QDataStream &dataStream, const VLayoutPiecePathData &path) -> QDataStream &
{ {
dataStream << VLayoutPiecePathData::streamHeader << VLayoutPiecePathData::classVersion; dataStream << VLayoutPiecePathData::streamHeader << VLayoutPiecePathData::classVersion;
// Added in classVersion = 1 // Added in classVersion = 1
@ -125,7 +127,8 @@ auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> QDataStr
{ {
QString message = QCoreApplication::tr("VLayoutPiecePathData compatibility error: actualClassVersion = %1 and " QString message = QCoreApplication::tr("VLayoutPiecePathData compatibility error: actualClassVersion = %1 and "
"classVersion = %2") "classVersion = %2")
.arg(actualClassVersion).arg(VLayoutPiecePathData::classVersion); .arg(actualClassVersion)
.arg(VLayoutPiecePathData::classVersion);
throw VException(message); throw VException(message);
} }
@ -142,13 +145,12 @@ auto operator>>(QDataStream &dataStream, VLayoutPiecePathData &path) -> QDataStr
dataStream >> path.m_penStyle; dataStream >> path.m_penStyle;
dataStream >> path.m_cut; dataStream >> path.m_cut;
// if (actualClassVersion >= 2) // if (actualClassVersion >= 2)
// { // {
// } // }
return dataStream; return dataStream;
} }
#endif // VLAYOUTPIECEPATH_P_H #endif // VLAYOUTPIECEPATH_P_H

View file

@ -29,7 +29,7 @@
#ifndef VPOSITION_H #ifndef VPOSITION_H
#define VPOSITION_H #define VPOSITION_H
#include <qcompilerdetection.h>
#include <QRunnable> #include <QRunnable>
#include <QVector> #include <QVector>
#include <QtGlobal> #include <QtGlobal>

View file

@ -44,11 +44,11 @@ template <typename... Args>
struct QNonConstOverload struct QNonConstOverload
{ {
template <typename R, typename T> template <typename R, typename T>
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr) Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...)) const noexcept -> decltype(ptr)
{ return ptr; } { return ptr; }
template <typename R, typename T> template <typename R, typename T>
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr) static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...)) noexcept -> decltype(ptr)
{ return ptr; } { return ptr; }
}; };
@ -56,11 +56,11 @@ template <typename... Args>
struct QConstOverload struct QConstOverload
{ {
template <typename R, typename T> template <typename R, typename T>
Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const Q_DECL_NOTHROW -> decltype(ptr) Q_DECL_CONSTEXPR auto operator()(R (T::*ptr)(Args...) const) const noexcept -> decltype(ptr)
{ return ptr; } { return ptr; }
template <typename R, typename T> template <typename R, typename T>
static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) Q_DECL_NOTHROW -> decltype(ptr) static Q_DECL_CONSTEXPR auto of(R (T::*ptr)(Args...) const) noexcept -> decltype(ptr)
{ return ptr; } { return ptr; }
}; };
@ -73,11 +73,11 @@ struct QOverload : QConstOverload<Args...>, QNonConstOverload<Args...>
using QNonConstOverload<Args...>::operator(); using QNonConstOverload<Args...>::operator();
template <typename R> template <typename R>
Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const Q_DECL_NOTHROW -> decltype(ptr) Q_DECL_CONSTEXPR auto operator()(R (*ptr)(Args...)) const noexcept -> decltype(ptr)
{ return ptr; } { return ptr; }
template <typename R> template <typename R>
static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) Q_DECL_NOTHROW -> decltype(ptr) static Q_DECL_CONSTEXPR auto of(R (*ptr)(Args...)) noexcept -> decltype(ptr)
{ return ptr; } { return ptr; }
}; };

View file

@ -29,13 +29,11 @@
#ifndef CUSTOMEVENTS_H #ifndef CUSTOMEVENTS_H
#define CUSTOMEVENTS_H #define CUSTOMEVENTS_H
#include <qcompilerdetection.h>
#include <QEvent> #include <QEvent>
#include <QString> #include <QString>
#include "typedef.h" enum CustomEventType
{
enum CustomEventType {
UndoEventType = 1, UndoEventType = 1,
LiteParseEventType = 2, LiteParseEventType = 2,
FitBestCurrentEventType = 3, FitBestCurrentEventType = 3,
@ -50,13 +48,15 @@ const QEvent::Type UNDO_EVENT =
class UndoEvent : public QEvent class UndoEvent : public QEvent
{ {
public: public:
UndoEvent() UndoEvent();
: QEvent(UNDO_EVENT) ~UndoEvent() override = default;
{}
virtual ~UndoEvent() =default;
}; };
inline UndoEvent::UndoEvent()
: QEvent(UNDO_EVENT)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QEvent::Type LITE_PARSE_EVENT = const QEvent::Type LITE_PARSE_EVENT =
static_cast<QEvent::Type>(QEvent::User + static_cast<int>(CustomEventType::LiteParseEventType)); static_cast<QEvent::Type>(QEvent::User + static_cast<int>(CustomEventType::LiteParseEventType));
@ -64,13 +64,15 @@ const QEvent::Type LITE_PARSE_EVENT =
class LiteParseEvent : public QEvent class LiteParseEvent : public QEvent
{ {
public: public:
LiteParseEvent() LiteParseEvent();
: QEvent(LITE_PARSE_EVENT) ~LiteParseEvent() override = default;
{}
virtual ~LiteParseEvent() =default;
}; };
inline LiteParseEvent::LiteParseEvent()
: QEvent(LITE_PARSE_EVENT)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QEvent::Type FIT_BEST_CURRENT_EVENT = const QEvent::Type FIT_BEST_CURRENT_EVENT =
static_cast<QEvent::Type>(QEvent::User + static_cast<int>(CustomEventType::FitBestCurrentEventType)); static_cast<QEvent::Type>(QEvent::User + static_cast<int>(CustomEventType::FitBestCurrentEventType));
@ -78,13 +80,15 @@ const QEvent::Type FIT_BEST_CURRENT_EVENT =
class FitBestCurrentEvent : public QEvent class FitBestCurrentEvent : public QEvent
{ {
public: public:
FitBestCurrentEvent() FitBestCurrentEvent();
: QEvent(FIT_BEST_CURRENT_EVENT) ~FitBestCurrentEvent() override = default;
{}
virtual ~FitBestCurrentEvent() =default;
}; };
inline FitBestCurrentEvent::FitBestCurrentEvent()
: QEvent(FIT_BEST_CURRENT_EVENT)
{
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
const QEvent::Type WARNING_MESSAGE_EVENT = const QEvent::Type WARNING_MESSAGE_EVENT =
static_cast<QEvent::Type>(QEvent::User + static_cast<int>(CustomEventType::WarningMessageEventType)); static_cast<QEvent::Type>(QEvent::User + static_cast<int>(CustomEventType::WarningMessageEventType));
@ -92,13 +96,8 @@ const QEvent::Type WARNING_MESSAGE_EVENT =
class WarningMessageEvent : public QEvent class WarningMessageEvent : public QEvent
{ {
public: public:
WarningMessageEvent(const QString &message, QtMsgType severity) WarningMessageEvent(const QString &message, QtMsgType severity);
: QEvent(WARNING_MESSAGE_EVENT), ~WarningMessageEvent() override = default;
m_message(message),
m_severity(severity)
{}
virtual ~WarningMessageEvent() =default;
auto Message() const -> QString; auto Message() const -> QString;
@ -109,6 +108,13 @@ private:
QtMsgType m_severity; QtMsgType m_severity;
}; };
inline WarningMessageEvent::WarningMessageEvent(const QString &message, QtMsgType severity)
: QEvent(WARNING_MESSAGE_EVENT),
m_message(message),
m_severity(severity)
{
}
inline auto WarningMessageEvent::Message() const -> QString inline auto WarningMessageEvent::Message() const -> QString
{ {
return m_message; return m_message;

View file

@ -41,7 +41,6 @@
#include <QStringList> #include <QStringList>
#include <Qt> #include <Qt>
#include <csignal> #include <csignal>
#include <qcompilerdetection.h>
#include "debugbreak.h" #include "debugbreak.h"
#include "defglobal.h" #include "defglobal.h"

View file

@ -35,7 +35,7 @@ constexpr qreal PrintDPI = 96.0;
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
// this adds const to non-const objects (like std::as_const) // this adds const to non-const objects (like std::as_const)
template <typename T> template <typename T>
Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) Q_DECL_NOTHROW { return t; } Q_DECL_CONSTEXPR typename std::add_const<T>::type &qAsConst(T &t) noexcept { return t; }
// prevent rvalue arguments: // prevent rvalue arguments:
template <typename T> template <typename T>
void qAsConst(const T &&) Q_DECL_EQ_DELETE; void qAsConst(const T &&) Q_DECL_EQ_DELETE;

View file

@ -40,51 +40,51 @@
#define QT_DO_PRAGMA(text) _Pragma(#text) #define QT_DO_PRAGMA(text) _Pragma(#text)
#if defined(Q_CC_INTEL) && defined(Q_CC_MSVC) #if defined(Q_CC_INTEL) && defined(Q_CC_MSVC)
/* icl.exe: Intel compiler on Windows */ /* icl.exe: Intel compiler on Windows */
# undef QT_DO_PRAGMA /* not needed */ #undef QT_DO_PRAGMA /* not needed */
# define QT_WARNING_PUSH __pragma(warning(push)) #define QT_WARNING_PUSH __pragma(warning(push))
# define QT_WARNING_POP __pragma(warning(pop)) #define QT_WARNING_POP __pragma(warning(pop))
# define QT_WARNING_DISABLE_MSVC(number) #define QT_WARNING_DISABLE_MSVC(number)
# define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable: number)) #define QT_WARNING_DISABLE_INTEL(number) __pragma(warning(disable : number))
# define QT_WARNING_DISABLE_CLANG(text) #define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text) #define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_INTEL) #elif defined(Q_CC_INTEL)
/* icc: Intel compiler on Linux or OS X */ /* icc: Intel compiler on Linux or OS X */
# define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push)) #define QT_WARNING_PUSH QT_DO_PRAGMA(warning(push))
# define QT_WARNING_POP QT_DO_PRAGMA(warning(pop)) #define QT_WARNING_POP QT_DO_PRAGMA(warning(pop))
# define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable: number)) #define QT_WARNING_DISABLE_INTEL(number) QT_DO_PRAGMA(warning(disable : number))
# define QT_WARNING_DISABLE_MSVC(number) #define QT_WARNING_DISABLE_MSVC(number)
# define QT_WARNING_DISABLE_CLANG(text) #define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text) #define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_MSVC) && _MSC_VER >= 1500 #elif defined(Q_CC_MSVC) && _MSC_VER >= 1500
# undef QT_DO_PRAGMA /* not needed */ #undef QT_DO_PRAGMA /* not needed */
# define QT_WARNING_PUSH __pragma(warning(push)) #define QT_WARNING_PUSH __pragma(warning(push))
# define QT_WARNING_POP __pragma(warning(pop)) #define QT_WARNING_POP __pragma(warning(pop))
# define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable: number)) #define QT_WARNING_DISABLE_MSVC(number) __pragma(warning(disable : number))
# define QT_WARNING_DISABLE_INTEL(number) #define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_CLANG(text) #define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text) #define QT_WARNING_DISABLE_GCC(text)
#elif defined(Q_CC_CLANG) #elif defined(Q_CC_CLANG)
# define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push) #define QT_WARNING_PUSH QT_DO_PRAGMA(clang diagnostic push)
# define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop) #define QT_WARNING_POP QT_DO_PRAGMA(clang diagnostic pop)
# define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) #define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text)
# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too #define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) // GCC directives work in Clang too
# define QT_WARNING_DISABLE_INTEL(number) #define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number) #define QT_WARNING_DISABLE_MSVC(number)
#elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) #elif defined(Q_CC_GNU) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)
# define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push) #define QT_WARNING_PUSH QT_DO_PRAGMA(GCC diagnostic push)
# define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop) #define QT_WARNING_POP QT_DO_PRAGMA(GCC diagnostic pop)
# define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text) #define QT_WARNING_DISABLE_GCC(text) QT_DO_PRAGMA(GCC diagnostic ignored text)
# define QT_WARNING_DISABLE_CLANG(text) #define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_INTEL(number) #define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number) #define QT_WARNING_DISABLE_MSVC(number)
#else // All other compilers, GCC < 4.6 and MSVC < 2008 #else // All other compilers, GCC < 4.6 and MSVC < 2008
# define QT_WARNING_DISABLE_GCC(text) #define QT_WARNING_DISABLE_GCC(text)
# define QT_WARNING_PUSH #define QT_WARNING_PUSH
# define QT_WARNING_POP #define QT_WARNING_POP
# define QT_WARNING_DISABLE_INTEL(number) #define QT_WARNING_DISABLE_INTEL(number)
# define QT_WARNING_DISABLE_MSVC(number) #define QT_WARNING_DISABLE_MSVC(number)
# define QT_WARNING_DISABLE_CLANG(text) #define QT_WARNING_DISABLE_CLANG(text)
# define QT_WARNING_DISABLE_GCC(text) #define QT_WARNING_DISABLE_GCC(text)
#endif #endif
#else #else

View file

@ -28,7 +28,6 @@
#include "projectversion.h" #include "projectversion.h"
#include <qcompilerdetection.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QLatin1Char> #include <QLatin1Char>
#include <QLatin1String> #include <QLatin1String>
@ -42,8 +41,8 @@
#define LATEST_TAG_DISTANCE VCS_REPO_STATE_DISTANCE #define LATEST_TAG_DISTANCE VCS_REPO_STATE_DISTANCE
#endif #endif
extern const QString APP_VERSION_STR(QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION) extern const QString APP_VERSION_STR(
.arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE)); QStringLiteral("%1.%2.%3.%4").arg(MAJOR_VERSION).arg(MINOR_VERSION).arg(DEBUG_VERSION).arg(LATEST_TAG_DISTANCE));
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto compilerString() -> QString auto compilerString() -> QString
@ -62,7 +61,7 @@ auto compilerString() -> QString
QString iccVersion; QString iccVersion;
if (__INTEL_COMPILER >= 1300) if (__INTEL_COMPILER >= 1300)
{ {
iccVersion = QString::number(__INTEL_COMPILER/100); iccVersion = QString::number(__INTEL_COMPILER / 100);
} }
else else
{ {
@ -83,10 +82,10 @@ auto compilerString() -> QString
#if defined(__apple_build_version__) // Apple clang has other version numbers #if defined(__apple_build_version__) // Apple clang has other version numbers
isAppleString = QLatin1String(" (Apple)"); isAppleString = QLatin1String(" (Apple)");
#endif #endif
return QLatin1String("Clang " ) + QString::number(__clang_major__) + QLatin1Char('.') return QLatin1String("Clang ") + QString::number(__clang_major__) + QLatin1Char('.') +
+ QString::number(__clang_minor__) + isAppleString; QString::number(__clang_minor__) + isAppleString;
#elif defined(Q_CC_GNU) #elif defined(Q_CC_GNU)
return QLatin1String("GCC " ) + QLatin1String(__VERSION__); return QLatin1String("GCC ") + QLatin1String(__VERSION__);
#elif defined(Q_CC_MSVC) #elif defined(Q_CC_MSVC)
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle) if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
{ {
@ -105,6 +104,6 @@ auto compilerString() -> QString
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto buildCompatibilityString() -> QString auto buildCompatibilityString() -> QString
{ {
return QCoreApplication::tr("Based on Qt %1 (%2, %3 bit)").arg(QLatin1String(qVersion()), compilerString(), return QCoreApplication::tr("Based on Qt %1 (%2, %3 bit)")
QString::number(QSysInfo::WordSize)); .arg(QLatin1String(qVersion()), compilerString(), QString::number(QSysInfo::WordSize));
} }

View file

@ -31,7 +31,6 @@
#ifndef QXTCSVMODEL_H #ifndef QXTCSVMODEL_H
#define QXTCSVMODEL_H #define QXTCSVMODEL_H
#include <qcompilerdetection.h>
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QChar> #include <QChar>
#include <QFlags> #include <QFlags>
@ -57,6 +56,7 @@ class VTextCodec;
class QxtCsvModel final : public QAbstractTableModel class QxtCsvModel final : public QAbstractTableModel
{ {
Q_OBJECT // NOLINT Q_OBJECT // NOLINT
public: public:
explicit QxtCsvModel(QObject *parent = nullptr); explicit QxtCsvModel(QObject *parent = nullptr);
explicit QxtCsvModel(QIODevice *file, QObject *parent = nullptr, bool withHeader = false, QChar separator = ',', explicit QxtCsvModel(QIODevice *file, QObject *parent = nullptr, bool withHeader = false, QChar separator = ',',
@ -73,13 +73,13 @@ public:
-> QVariant override; -> QVariant override;
virtual auto setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, virtual auto setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
int role = Qt::DisplayRole) -> bool override; int role = Qt::DisplayRole) -> bool override;
void setHeaderData(const QStringList& data); void setHeaderData(const QStringList &data);
auto text(int row, int column) const -> QString; auto text(int row, int column) const -> QString;
void setText(int row, int column, const QString& value); void setText(int row, int column, const QString &value);
auto headerText(int column) const -> QString; auto headerText(int column) const -> QString;
void setHeaderText(int column, const QString& value); void setHeaderText(int column, const QString &value);
auto insertRow(int row, const QModelIndex &parent = QModelIndex()) -> bool; auto insertRow(int row, const QModelIndex &parent = QModelIndex()) -> bool;
virtual auto insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) -> bool override; virtual auto insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) -> bool override;
@ -93,16 +93,18 @@ public:
auto removeColumn(int col, const QModelIndex &parent = QModelIndex()) -> bool; auto removeColumn(int col, const QModelIndex &parent = QModelIndex()) -> bool;
virtual auto removeColumns(int col, int count, const QModelIndex &parent = QModelIndex()) -> bool override; virtual auto removeColumns(int col, int count, const QModelIndex &parent = QModelIndex()) -> bool override;
void setSource(QIODevice *file, bool withHeader = false, QChar separator = ',', VTextCodec* codec = nullptr); void setSource(QIODevice *file, bool withHeader = false, QChar separator = ',', VTextCodec *codec = nullptr);
void setSource(const QString &filename, bool withHeader = false, QChar separator = ',', void setSource(const QString &filename, bool withHeader = false, QChar separator = ',',
VTextCodec* codec = nullptr); VTextCodec *codec = nullptr);
auto toCSV(QIODevice *file, QString &error, bool withHeader = false, QChar separator = ',', auto toCSV(QIODevice *file, QString &error, bool withHeader = false, QChar separator = ',',
VTextCodec *codec = nullptr) const -> bool; VTextCodec *codec = nullptr) const -> bool;
auto toCSV(const QString &filename, QString &error, bool withHeader = false, QChar separator = ',', auto toCSV(const QString &filename, QString &error, bool withHeader = false, QChar separator = ',',
VTextCodec *codec = nullptr) const -> bool; VTextCodec *codec = nullptr) const -> bool;
enum QuoteOption { NoQuotes = 0, enum QuoteOption
{
NoQuotes = 0,
SingleQuote = 1, SingleQuote = 1,
DoubleQuote = 2, DoubleQuote = 2,
BothQuotes = 3, BothQuotes = 3,
@ -110,7 +112,8 @@ public:
TwoQuoteEscape = 4, TwoQuoteEscape = 4,
BackslashEscape = 8, BackslashEscape = 8,
AlwaysQuoteOutput = 16, AlwaysQuoteOutput = 16,
DefaultQuoteMode = BothQuotes | BackslashEscape | AlwaysQuoteOutput }; DefaultQuoteMode = BothQuotes | BackslashEscape | AlwaysQuoteOutput
};
Q_DECLARE_FLAGS(QuoteMode, QuoteOption) Q_DECLARE_FLAGS(QuoteMode, QuoteOption)
auto quoteMode() const -> QuoteMode; auto quoteMode() const -> QuoteMode;

View file

@ -46,7 +46,7 @@ public:
VSvgFontData() = default; VSvgFontData() = default;
explicit VSvgFontData(qreal horizAdvX); explicit VSvgFontData(qreal horizAdvX);
VSvgFontData(const VSvgFontData &font) = default; VSvgFontData(const VSvgFontData &font) = default;
virtual ~VSvgFontData() = default; ~VSvgFontData() = default;
QString m_id{}; // NOLINT(misc-non-private-member-variables-in-classes) QString m_id{}; // NOLINT(misc-non-private-member-variables-in-classes)
QString m_familyName{}; // NOLINT(misc-non-private-member-variables-in-classes) QString m_familyName{}; // NOLINT(misc-non-private-member-variables-in-classes)

View file

@ -48,7 +48,7 @@ public:
VSvgFontEngineData() = default; VSvgFontEngineData() = default;
explicit VSvgFontEngineData(const VSvgFont &font); explicit VSvgFontEngineData(const VSvgFont &font);
VSvgFontEngineData(const VSvgFontEngineData &engine) = default; VSvgFontEngineData(const VSvgFontEngineData &engine) = default;
virtual ~VSvgFontEngineData() = default; ~VSvgFontEngineData() = default;
VSvgFont m_font{}; // NOLINT(misc-non-private-member-variables-in-classes) VSvgFont m_font{}; // NOLINT(misc-non-private-member-variables-in-classes)
QHash<QChar, VSvgGlyph> m_glyphs{}; // NOLINT(misc-non-private-member-variables-in-classes) QHash<QChar, VSvgGlyph> m_glyphs{}; // NOLINT(misc-non-private-member-variables-in-classes)

View file

@ -46,7 +46,7 @@ public:
VSvgGlyphData() = default; VSvgGlyphData() = default;
VSvgGlyphData(QChar unicode, const QPainterPath &path, qreal horizAdvX); VSvgGlyphData(QChar unicode, const QPainterPath &path, qreal horizAdvX);
VSvgGlyphData(const VSvgGlyphData &glyph) = default; VSvgGlyphData(const VSvgGlyphData &glyph) = default;
virtual ~VSvgGlyphData() = default; ~VSvgGlyphData() = default;
QChar m_unicode{0}; // NOLINT(misc-non-private-member-variables-in-classes) QChar m_unicode{0}; // NOLINT(misc-non-private-member-variables-in-classes)
QPainterPath m_path{}; // NOLINT(misc-non-private-member-variables-in-classes) QPainterPath m_path{}; // NOLINT(misc-non-private-member-variables-in-classes)

View file

@ -40,7 +40,6 @@
#include <QString> #include <QString>
#include <QTranslator> #include <QTranslator>
#include <QtGlobal> #include <QtGlobal>
#include <qcompilerdetection.h>
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../vpatterndb/vtranslatevars.h" #include "../vpatterndb/vtranslatevars.h"

View file

@ -29,7 +29,7 @@
#ifndef VOBJENGINE_H #ifndef VOBJENGINE_H
#define VOBJENGINE_H #define VOBJENGINE_H
#include <qcompilerdetection.h>
#include <QPaintEngine> #include <QPaintEngine>
#include <QPolygonF> #include <QPolygonF>
#include <QRectF> #include <QRectF>

View file

@ -29,7 +29,7 @@
#ifndef VOBJPAINTDEVICE_H #ifndef VOBJPAINTDEVICE_H
#define VOBJPAINTDEVICE_H #define VOBJPAINTDEVICE_H
#include <qcompilerdetection.h>
#include <QPaintDevice> #include <QPaintDevice>
#include <QSharedPointer> #include <QSharedPointer>
#include <QSize> #include <QSize>

View file

@ -28,14 +28,14 @@
#include "calculator.h" #include "calculator.h"
#include <QStringList>
#include <QSharedPointer> #include <QSharedPointer>
#include <QStringList>
#include <QtDebug> #include <QtDebug>
#include "../vmisc/def.h"
#include "../qmuparser/qmuparsererror.h" #include "../qmuparser/qmuparsererror.h"
#include "variables/vinternalvariable.h" #include "../vmisc/def.h"
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "variables/vinternalvariable.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
@ -52,9 +52,6 @@
* *
*/ */
Calculator::Calculator() Calculator::Calculator()
: QmuFormulaBase(),
m_varsValues(),
m_vars(nullptr)
{ {
InitCharSets(); InitCharSets();
@ -88,7 +85,7 @@ auto Calculator::EvalFormula(const QHash<QString, QSharedPointer<VInternalVariab
return result; return result;
} }
SetSepForEval();//Reset separators options SetSepForEval(); // Reset separators options
m_vars = vars; m_vars = vars;
SetExpr(formula); SetExpr(formula);
@ -116,14 +113,15 @@ auto Calculator::VarFactory(const QString &a_szName, void *a_pUserData) -> qreal
return val.data(); return val.data();
} }
throw qmu::QmuParserError (qmu::ecUNASSIGNABLE_TOKEN); throw qmu::QmuParserError(qmu::ecUNASSIGNABLE_TOKEN);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto Calculator::Warning(const QString &warningMsg, qreal value) -> qreal auto Calculator::Warning(const QString &warningMsg, qreal value) -> qreal
{ {
VAbstractApplication::VApp()->IsPedantic() ? throw qmu::QmuParserWarning(warningMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractApplication::warningMessageSignature + warningMsg; ? throw qmu::QmuParserWarning(warningMsg)
: qWarning() << VAbstractApplication::warningMessageSignature + warningMsg;
return value; return value;
} }

View file

@ -29,7 +29,6 @@
#ifndef CALCULATOR_H #ifndef CALCULATOR_H
#define CALCULATOR_H #define CALCULATOR_H
#include <qcompilerdetection.h>
#include <QHash> #include <QHash>
#include <QMap> #include <QMap>
#include <QString> #include <QString>
@ -61,7 +60,7 @@ class Calculator final : public qmu::QmuFormulaBase
{ {
public: public:
Calculator(); Calculator();
virtual ~Calculator() = default; ~Calculator() override = default;
auto EvalFormula(const QHash<QString, QSharedPointer<VInternalVariable>> *vars, const QString &formula) -> qreal; auto EvalFormula(const QHash<QString, QSharedPointer<VInternalVariable>> *vars, const QString &formula) -> qreal;
@ -71,8 +70,8 @@ protected:
private: private:
Q_DISABLE_COPY_MOVE(Calculator) // NOLINT Q_DISABLE_COPY_MOVE(Calculator) // NOLINT
QVector<QSharedPointer<qreal>> m_varsValues; QVector<QSharedPointer<qreal>> m_varsValues{};
const QHash<QString, QSharedPointer<VInternalVariable> > *m_vars; const QHash<QString, QSharedPointer<VInternalVariable>> *m_vars{nullptr};
}; };
#endif // CALCULATOR_H #endif // CALCULATOR_H

View file

@ -52,12 +52,12 @@ auto VAbstractFloatItemData::operator=(const VAbstractFloatItemData &data) -> VA
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VAbstractFloatItemData::VAbstractFloatItemData(VAbstractFloatItemData &&data) Q_DECL_NOTHROW VAbstractFloatItemData::VAbstractFloatItemData(VAbstractFloatItemData &&data) noexcept
: d (std::move(data.d)) : d (std::move(data.d))
{} {}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VAbstractFloatItemData::operator=(VAbstractFloatItemData &&data) Q_DECL_NOTHROW->VAbstractFloatItemData & auto VAbstractFloatItemData::operator=(VAbstractFloatItemData &&data) noexcept->VAbstractFloatItemData &
{ {
std::swap(d, data.d); std::swap(d, data.d);
return *this; return *this;

View file

@ -44,8 +44,8 @@ public:
auto operator=(const VAbstractFloatItemData &data) -> VAbstractFloatItemData &; auto operator=(const VAbstractFloatItemData &data) -> VAbstractFloatItemData &;
#ifdef Q_COMPILER_RVALUE_REFS #ifdef Q_COMPILER_RVALUE_REFS
VAbstractFloatItemData(VAbstractFloatItemData &&data) Q_DECL_NOTHROW; VAbstractFloatItemData(VAbstractFloatItemData &&data) noexcept;
auto operator=(VAbstractFloatItemData &&data) Q_DECL_NOTHROW->VAbstractFloatItemData &; auto operator=(VAbstractFloatItemData &&data) noexcept->VAbstractFloatItemData &;
#endif #endif
// methods, which set and return values of different parameters // methods, which set and return values of different parameters

Some files were not shown because too many files have changed in this diff Show more