Refactoring.
This commit is contained in:
parent
30f2897732
commit
03630fb273
|
@ -280,7 +280,7 @@ void DialogSaveManualLayout::SetShowGrainline(bool show)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool DialogSaveManualLayout::IsShowGrainline() const
|
auto DialogSaveManualLayout::IsShowGrainline() const -> bool
|
||||||
{
|
{
|
||||||
switch(Format())
|
switch(Format())
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,8 +75,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut, // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *parent) :
|
VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *parent) :
|
||||||
|
|
|
@ -56,7 +56,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutExportFormat, (QLatin1Stri
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, (QLatin1String("layout/lineWidth"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutLineWidth, (QLatin1String("layout/lineWidth"))) // NOLINT
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
|
||||||
|
|
||||||
int cachedLineWidth = -1;
|
int cachedLineWidth = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#ifndef QPRINTENGINE_H
|
#ifndef QPRINTENGINE_H
|
||||||
|
@ -295,7 +295,7 @@ auto VPSettings::GetLayoutFollowGrainline() const -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VPSettings::GetMaxLayoutPieceGap()
|
auto VPSettings::GetMaxLayoutPieceGap() -> qreal
|
||||||
{
|
{
|
||||||
return UnitConvertor(50, Unit::Cm, Unit::Px);
|
return UnitConvertor(50, Unit::Cm, Unit::Px);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ auto VPSettings::GetLayoutPieceGap() const -> qreal
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qint8 VPSettings::GetLayoutExportFormat() const
|
auto VPSettings::GetLayoutExportFormat() const -> qint8
|
||||||
{
|
{
|
||||||
return qvariant_cast<qint8>(value(*settingLayoutExportFormat, 0));
|
return qvariant_cast<qint8>(value(*settingLayoutExportFormat, 0));
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ void VPSettings::SetLayoutLineWidth(int width)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPSettings::GetShowGrainline() const
|
auto VPSettings::GetShowGrainline() const -> bool
|
||||||
{
|
{
|
||||||
return value(*settingLayoutShowGrainline, true).toBool();
|
return value(*settingLayoutShowGrainline, true).toBool();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ public:
|
||||||
VPSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
VPSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
VPSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
VPSettings(const QString &fileName, Format format, QObject *parent = nullptr);
|
||||||
|
~VPSettings() override = default;
|
||||||
|
|
||||||
auto IsDockWidgetPropertiesActive() const -> bool;
|
auto IsDockWidgetPropertiesActive() const -> bool;
|
||||||
static auto GetDefDockWidgetPropertiesActive() -> bool;
|
static auto GetDefDockWidgetPropertiesActive() -> bool;
|
||||||
|
@ -103,7 +104,7 @@ public:
|
||||||
auto GetLayoutLineWidth() const -> int;
|
auto GetLayoutLineWidth() const -> int;
|
||||||
void SetLayoutLineWidth(int width);
|
void SetLayoutLineWidth(int width);
|
||||||
|
|
||||||
bool GetShowGrainline() const;
|
auto GetShowGrainline() const -> bool;
|
||||||
void SetShowGrainline(bool value);
|
void SetShowGrainline(bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -558,7 +558,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPoint VPLayoutFileReader::ReadLayoutPoint()
|
auto VPLayoutFileReader::ReadLayoutPoint() -> VLayoutPoint
|
||||||
{
|
{
|
||||||
AssertRootTag(ML::TagPoint);
|
AssertRootTag(ML::TagPoint);
|
||||||
|
|
||||||
|
|
|
@ -721,60 +721,46 @@ void DialogRestrictDimension::EnableRestrictionControls(bool enable)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogRestrictDimension::FillBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension,
|
void DialogRestrictDimension::FillBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension,
|
||||||
QComboBox *control) const
|
QComboBox *control) const
|
||||||
|
{
|
||||||
|
for (auto base : bases)
|
||||||
|
{
|
||||||
|
FillBase(base, dimension, control);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogRestrictDimension::FillBase(double base, const MeasurementDimension_p &dimension, QComboBox *control) const
|
||||||
{
|
{
|
||||||
SCASSERT(control != nullptr)
|
SCASSERT(control != nullptr)
|
||||||
|
|
||||||
const DimesionLabels labels = dimension->Labels();
|
const DimesionLabels labels = dimension->Labels();
|
||||||
const QString units = UnitsToStr(dimension->Units(), true);
|
const QString units = UnitsToStr(dimension->Units(), true);
|
||||||
|
const QString label = VFuzzyValue(labels, base);
|
||||||
|
const bool useLabel = VFuzzyContains(labels, base) && not label.isEmpty();
|
||||||
|
|
||||||
if (dimension->Type() == MeasurementDimension::X)
|
if (dimension->Type() == MeasurementDimension::X)
|
||||||
{
|
{
|
||||||
for(auto base : bases)
|
QString item = useLabel ? label : QStringLiteral("%1 %2").arg(base).arg(units);
|
||||||
{
|
control->addItem(item, base);
|
||||||
if (VFuzzyContains(labels, base) && not VFuzzyValue(labels, base).isEmpty())
|
|
||||||
{
|
|
||||||
control->addItem(VFuzzyValue(labels, base), base);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
control->addItem(QStringLiteral("%1 %2").arg(base).arg(units), base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (dimension->Type() == MeasurementDimension::Y)
|
else if (dimension->Type() == MeasurementDimension::Y)
|
||||||
{
|
{
|
||||||
for(auto base : bases)
|
if (useLabel)
|
||||||
{
|
{
|
||||||
if (VFuzzyContains(labels, base) && not VFuzzyValue(labels, base).isEmpty())
|
control->addItem(label, base);
|
||||||
{
|
}
|
||||||
control->addItem(VFuzzyValue(labels, base), base);
|
else
|
||||||
}
|
{
|
||||||
else
|
QString item = dimension->IsBodyMeasurement()
|
||||||
{
|
? QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units)
|
||||||
if (dimension->IsBodyMeasurement())
|
: QString::number(base);
|
||||||
{
|
control->addItem(item, base);
|
||||||
control->addItem(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
control->addItem(QString::number(base), base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
|
||||||
{
|
{
|
||||||
for(auto base : bases)
|
QString item = useLabel ? label : QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units);
|
||||||
{
|
control->addItem(item, base);
|
||||||
if (VFuzzyContains(labels, base) && not VFuzzyValue(labels, base).isEmpty())
|
|
||||||
{
|
|
||||||
control->addItem(VFuzzyValue(labels, base), base);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
control->addItem(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ private:
|
||||||
void EnableRestrictionControls(bool enable);
|
void EnableRestrictionControls(bool enable);
|
||||||
|
|
||||||
void FillBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension, QComboBox *control) const;
|
void FillBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension, QComboBox *control) const;
|
||||||
|
void FillBase(double base, const MeasurementDimension_p &dimension, QComboBox *control) const;
|
||||||
static auto FillDimensionXBases(const QVector<qreal> &bases,
|
static auto FillDimensionXBases(const QVector<qreal> &bases,
|
||||||
const MeasurementDimension_p &dimension) -> QStringList;
|
const MeasurementDimension_p &dimension) -> QStringList;
|
||||||
auto FillDimensionYBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension) const -> QStringList;
|
auto FillDimensionYBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension) const -> QStringList;
|
||||||
|
|
|
@ -27,29 +27,30 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "tmainwindow.h"
|
#include "tmainwindow.h"
|
||||||
#include "ui_tmainwindow.h"
|
|
||||||
#include "dialogs/dialogabouttape.h"
|
|
||||||
#include "dialogs/dialognewmeasurements.h"
|
|
||||||
#include "dialogs/dialogmdatabase.h"
|
|
||||||
#include "dialogs/dialogtapepreferences.h"
|
|
||||||
#include "dialogs/dialogsetupmultisize.h"
|
|
||||||
#include "dialogs/dialogrestrictdimension.h"
|
|
||||||
#include "dialogs/dialogdimensionlabels.h"
|
|
||||||
#include "dialogs/dialogmeasurementscsvcolumns.h"
|
|
||||||
#include "dialogs/dialogdimensioncustomnames.h"
|
|
||||||
#include "../vpatterndb/vcontainer.h"
|
|
||||||
#include "../vpatterndb/calculator.h"
|
|
||||||
#include "../vpatterndb/pmsystems.h"
|
|
||||||
#include "../vpatterndb/measurements.h"
|
|
||||||
#include "../vpatterndb/variables/vmeasurement.h"
|
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
#include "../ifc/xml/vpatternconverter.h"
|
||||||
#include "../ifc/xml/vvitconverter.h"
|
#include "../ifc/xml/vvitconverter.h"
|
||||||
#include "../ifc/xml/vvstconverter.h"
|
#include "../ifc/xml/vvstconverter.h"
|
||||||
#include "../ifc/xml/vpatternconverter.h"
|
|
||||||
#include "../vmisc/vsysexits.h"
|
|
||||||
#include "../vmisc/qxtcsvmodel.h"
|
|
||||||
#include "../vmisc/dialogs/dialogexporttocsv.h"
|
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
|
#include "../vmisc/dialogs/dialogexporttocsv.h"
|
||||||
|
#include "../vmisc/qxtcsvmodel.h"
|
||||||
|
#include "../vmisc/vsysexits.h"
|
||||||
|
#include "../vpatterndb/calculator.h"
|
||||||
|
#include "../vpatterndb/measurements.h"
|
||||||
|
#include "../vpatterndb/pmsystems.h"
|
||||||
|
#include "../vpatterndb/variables/vmeasurement.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
#include "def.h"
|
||||||
|
#include "dialogs/dialogabouttape.h"
|
||||||
|
#include "dialogs/dialogdimensioncustomnames.h"
|
||||||
|
#include "dialogs/dialogdimensionlabels.h"
|
||||||
|
#include "dialogs/dialogmdatabase.h"
|
||||||
|
#include "dialogs/dialogmeasurementscsvcolumns.h"
|
||||||
|
#include "dialogs/dialognewmeasurements.h"
|
||||||
|
#include "dialogs/dialogrestrictdimension.h"
|
||||||
|
#include "dialogs/dialogsetupmultisize.h"
|
||||||
|
#include "dialogs/dialogtapepreferences.h"
|
||||||
|
#include "ui_tmainwindow.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
|
@ -110,6 +111,16 @@ namespace
|
||||||
{
|
{
|
||||||
enum class MUnits : qint8 { Table, Degrees};
|
enum class MUnits : qint8 { Table, Degrees};
|
||||||
|
|
||||||
|
struct IndividualMeasurement
|
||||||
|
{
|
||||||
|
IndividualMeasurement() = default;
|
||||||
|
|
||||||
|
QString name{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
QString value{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
QString fullName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
QString description{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto SaveDirPath(const QString &curFile, MeasurementsType mType) -> QString
|
auto SaveDirPath(const QString &curFile, MeasurementsType mType) -> QString
|
||||||
{
|
{
|
||||||
|
@ -191,6 +202,38 @@ auto ConverToDouble(QString text, const QString &error) -> qreal
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void SetIndividualMeasurementFullName(int i, const QString &name, const QxtCsvModel &csv, const QVector<int> &map,
|
||||||
|
IndividualMeasurement &measurement)
|
||||||
|
{
|
||||||
|
const int columns = csv.columnCount();
|
||||||
|
const bool custom = name.startsWith(CustomMSign);
|
||||||
|
if (columns > 2 && custom)
|
||||||
|
{
|
||||||
|
const int fullNameColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::FullName));
|
||||||
|
if (fullNameColumn >= 0)
|
||||||
|
{
|
||||||
|
measurement.fullName = csv.text(i, fullNameColumn).simplified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void SetIndividualMeasurementDescription(int i, const QString &name, const QxtCsvModel &csv, const QVector<int> &map,
|
||||||
|
IndividualMeasurement &measurement)
|
||||||
|
{
|
||||||
|
const int columns = csv.columnCount();
|
||||||
|
const bool custom = name.startsWith(CustomMSign);
|
||||||
|
if (columns > 3 && custom)
|
||||||
|
{
|
||||||
|
const int descriptionColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Description));
|
||||||
|
if (descriptionColumn >= 0)
|
||||||
|
{
|
||||||
|
measurement.description = csv.text(i, descriptionColumn).simplified();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// We need this enum in case we will add or delete a column. And also make code more readable.
|
// We need this enum in case we will add or delete a column. And also make code more readable.
|
||||||
|
@ -3960,16 +4003,6 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IndividualMeasurement
|
|
||||||
{
|
|
||||||
IndividualMeasurement() =default;
|
|
||||||
|
|
||||||
QString name{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
||||||
QString value{'0'}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
||||||
QString fullName{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
||||||
QString description{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
|
||||||
};
|
|
||||||
|
|
||||||
QVector<IndividualMeasurement> measurements;
|
QVector<IndividualMeasurement> measurements;
|
||||||
QSet<QString> importedNames;
|
QSet<QString> importedNames;
|
||||||
|
|
||||||
|
@ -3991,28 +4024,11 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
|
||||||
measurement.name = mName;
|
measurement.name = mName;
|
||||||
|
|
||||||
const int valueColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Value));
|
const int valueColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Value));
|
||||||
measurement.value =
|
measurement.value = VTranslateVars::TryFormulaFromUser(
|
||||||
VTranslateVars::TryFormulaFromUser(csv.text(i, valueColumn),
|
csv.text(i, valueColumn), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
||||||
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
|
|
||||||
|
|
||||||
const bool custom = name.startsWith(CustomMSign);
|
SetIndividualMeasurementFullName(i, name, csv, map, measurement);
|
||||||
if (columns > 2 && custom)
|
SetIndividualMeasurementDescription(i, name, csv, map, measurement);
|
||||||
{
|
|
||||||
const int fullNameColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::FullName));
|
|
||||||
if (fullNameColumn >= 0)
|
|
||||||
{
|
|
||||||
measurement.fullName = csv.text(i, fullNameColumn).simplified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (columns > 3 && custom)
|
|
||||||
{
|
|
||||||
const int descriptionColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Description));
|
|
||||||
if (descriptionColumn >= 0)
|
|
||||||
{
|
|
||||||
measurement.description = csv.text(i, descriptionColumn).simplified();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
measurements.append(measurement);
|
measurements.append(measurement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
auto IsPedantic() const -> bool override;
|
auto IsPedantic() const -> bool override;
|
||||||
|
|
||||||
static auto VApp() -> VApplication *;
|
static auto VApp() -> VApplication *;
|
||||||
|
static auto CommandLine() -> VCommandLinePtr;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void InitTrVars() override;
|
void InitTrVars() override;
|
||||||
|
@ -94,10 +95,6 @@ private:
|
||||||
static auto CreateLogDir() -> bool;
|
static auto CreateLogDir() -> bool;
|
||||||
void BeginLogging();
|
void BeginLogging();
|
||||||
static void ClearOldLogs();
|
static void ClearOldLogs();
|
||||||
|
|
||||||
public:
|
|
||||||
//moved to the end of class so merge should go
|
|
||||||
static auto CommandLine() -> VCommandLinePtr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -45,6 +45,15 @@
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto AttrUInt(const QDomElement &domElement, const QString &name) -> quint32
|
||||||
|
{
|
||||||
|
return VDomDocument::GetParametrUInt(domElement, name, QChar('0'));
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief DialogHistory create dialog
|
* @brief DialogHistory create dialog
|
||||||
|
@ -531,12 +540,6 @@ auto DialogHistory::PointName(quint32 pointId) const -> QString
|
||||||
return data->GeometricObject<VPointF>(pointId)->name();
|
return data->GeometricObject<VPointF>(pointId)->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
auto DialogHistory::AttrUInt(const QDomElement &domElement, const QString &name) const -> quint32
|
|
||||||
{
|
|
||||||
return VDomDocument::GetParametrUInt(domElement, name, QChar('0'));
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief closeEvent handle when windows is closing
|
* @brief closeEvent handle when windows is closing
|
||||||
|
|
|
@ -103,7 +103,6 @@ private:
|
||||||
void InitialTable();
|
void InitialTable();
|
||||||
void ShowPoint();
|
void ShowPoint();
|
||||||
auto PointName(quint32 pointId) const -> QString;
|
auto PointName(quint32 pointId) const -> QString;
|
||||||
auto AttrUInt(const QDomElement &domElement, const QString &name) const -> quint32;
|
|
||||||
void RetranslateUi();
|
void RetranslateUi();
|
||||||
auto CursorRow() const -> int;
|
auto CursorRow() const -> int;
|
||||||
|
|
||||||
|
|
|
@ -654,28 +654,32 @@ auto DialogIncrements::IncrementUsed(const QString &name) const -> bool
|
||||||
{
|
{
|
||||||
const QVector<VFormulaField> expressions = m_doc->ListExpressions();
|
const QVector<VFormulaField> expressions = m_doc->ListExpressions();
|
||||||
|
|
||||||
for(const auto &field : expressions)
|
return std::ranges::any_of(expressions,
|
||||||
{
|
[name](const auto &field)
|
||||||
if (field.expression.indexOf(name) != -1)
|
{
|
||||||
{
|
if (field.expression.indexOf(name) == -1)
|
||||||
// Eval formula
|
{
|
||||||
try
|
return false;
|
||||||
{
|
}
|
||||||
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(field.expression, false, false));
|
|
||||||
|
|
||||||
// Tokens (variables, measurements)
|
// Eval formula
|
||||||
if (cal->GetTokens().values().contains(name))
|
try
|
||||||
{
|
{
|
||||||
return true;
|
QScopedPointer<qmu::QmuTokenParser> cal(
|
||||||
}
|
new qmu::QmuTokenParser(field.expression, false, false));
|
||||||
}
|
|
||||||
catch (const qmu::QmuParserError &)
|
// Tokens (variables, measurements)
|
||||||
{
|
if (cal->GetTokens().values().contains(name))
|
||||||
// Do nothing. Because we not sure if used. A formula is broken.
|
{
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
catch (const qmu::QmuParserError &)
|
||||||
|
{
|
||||||
|
// Do nothing. Because we not sure if used. A formula is broken.
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1952,7 +1956,7 @@ auto DialogIncrements::eventFilter(QObject *object, QEvent *event) -> bool
|
||||||
void DialogIncrements::showEvent(QShowEvent *event)
|
void DialogIncrements::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
// Skip DialogTool implementation
|
// Skip DialogTool implementation
|
||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event); // NOLINT(bugprone-parent-virtual-call)
|
||||||
if ( event->spontaneous() )
|
if ( event->spontaneous() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6350,50 +6350,53 @@ void MainWindow::ExportDetailsAs()
|
||||||
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
||||||
{
|
{
|
||||||
const QStringList files = GetUnlokedRestoreFileList();
|
const QStringList files = GetUnlokedRestoreFileList();
|
||||||
if (not files.empty())
|
if (files.empty())
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "Reopen files after crash.");
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList restoreFiles;
|
qCDebug(vMainWindow, "Reopen files after crash.");
|
||||||
restoreFiles.reserve(files.size());
|
|
||||||
for (int i = 0; i < files.size(); ++i)
|
QStringList restoreFiles;
|
||||||
|
restoreFiles.reserve(files.size());
|
||||||
|
for (const auto &file : files)
|
||||||
|
{
|
||||||
|
if (QFile::exists(file + *autosavePrefix))
|
||||||
{
|
{
|
||||||
QFile file(files.at(i) + *autosavePrefix);
|
restoreFiles.append(file);
|
||||||
if (file.exists())
|
|
||||||
{
|
|
||||||
restoreFiles.append(files.at(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (not restoreFiles.empty())
|
if (restoreFiles.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox::StandardButton reply;
|
||||||
|
const QString mes = tr("Valentina didn't shut down correctly. Do you want reopen files (%1) you had open?")
|
||||||
|
.arg(restoreFiles.size());
|
||||||
|
reply = QMessageBox::question(this, tr("Reopen files."), mes, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
|
if (reply != QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qCDebug(vMainWindow, "User said Yes.");
|
||||||
|
|
||||||
|
for (auto &file : restoreFiles)
|
||||||
|
{
|
||||||
|
QString error;
|
||||||
|
if (VDomDocument::SafeCopy(file + *autosavePrefix, file, error))
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton reply;
|
QFile autoFile(file + *autosavePrefix);
|
||||||
const QString mes = tr("Valentina didn't shut down correctly. Do you want reopen files (%1) you had open?")
|
autoFile.remove();
|
||||||
.arg(restoreFiles.size());
|
LoadPattern(file);
|
||||||
reply = QMessageBox::question(this, tr("Reopen files."), mes, QMessageBox::Yes|QMessageBox::No,
|
args.removeAll(file); // Do not open file twice after we restore him.
|
||||||
QMessageBox::Yes);
|
}
|
||||||
if (reply == QMessageBox::Yes)
|
else
|
||||||
{
|
{
|
||||||
qCDebug(vMainWindow, "User said Yes.");
|
qCDebug(vMainWindow, "Could not copy %s%s to %s %s", qUtf8Printable(file), qUtf8Printable(*autosavePrefix),
|
||||||
|
qUtf8Printable(file), qUtf8Printable(error));
|
||||||
for (auto &file : restoreFiles)
|
|
||||||
{
|
|
||||||
QString error;
|
|
||||||
if (VDomDocument::SafeCopy(file + *autosavePrefix, file, error))
|
|
||||||
{
|
|
||||||
QFile autoFile(file + *autosavePrefix);
|
|
||||||
autoFile.remove();
|
|
||||||
LoadPattern(file);
|
|
||||||
args.removeAll(file);// Do not open file twice after we restore him.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qCDebug(vMainWindow, "Could not copy %s%s to %s %s",
|
|
||||||
qUtf8Printable(file), qUtf8Printable(*autosavePrefix),
|
|
||||||
qUtf8Printable(file), qUtf8Printable(error));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7368,12 +7371,12 @@ void MainWindow::PrintPatternMessage(QEvent *event)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::OpenWatermark(const QString &path)
|
void MainWindow::OpenWatermark(const QString &path)
|
||||||
{
|
{
|
||||||
for (auto i = m_watermarkEditors.cbegin(); i != m_watermarkEditors.cend(); ++i)
|
for (const auto &watermarkEditor : m_watermarkEditors)
|
||||||
{
|
{
|
||||||
if (not (*i).isNull() && not (*i)->CurrentFile().isEmpty()
|
if (not watermarkEditor.isNull() && not watermarkEditor->CurrentFile().isEmpty() &&
|
||||||
&& (*i)->CurrentFile() == AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), path))
|
watermarkEditor->CurrentFile() == AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), path))
|
||||||
{
|
{
|
||||||
(*i)->show();
|
watermarkEditor->show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ QT_WARNING_POP
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool CreateLayoutPath(const QString &path)
|
auto CreateLayoutPath(const QString &path) -> bool
|
||||||
{
|
{
|
||||||
bool usedNotExistedDir = true;
|
bool usedNotExistedDir = true;
|
||||||
QDir dir(path);
|
QDir dir(path);
|
||||||
|
@ -182,7 +182,7 @@ void MainWindowsNoGUI::ToolLayoutSettings(bool checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
|
auto MainWindowsNoGUI::GenerateLayout(VLayoutGenerator &lGenerator) -> bool
|
||||||
{
|
{
|
||||||
lGenerator.SetDetails(listDetails);
|
lGenerator.SetDetails(listDetails);
|
||||||
|
|
||||||
|
@ -422,15 +422,13 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
ShowLayoutError(nestingState);
|
||||||
|
if (not VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
ShowLayoutError(nestingState);
|
QCoreApplication::exit(V_EX_DATAERR);
|
||||||
if (not VApplication::IsGUIMode())
|
|
||||||
{
|
|
||||||
QCoreApplication::exit(V_EX_DATAERR);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -910,7 +908,7 @@ void MainWindowsNoGUI::PrintTiled()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<DetailForLayout> &details)
|
auto MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<DetailForLayout> &details) -> QVector<VLayoutPiece>
|
||||||
{
|
{
|
||||||
if (details.isEmpty())
|
if (details.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -964,13 +962,13 @@ void MainWindowsNoGUI::InitTempLayoutScene()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList MainWindowsNoGUI::RecentFileList() const
|
auto MainWindowsNoGUI::RecentFileList() const -> QStringList
|
||||||
{
|
{
|
||||||
return VAbstractValApplication::VApp()->ValentinaSettings()->GetRecentFileList();
|
return VAbstractValApplication::VApp()->ValentinaSettings()->GetRecentFileList();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QIcon MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const
|
auto MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const -> QIcon
|
||||||
{
|
{
|
||||||
QImage image;
|
QImage image;
|
||||||
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutSettings->LayoutPapers().at(i));
|
QGraphicsRectItem *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutSettings->LayoutPapers().at(i));
|
||||||
|
@ -1018,11 +1016,11 @@ QIcon MainWindowsNoGUI::ScenePreview(int i, QSize iconSize, PreviewQuatilty qual
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QGraphicsItem *> MainWindowsNoGUI::CreateShadows(const QList<QGraphicsItem *> &papers)
|
auto MainWindowsNoGUI::CreateShadows(const QList<QGraphicsItem *> &papers) -> QList<QGraphicsItem *>
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem *> shadows;
|
QList<QGraphicsItem *> shadows;
|
||||||
|
|
||||||
for (auto paper : papers)
|
for (auto *paper : papers)
|
||||||
{
|
{
|
||||||
qreal x1=0, y1=0, x2=0, y2=0;
|
qreal x1=0, y1=0, x2=0, y2=0;
|
||||||
if (QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(paper))
|
if (QGraphicsRectItem *item = qgraphicsitem_cast<QGraphicsRectItem *>(paper))
|
||||||
|
@ -1042,9 +1040,8 @@ QList<QGraphicsItem *> MainWindowsNoGUI::CreateShadows(const QList<QGraphicsItem
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QGraphicsScene *> MainWindowsNoGUI::CreateScenes(const QList<QGraphicsItem *> &papers,
|
auto MainWindowsNoGUI::CreateScenes(const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
||||||
const QList<QGraphicsItem *> &shadows,
|
const QList<QList<QGraphicsItem *>> &details) -> QList<QGraphicsScene *>
|
||||||
const QList<QList<QGraphicsItem *> > &details)
|
|
||||||
{
|
{
|
||||||
QList<QGraphicsScene *> scenes;
|
QList<QGraphicsScene *> scenes;
|
||||||
scenes.reserve(papers.size());
|
scenes.reserve(papers.size());
|
||||||
|
@ -1243,7 +1240,7 @@ void MainWindowsNoGUI::ExportScene(const QList<QGraphicsScene *> &scenes,
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString MainWindowsNoGUI::FileName() const
|
auto MainWindowsNoGUI::FileName() const -> QString
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName;
|
||||||
VAbstractValApplication::VApp()->GetPatternPath().isEmpty()
|
VAbstractValApplication::VApp()->GetPatternPath().isEmpty()
|
||||||
|
@ -1252,8 +1249,8 @@ QString MainWindowsNoGUI::FileName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib,
|
auto MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib,
|
||||||
const QChar &separator) const
|
const QChar &separator) const -> bool
|
||||||
{
|
{
|
||||||
QxtCsvModel csv;
|
QxtCsvModel csv;
|
||||||
|
|
||||||
|
@ -1332,7 +1329,7 @@ bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QSharedPointer<VMeasurements> MainWindowsNoGUI::OpenMeasurementFile(const QString &path) const
|
auto MainWindowsNoGUI::OpenMeasurementFile(const QString &path) const -> QSharedPointer<VMeasurements>
|
||||||
{
|
{
|
||||||
QSharedPointer<VMeasurements> m;
|
QSharedPointer<VMeasurements> m;
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "dialogs/dialogsavelayout.h"
|
#include "dialogs/dialogsavelayout.h"
|
||||||
#include "../vlayout/vlayoutgenerator.h"
|
#include "../vlayout/vlayoutgenerator.h"
|
||||||
#include "../vwidgets/vabstractmainwindow.h"
|
#include "../vwidgets/vabstractmainwindow.h"
|
||||||
#include "../vlayout/vtextmanager.h"
|
|
||||||
#include "../vlayout/vprintlayout.h"
|
#include "../vlayout/vprintlayout.h"
|
||||||
|
|
||||||
class QGraphicsScene;
|
class QGraphicsScene;
|
||||||
|
@ -55,15 +54,16 @@ class QWinTaskbarProgress;
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||||
|
|
||||||
struct DetailForLayout {
|
struct DetailForLayout
|
||||||
|
{
|
||||||
DetailForLayout() = default;
|
DetailForLayout() = default;
|
||||||
|
|
||||||
DetailForLayout(quint32 id, const VPiece &piece)
|
DetailForLayout(quint32 id, const VPiece &piece)
|
||||||
: id(id), piece(piece)
|
: id(id), piece(piece)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
quint32 id{NULL_ID};
|
quint32 id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
VPiece piece;
|
VPiece piece{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -75,7 +75,7 @@ class MainWindowsNoGUI : public VAbstractMainWindow
|
||||||
Q_OBJECT // NOLINT
|
Q_OBJECT // NOLINT
|
||||||
public:
|
public:
|
||||||
explicit MainWindowsNoGUI(QWidget *parent = nullptr);
|
explicit MainWindowsNoGUI(QWidget *parent = nullptr);
|
||||||
virtual ~MainWindowsNoGUI() override;
|
~MainWindowsNoGUI() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ToolLayoutSettings(bool checked);
|
void ToolLayoutSettings(bool checked);
|
||||||
|
@ -86,70 +86,69 @@ public slots:
|
||||||
protected slots:
|
protected slots:
|
||||||
void ExportFMeasurementsToCSV();
|
void ExportFMeasurementsToCSV();
|
||||||
protected:
|
protected:
|
||||||
QVector<VLayoutPiece> listDetails{};
|
QVector<VLayoutPiece> listDetails{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief currentScene pointer to current scene. */
|
/** @brief currentScene pointer to current scene. */
|
||||||
QGraphicsScene *currentScene{nullptr};
|
QGraphicsScene *currentScene{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QGraphicsScene *tempSceneLayout{nullptr};
|
QGraphicsScene *tempSceneLayout{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
|
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
|
||||||
VContainer *pattern;
|
VContainer *pattern; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief doc dom document container */
|
/** @brief doc dom document container */
|
||||||
VPattern *doc{nullptr};
|
VPattern *doc{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QList<QGraphicsItem *> gcontours{};
|
QList<QGraphicsItem *> gcontours{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QVector<QVector<VLayoutPiece> > detailsOnLayout{};
|
QVector<QVector<VLayoutPiece>> detailsOnLayout{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QAction *undoAction{nullptr};
|
QAction *undoAction{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QAction *redoAction{nullptr};
|
QAction *redoAction{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QAction *actionDockWidgetToolOptions{nullptr};
|
QAction *actionDockWidgetToolOptions{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QAction *actionDockWidgetGroups{nullptr};
|
QAction *actionDockWidgetGroups{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QAction *actionDockWidgetBackgroundImages{nullptr};
|
QAction *actionDockWidgetBackgroundImages{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
bool isNoScaling{false};
|
bool isNoScaling{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
bool isNeedAutosave{false};
|
bool isNeedAutosave{false}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
VPrintLayout *m_layoutSettings{new VPrintLayout(this)};
|
VPrintLayout *m_layoutSettings{new VPrintLayout(this)}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
||||||
QPointer<QLabel> m_mouseCoordinate{nullptr};
|
QPointer<QLabel> m_mouseCoordinate{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QPointer<QLabel> m_unreadPatternMessage{nullptr};
|
QPointer<QLabel> m_unreadPatternMessage{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout{};
|
QSharedPointer<DialogSaveLayout> m_dialogSaveLayout{}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
QWinTaskbarButton *m_taskbarButton;
|
QWinTaskbarButton *m_taskbarButton; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
QWinTaskbarProgress *m_taskbarProgress{nullptr};
|
QWinTaskbarProgress *m_taskbarProgress{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static QVector<VLayoutPiece> PrepareDetailsForLayout(const QVector<DetailForLayout> &details);
|
static auto PrepareDetailsForLayout(const QVector<DetailForLayout> &details) -> QVector<VLayoutPiece>;
|
||||||
|
|
||||||
void ExportData(const QVector<VLayoutPiece> &listDetails);
|
void ExportData(const QVector<VLayoutPiece> &listDetails);
|
||||||
|
|
||||||
void InitTempLayoutScene();
|
void InitTempLayoutScene();
|
||||||
virtual void CleanLayout()=0;
|
virtual void CleanLayout()=0;
|
||||||
virtual void PrepareSceneList(PreviewQuatilty quality)=0;
|
virtual void PrepareSceneList(PreviewQuatilty quality)=0;
|
||||||
virtual QStringList RecentFileList() const override;
|
auto RecentFileList() const -> QStringList override;
|
||||||
QIcon ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const;
|
auto ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const -> QIcon;
|
||||||
bool GenerateLayout(VLayoutGenerator& lGenerator);
|
auto GenerateLayout(VLayoutGenerator &lGenerator) -> bool;
|
||||||
QString FileName() const;
|
auto FileName() const -> QString;
|
||||||
|
|
||||||
bool ExportFMeasurementsToCSVData(const QString &fileName,
|
auto ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib, const QChar &separator) const
|
||||||
bool withHeader, int mib, const QChar &separator) const;
|
-> bool;
|
||||||
|
|
||||||
QSharedPointer<VMeasurements> OpenMeasurementFile(const QString &path) const;
|
auto OpenMeasurementFile(const QString &path) const -> QSharedPointer<VMeasurements>;
|
||||||
|
|
||||||
void CheckRequiredMeasurements(const VMeasurements *m) const;
|
void CheckRequiredMeasurements(const VMeasurements *m) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(MainWindowsNoGUI) // NOLINT
|
Q_DISABLE_COPY_MOVE(MainWindowsNoGUI) // NOLINT
|
||||||
|
|
||||||
static QList<QGraphicsItem *> CreateShadows(const QList<QGraphicsItem *> &papers);
|
static auto CreateShadows(const QList<QGraphicsItem *> &papers) -> QList<QGraphicsItem *>;
|
||||||
static QList<QGraphicsScene *> CreateScenes(const QList<QGraphicsItem *> &papers,
|
static auto CreateScenes(const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
|
||||||
const QList<QGraphicsItem *> &shadows,
|
const QList<QList<QGraphicsItem *>> &details) -> QList<QGraphicsScene *>;
|
||||||
const QList<QList<QGraphicsItem *> > &details);
|
|
||||||
|
|
||||||
void PdfTiledFile(const QString &name);
|
void PdfTiledFile(const QString &name);
|
||||||
|
|
||||||
|
|
|
@ -132,13 +132,13 @@ using namespace bpstd::literals::chrono_literals;
|
||||||
#endif // __cplusplus >= 201402L
|
#endif // __cplusplus >= 201402L
|
||||||
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
|
||||||
|
|
||||||
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");
|
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly"); // NOLINT(cert-err58-cpp)
|
||||||
const QString VPattern::AttrLabelPrefix = QStringLiteral("labelPrefix");
|
const QString VPattern::AttrLabelPrefix = QStringLiteral("labelPrefix"); // NOLINT(cert-err58-cpp)
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString FileComment()
|
auto FileComment() -> QString
|
||||||
{
|
{
|
||||||
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).")
|
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).")
|
||||||
.arg(APP_VERSION_STR);
|
.arg(APP_VERSION_STR);
|
||||||
|
@ -151,7 +151,7 @@ void GatherCount(int &count, const int nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString DefLabelLanguage()
|
auto DefLabelLanguage() -> QString
|
||||||
{
|
{
|
||||||
QString def = VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage();
|
QString def = VAbstractValApplication::VApp()->ValentinaSettings()->GetLabelLanguage();
|
||||||
if (not ConvertToSet<QString>(VApplication::LabelLanguages()).contains(def))
|
if (not ConvertToSet<QString>(VApplication::LabelLanguages()).contains(def))
|
||||||
|
@ -231,66 +231,20 @@ void VPattern::Parse(const Document &parse)
|
||||||
m_parsing = true;
|
m_parsing = true;
|
||||||
SCASSERT(sceneDraw != nullptr)
|
SCASSERT(sceneDraw != nullptr)
|
||||||
SCASSERT(sceneDetail != nullptr)
|
SCASSERT(sceneDetail != nullptr)
|
||||||
static const QStringList tags({TagDraw, TagIncrements, TagPreviewCalculations});
|
|
||||||
PrepareForParse(parse);
|
PrepareForParse(parse);
|
||||||
|
|
||||||
QDomNode domNode = documentElement().firstChild();
|
QDomNode domNode = documentElement().firstChild();
|
||||||
while (domNode.isNull() == false)
|
while (not domNode.isNull())
|
||||||
{
|
{
|
||||||
if (domNode.isElement())
|
ParseRootElement(parse, domNode);
|
||||||
{
|
|
||||||
const QDomElement domElement = domNode.toElement();
|
|
||||||
if (domElement.isNull() == false)
|
|
||||||
{
|
|
||||||
switch (tags.indexOf(domElement.tagName()))
|
|
||||||
{
|
|
||||||
case 0: // TagDraw
|
|
||||||
qCDebug(vXML, "Tag draw.");
|
|
||||||
if (parse == Document::FullParse)
|
|
||||||
{
|
|
||||||
if (nameActivPP.isEmpty())
|
|
||||||
{
|
|
||||||
SetActivPP(GetParametrString(domElement, AttrName));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChangeActivPP(GetParametrString(domElement, AttrName));
|
|
||||||
}
|
|
||||||
patternPieces << GetParametrString(domElement, AttrName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ChangeActivPP(GetParametrString(domElement, AttrName), Document::LiteParse);
|
|
||||||
}
|
|
||||||
ParseDrawElement(domElement, parse);
|
|
||||||
break;
|
|
||||||
case 1: // TagIncrements
|
|
||||||
if (parse != Document::LiteParse)
|
|
||||||
{
|
|
||||||
qCDebug(vXML, "Tag increments.");
|
|
||||||
ParseIncrementsElement(domElement, parse);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2: // TagPreviewCalculations
|
|
||||||
if (parse != Document::LiteParse)
|
|
||||||
{
|
|
||||||
qCDebug(vXML, "Tag prewiew calculations.");
|
|
||||||
ParseIncrementsElement(domElement, parse);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qCDebug(vXML, "Ignoring tag %s", qUtf8Printable(domElement.tagName()));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
domNode = domNode.nextSibling();
|
domNode = domNode.nextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VApplication::IsGUIMode())
|
if (VApplication::IsGUIMode())
|
||||||
{
|
{
|
||||||
QTimer::singleShot(V_SECONDS(1), Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
|
QTimer::singleShot(V_SECONDS(1), Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
|
||||||
}
|
}
|
||||||
else if (VApplication::VApp()->CommandLine()->IsTestModeEnabled())
|
else if (VApplication::CommandLine()->IsTestModeEnabled())
|
||||||
{
|
{
|
||||||
RefreshPieceGeometry();
|
RefreshPieceGeometry();
|
||||||
}
|
}
|
||||||
|
@ -307,51 +261,50 @@ void VPattern::Parse(const Document &parse)
|
||||||
*/
|
*/
|
||||||
void VPattern::setCurrentData()
|
void VPattern::setCurrentData()
|
||||||
{
|
{
|
||||||
if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation)
|
const int countPP = CountPP();
|
||||||
|
// don't need upadate data if we have only one pattern piece
|
||||||
|
if (VAbstractValApplication::VApp()->GetDrawMode() != Draw::Calculation || countPP <= 1)
|
||||||
{
|
{
|
||||||
const int countPP = CountPP();
|
return;
|
||||||
if (countPP > 1)//don't need upadate data if we have only one pattern piece
|
|
||||||
{
|
|
||||||
qCDebug(vXML, "Setting current data");
|
|
||||||
qCDebug(vXML, "Current PP name %s", qUtf8Printable(nameActivPP));
|
|
||||||
qCDebug(vXML, "PP count %d", countPP);
|
|
||||||
|
|
||||||
const QVector<VToolRecord> localHistory = getLocalHistory();
|
|
||||||
if (localHistory.size() == 0)
|
|
||||||
{
|
|
||||||
qCDebug(vXML, "History is empty!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const quint32 id = ConstLast(localHistory).getId();
|
|
||||||
qCDebug(vXML, "Resoring data from tool with id %u", id);
|
|
||||||
|
|
||||||
if (tools.size() > 0)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ToolExists(id);
|
|
||||||
}
|
|
||||||
catch (VExceptionBadId &e)
|
|
||||||
{
|
|
||||||
Q_UNUSED(e)
|
|
||||||
qCDebug(vXML, "List of tools doesn't containe id= %u", id);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const VDataTool *vTool = tools.value(id);
|
|
||||||
*data = vTool->getData();
|
|
||||||
//Delete special variables if exist
|
|
||||||
data->RemoveVariable(currentLength);
|
|
||||||
data->RemoveVariable(currentSeamAllowance);
|
|
||||||
qCDebug(vXML, "Data successfully updated.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qCDebug(vXML, "List of tools is empty!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qCDebug(vXML, "Setting current data");
|
||||||
|
qCDebug(vXML, "Current PP name %s", qUtf8Printable(nameActivPP));
|
||||||
|
qCDebug(vXML, "PP count %d", countPP);
|
||||||
|
|
||||||
|
const QVector<VToolRecord> localHistory = getLocalHistory();
|
||||||
|
if (localHistory.isEmpty())
|
||||||
|
{
|
||||||
|
qCDebug(vXML, "History is empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const quint32 id = ConstLast(localHistory).getId();
|
||||||
|
qCDebug(vXML, "Resoring data from tool with id %u", id);
|
||||||
|
|
||||||
|
if (not tools.isEmpty())
|
||||||
|
{
|
||||||
|
qCDebug(vXML, "List of tools is empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ToolExists(id);
|
||||||
|
}
|
||||||
|
catch (VExceptionBadId &e)
|
||||||
|
{
|
||||||
|
Q_UNUSED(e)
|
||||||
|
qCDebug(vXML, "List of tools doesn't containe id= %u", id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const VDataTool *vTool = tools.value(id);
|
||||||
|
*data = vTool->getData();
|
||||||
|
// Delete special variables if exist
|
||||||
|
data->RemoveVariable(currentLength);
|
||||||
|
data->RemoveVariable(currentSeamAllowance);
|
||||||
|
qCDebug(vXML, "Data successfully updated.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -371,7 +324,7 @@ void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer VPattern::GetCompleteData() const
|
auto VPattern::GetCompleteData() const -> VContainer
|
||||||
{
|
{
|
||||||
const int countPP = CountPP();
|
const int countPP = CountPP();
|
||||||
if (countPP <= 0 || history.isEmpty() || tools.isEmpty())
|
if (countPP <= 0 || history.isEmpty() || tools.isEmpty())
|
||||||
|
@ -406,7 +359,7 @@ VContainer VPattern::GetCompleteData() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer VPattern::GetCompletePPData(const QString &name) const
|
auto VPattern::GetCompletePPData(const QString &name) const -> VContainer
|
||||||
{
|
{
|
||||||
const int countPP = CountPP();
|
const int countPP = CountPP();
|
||||||
if (countPP <= 0 || history.isEmpty() || tools.isEmpty())
|
if (countPP <= 0 || history.isEmpty() || tools.isEmpty())
|
||||||
|
@ -446,18 +399,19 @@ VContainer VPattern::GetCompletePPData(const QString &name) const
|
||||||
* @return id base point.
|
* @return id base point.
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
quint32 VPattern::SPointActiveDraw()
|
auto VPattern::SPointActiveDraw() -> quint32
|
||||||
{
|
{
|
||||||
QDomElement calcElement;
|
QDomElement calcElement;
|
||||||
if (GetActivNodeElement(TagCalculation, calcElement))
|
if (GetActivNodeElement(TagCalculation, calcElement))
|
||||||
{
|
{
|
||||||
const QDomNode domNode = calcElement.firstChild();
|
const QDomNode domNode = calcElement.firstChild();
|
||||||
if (domNode.isNull() == false && domNode.isElement())
|
if (not domNode.isNull() && domNode.isElement())
|
||||||
{
|
{
|
||||||
const QDomElement domElement = domNode.toElement();
|
const QDomElement domElement = domNode.toElement();
|
||||||
if (domElement.isNull() == false)
|
if (not domElement.isNull())
|
||||||
{
|
{
|
||||||
if (domElement.tagName() == TagPoint && domElement.attribute(AttrType, QString()) == VToolBasePoint::ToolType)
|
if (domElement.tagName() == TagPoint &&
|
||||||
|
domElement.attribute(AttrType, QString()) == VToolBasePoint::ToolType)
|
||||||
{
|
{
|
||||||
return GetParametrId(domElement);
|
return GetParametrId(domElement);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +422,7 @@ quint32 VPattern::SPointActiveDraw()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<quint32> VPattern::GetActivePPPieces() const
|
auto VPattern::GetActivePPPieces() const -> QVector<quint32>
|
||||||
{
|
{
|
||||||
QVector<quint32> pieces;
|
QVector<quint32> pieces;
|
||||||
QDomElement drawElement;
|
QDomElement drawElement;
|
||||||
|
@ -493,7 +447,7 @@ QVector<quint32> VPattern::GetActivePPPieces() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPattern::SaveDocument(const QString &fileName, QString &error)
|
auto VPattern::SaveDocument(const QString &fileName, QString &error) -> bool
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -608,7 +562,7 @@ void VPattern::LiteParseIncrements()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VPattern::ElementsToParse() const
|
auto VPattern::ElementsToParse() const -> int
|
||||||
{
|
{
|
||||||
QVector<QString> tags{TagCalculation, TagDetails, TagModeling, TagIncrements};
|
QVector<QString> tags{TagCalculation, TagDetails, TagModeling, TagIncrements};
|
||||||
|
|
||||||
|
@ -755,7 +709,7 @@ void VPattern::Clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
|
auto VPattern::ParseDetailNode(const QDomElement &domElement) -> VNodeDetail
|
||||||
{
|
{
|
||||||
const quint32 id = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
const quint32 id = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
||||||
const qreal mx = GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"));
|
const qreal mx = GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"));
|
||||||
|
@ -766,11 +720,8 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
|
||||||
const QString t = GetParametrString(domElement, AttrType, QStringLiteral("NodePoint"));
|
const QString t = GetParametrString(domElement, AttrType, QStringLiteral("NodePoint"));
|
||||||
Tool tool;
|
Tool tool;
|
||||||
|
|
||||||
QStringList types = QStringList() << VAbstractPattern::NodePoint
|
QStringList types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline,
|
||||||
<< VAbstractPattern::NodeArc
|
VAbstractPattern::NodeSplinePath, VAbstractPattern::NodeElArc};
|
||||||
<< VAbstractPattern::NodeSpline
|
|
||||||
<< VAbstractPattern::NodeSplinePath
|
|
||||||
<< VAbstractPattern::NodeElArc;
|
|
||||||
switch (types.indexOf(t))
|
switch (types.indexOf(t))
|
||||||
{
|
{
|
||||||
case 0: // NodePoint
|
case 0: // NodePoint
|
||||||
|
@ -789,10 +740,67 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
|
||||||
tool = Tool::NodeElArc;
|
tool = Tool::NodeElArc;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
VException e(tr("Wrong tag name '%1'.").arg(t));
|
throw VException(tr("Wrong tag name '%1'.").arg(t));
|
||||||
throw e;
|
}
|
||||||
|
return {id, tool, nodeType, mx, my, reverse};
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPattern::ParseRootElement(const Document &parse, const QDomNode &node)
|
||||||
|
{
|
||||||
|
static const QStringList tags({TagDraw, TagIncrements, TagPreviewCalculations});
|
||||||
|
|
||||||
|
if (not node.isElement())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QDomElement domElement = node.toElement();
|
||||||
|
if (domElement.isNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tags.indexOf(domElement.tagName()))
|
||||||
|
{
|
||||||
|
case 0: // TagDraw
|
||||||
|
qCDebug(vXML, "Tag draw.");
|
||||||
|
if (parse == Document::FullParse)
|
||||||
|
{
|
||||||
|
if (nameActivPP.isEmpty())
|
||||||
|
{
|
||||||
|
SetActivPP(GetParametrString(domElement, AttrName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeActivPP(GetParametrString(domElement, AttrName));
|
||||||
|
}
|
||||||
|
patternPieces << GetParametrString(domElement, AttrName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ChangeActivPP(GetParametrString(domElement, AttrName), Document::LiteParse);
|
||||||
|
}
|
||||||
|
ParseDrawElement(domElement, parse);
|
||||||
|
break;
|
||||||
|
case 1: // TagIncrements
|
||||||
|
if (parse != Document::LiteParse)
|
||||||
|
{
|
||||||
|
qCDebug(vXML, "Tag increments.");
|
||||||
|
ParseIncrementsElement(domElement, parse);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: // TagPreviewCalculations
|
||||||
|
if (parse != Document::LiteParse)
|
||||||
|
{
|
||||||
|
qCDebug(vXML, "Tag prewiew calculations.");
|
||||||
|
ParseIncrementsElement(domElement, parse);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qCDebug(vXML, "Ignoring tag %s", qUtf8Printable(domElement.tagName()));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return VNodeDetail(id, tool, nodeType, mx, my, reverse);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -807,34 +815,40 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
|
||||||
QDomNode domNode = node.firstChild();
|
QDomNode domNode = node.firstChild();
|
||||||
while (not domNode.isNull())
|
while (not domNode.isNull())
|
||||||
{
|
{
|
||||||
if (domNode.isElement())
|
if (not domNode.isElement())
|
||||||
{
|
{
|
||||||
const QDomElement domElement = domNode.toElement();
|
domNode = domNode.nextSibling();
|
||||||
if (not domElement.isNull())
|
continue;
|
||||||
{
|
}
|
||||||
switch (tags.indexOf(domElement.tagName()))
|
|
||||||
{
|
const QDomElement domElement = domNode.toElement();
|
||||||
case 0: // TagCalculation
|
if (domElement.isNull())
|
||||||
qCDebug(vXML, "Tag calculation.");
|
{
|
||||||
data->ClearCalculationGObjects();
|
domNode = domNode.nextSibling();
|
||||||
ParseDrawMode(domElement, parse, Draw::Calculation);
|
continue;
|
||||||
break;
|
}
|
||||||
case 1: // TagModeling
|
|
||||||
qCDebug(vXML, "Tag modeling.");
|
switch (tags.indexOf(domElement.tagName()))
|
||||||
ParseDrawMode(domElement, parse, Draw::Modeling);
|
{
|
||||||
break;
|
case 0: // TagCalculation
|
||||||
case 2: // TagDetails
|
qCDebug(vXML, "Tag calculation.");
|
||||||
qCDebug(vXML, "Tag details.");
|
data->ClearCalculationGObjects();
|
||||||
ParseDetails(domElement, parse);
|
ParseDrawMode(domElement, parse, Draw::Calculation);
|
||||||
break;
|
break;
|
||||||
case 3: // TagGroups
|
case 1: // TagModeling
|
||||||
qCDebug(vXML, "Tag groups.");
|
qCDebug(vXML, "Tag modeling.");
|
||||||
ParseGroups(domElement);
|
ParseDrawMode(domElement, parse, Draw::Modeling);
|
||||||
break;
|
break;
|
||||||
default:
|
case 2: // TagDetails
|
||||||
throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
|
qCDebug(vXML, "Tag details.");
|
||||||
}
|
ParseDetails(domElement, parse);
|
||||||
}
|
break;
|
||||||
|
case 3: // TagGroups
|
||||||
|
qCDebug(vXML, "Tag groups.");
|
||||||
|
ParseGroups(domElement);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
|
||||||
}
|
}
|
||||||
domNode = domNode.nextSibling();
|
domNode = domNode.nextSibling();
|
||||||
}
|
}
|
||||||
|
@ -851,61 +865,12 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
|
||||||
{
|
{
|
||||||
SCASSERT(sceneDraw != nullptr)
|
SCASSERT(sceneDraw != nullptr)
|
||||||
SCASSERT(sceneDetail != nullptr)
|
SCASSERT(sceneDetail != nullptr)
|
||||||
VMainGraphicsScene *scene = mode == Draw::Calculation ? sceneDraw : sceneDetail;
|
|
||||||
static const QStringList tags({TagPoint,
|
|
||||||
TagLine,
|
|
||||||
TagSpline,
|
|
||||||
TagArc,
|
|
||||||
TagTools,
|
|
||||||
TagOperation,
|
|
||||||
TagElArc,
|
|
||||||
TagPath});
|
|
||||||
const QDomNodeList nodeList = node.childNodes();
|
const QDomNodeList nodeList = node.childNodes();
|
||||||
const qint32 num = nodeList.size();
|
for (qint32 i = 0; i < nodeList.size(); ++i)
|
||||||
for (qint32 i = 0; i < num; ++i)
|
|
||||||
{
|
{
|
||||||
QDomElement domElement = nodeList.at(i).toElement();
|
QDomElement domElement = nodeList.at(i).toElement();
|
||||||
if (domElement.isNull() == false)
|
ParseDrawModeElement(domElement, parse, mode);
|
||||||
{
|
|
||||||
switch (tags.indexOf(domElement.tagName()))
|
|
||||||
{
|
|
||||||
case 0: // TagPoint
|
|
||||||
qCDebug(vXML, "Tag point.");
|
|
||||||
ParsePointElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
|
||||||
break;
|
|
||||||
case 1: // TagLine
|
|
||||||
qCDebug(vXML, "Tag line.");
|
|
||||||
ParseLineElement(scene, domElement, parse);
|
|
||||||
break;
|
|
||||||
case 2: // TagSpline
|
|
||||||
qCDebug(vXML, "Tag spline.");
|
|
||||||
ParseSplineElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
|
||||||
break;
|
|
||||||
case 3: // TagArc
|
|
||||||
qCDebug(vXML, "Tag arc.");
|
|
||||||
ParseArcElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
|
||||||
break;
|
|
||||||
case 4: // TagTools
|
|
||||||
qCDebug(vXML, "Tag tools.");
|
|
||||||
ParseToolsElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
|
||||||
break;
|
|
||||||
case 5: // TagOperation
|
|
||||||
qCDebug(vXML, "Tag operation.");
|
|
||||||
ParseOperationElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
|
||||||
break;
|
|
||||||
case 6: // TagElArc
|
|
||||||
qCDebug(vXML, "Tag elliptical arc.");
|
|
||||||
ParseEllipticalArcElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
|
||||||
break;
|
|
||||||
case 7: // TagPath
|
|
||||||
qCDebug(vXML, "Tag path.");
|
|
||||||
ParsePathElement(scene, domElement, parse);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse == Document::FullParse)
|
if (parse == Document::FullParse)
|
||||||
|
@ -914,6 +879,56 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPattern::ParseDrawModeElement(QDomElement &domElement, const Document &parse, const Draw &mode)
|
||||||
|
{
|
||||||
|
VMainGraphicsScene *scene = mode == Draw::Calculation ? sceneDraw : sceneDetail;
|
||||||
|
static const QStringList tags({TagPoint, TagLine, TagSpline, TagArc, TagTools, TagOperation, TagElArc, TagPath});
|
||||||
|
|
||||||
|
if (domElement.isNull())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (tags.indexOf(domElement.tagName()))
|
||||||
|
{
|
||||||
|
case 0: // TagPoint
|
||||||
|
qCDebug(vXML, "Tag point.");
|
||||||
|
ParsePointElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
||||||
|
break;
|
||||||
|
case 1: // TagLine
|
||||||
|
qCDebug(vXML, "Tag line.");
|
||||||
|
ParseLineElement(scene, domElement, parse);
|
||||||
|
break;
|
||||||
|
case 2: // TagSpline
|
||||||
|
qCDebug(vXML, "Tag spline.");
|
||||||
|
ParseSplineElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
||||||
|
break;
|
||||||
|
case 3: // TagArc
|
||||||
|
qCDebug(vXML, "Tag arc.");
|
||||||
|
ParseArcElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
||||||
|
break;
|
||||||
|
case 4: // TagTools
|
||||||
|
qCDebug(vXML, "Tag tools.");
|
||||||
|
ParseToolsElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
||||||
|
break;
|
||||||
|
case 5: // TagOperation
|
||||||
|
qCDebug(vXML, "Tag operation.");
|
||||||
|
ParseOperationElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
||||||
|
break;
|
||||||
|
case 6: // TagElArc
|
||||||
|
qCDebug(vXML, "Tag elliptical arc.");
|
||||||
|
ParseEllipticalArcElement(scene, domElement, parse, domElement.attribute(AttrType, QString()));
|
||||||
|
break;
|
||||||
|
case 7: // TagPath
|
||||||
|
qCDebug(vXML, "Tag path.");
|
||||||
|
ParsePathElement(scene, domElement, parse);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief ParseDetailElement parse detail tag.
|
* @brief ParseDetailElement parse detail tag.
|
||||||
|
@ -1119,7 +1134,7 @@ void VPattern::ParseDetailInternals(const QDomElement &domElement, VPiece &detai
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VPieceNode> VPattern::ParseDetailNodes(const QDomElement &domElement, qreal width, bool closed) const
|
auto VPattern::ParseDetailNodes(const QDomElement &domElement, qreal width, bool closed) const -> QVector<VPieceNode>
|
||||||
{
|
{
|
||||||
QVector<VNodeDetail> oldNodes;
|
QVector<VNodeDetail> oldNodes;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -1137,7 +1152,7 @@ QVector<VPieceNode> VPattern::ParseDetailNodes(const QDomElement &domElement, qr
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceLabelData VPattern::ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData ppData) const
|
auto VPattern::ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData ppData) const -> VPieceLabelData
|
||||||
{
|
{
|
||||||
ppData.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
ppData.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
||||||
ppData.SetLetter(GetParametrEmptyString(domElement, AttrLetter));
|
ppData.SetLetter(GetParametrEmptyString(domElement, AttrLetter));
|
||||||
|
@ -1178,7 +1193,8 @@ VPieceLabelData VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiec
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternLabelData VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabelData patternInfo) const
|
auto VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabelData patternInfo) const
|
||||||
|
-> VPatternLabelData
|
||||||
{
|
{
|
||||||
patternInfo.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
patternInfo.SetVisible(GetParametrBool(domElement, AttrVisible, trueStr));
|
||||||
patternInfo.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
patternInfo.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
||||||
|
@ -1210,7 +1226,7 @@ VPatternLabelData VPattern::ParsePiecePatternInfo(const QDomElement &domElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VGrainlineData VPattern::ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const
|
auto VPattern::ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const -> VGrainlineData
|
||||||
{
|
{
|
||||||
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
|
gGeometry.SetVisible(GetParametrBool(domElement, AttrVisible, falseStr));
|
||||||
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
gGeometry.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
|
||||||
|
@ -1315,8 +1331,8 @@ void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
* @param type type of point.
|
* @param type type of point.
|
||||||
*/
|
*/
|
||||||
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
const Document &parse, const QString &type)
|
const QString &type)
|
||||||
{
|
{
|
||||||
SCASSERT(scene != nullptr)
|
SCASSERT(scene != nullptr)
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -1486,7 +1502,7 @@ void VPattern::ParseCurrentPP()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPattern::GetLabelBase(quint32 index) const
|
auto VPattern::GetLabelBase(quint32 index) const -> QString
|
||||||
{
|
{
|
||||||
QStringList alphabet;
|
QStringList alphabet;
|
||||||
switch (VApplication::LabelLanguages().indexOf(GetLabelPrefix()))
|
switch (VApplication::LabelLanguages().indexOf(GetLabelPrefix()))
|
||||||
|
@ -3536,7 +3552,7 @@ void VPattern::ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok) const
|
auto VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok) const -> qreal
|
||||||
{
|
{
|
||||||
if (formula.isEmpty())
|
if (formula.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -3563,7 +3579,7 @@ qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPattern::MakeEmptyIncrement(const QString &name, IncrementType type)
|
auto VPattern::MakeEmptyIncrement(const QString &name, IncrementType type) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement element = createElement(TagIncrement);
|
QDomElement element = createElement(TagIncrement);
|
||||||
SetAttribute(element, AttrName, name);
|
SetAttribute(element, AttrName, name);
|
||||||
|
@ -3575,7 +3591,7 @@ QDomElement VPattern::MakeEmptyIncrement(const QString &name, IncrementType type
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPattern::FindIncrement(const QString &name) const
|
auto VPattern::FindIncrement(const QString &name) const -> QDomElement
|
||||||
{
|
{
|
||||||
QDomNodeList list = elementsByTagName(TagIncrement);
|
QDomNodeList list = elementsByTagName(TagIncrement);
|
||||||
|
|
||||||
|
@ -3740,7 +3756,7 @@ void VPattern::SetIncrementAttribute(const QString &name, const QString &attr, c
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPattern::LastDrawName() const
|
auto VPattern::LastDrawName() const -> QString
|
||||||
{
|
{
|
||||||
const QDomNodeList elements = this->documentElement().elementsByTagName(TagDraw);
|
const QDomNodeList elements = this->documentElement().elementsByTagName(TagDraw);
|
||||||
if (elements.size() == 0)
|
if (elements.size() == 0)
|
||||||
|
@ -3758,7 +3774,7 @@ QString VPattern::LastDrawName() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VPattern::LastToolId() const
|
auto VPattern::LastToolId() const -> quint32
|
||||||
{
|
{
|
||||||
const QString name = LastDrawName();
|
const QString name = LastDrawName();
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
|
@ -3770,7 +3786,7 @@ quint32 VPattern::LastToolId() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VPattern::PPLastToolId(const QString &name) const
|
auto VPattern::PPLastToolId(const QString &name) const -> quint32
|
||||||
{
|
{
|
||||||
const QVector<VToolRecord> localHistory = getLocalHistory(name);
|
const QVector<VToolRecord> localHistory = getLocalHistory(name);
|
||||||
|
|
||||||
|
@ -4317,7 +4333,7 @@ void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const Q
|
||||||
* @param reservedName reversed point name. Use when need reserve name, but point is not in data base yet.
|
* @param reservedName reversed point name. Use when need reserve name, but point is not in data base yet.
|
||||||
* @return unique name for current pattern piece.
|
* @return unique name for current pattern piece.
|
||||||
*/
|
*/
|
||||||
QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedName) const
|
auto VPattern::GenerateLabel(const LabelType &type, const QString &reservedName) const -> QString
|
||||||
{
|
{
|
||||||
if (type == LabelType::NewPatternPiece)
|
if (type == LabelType::NewPatternPiece)
|
||||||
{
|
{
|
||||||
|
@ -4363,7 +4379,7 @@ QString VPattern::GenerateLabel(const LabelType &type, const QString &reservedNa
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPattern::GenerateSuffix() const
|
auto VPattern::GenerateSuffix() const -> QString
|
||||||
{
|
{
|
||||||
const QString suffixBase = GetLabelBase(static_cast<quint32>(GetIndexActivPP())).toLower();
|
const QString suffixBase = GetLabelBase(static_cast<quint32>(GetIndexActivPP())).toLower();
|
||||||
const QStringList uniqueNames = data->AllUniqueNames();
|
const QStringList uniqueNames = data->AllUniqueNames();
|
||||||
|
@ -4397,7 +4413,7 @@ QString VPattern::GenerateSuffix() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPattern::IsReadOnly() const
|
auto VPattern::IsReadOnly() const -> bool
|
||||||
{
|
{
|
||||||
const QDomElement pattern = documentElement();
|
const QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
@ -4422,7 +4438,7 @@ void VPattern::SetReadOnly(bool rOnly)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPattern::GetLabelPrefix() const
|
auto VPattern::GetLabelPrefix() const -> QString
|
||||||
{
|
{
|
||||||
const QDomElement pattern = documentElement();
|
const QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
@ -4511,7 +4527,7 @@ void VPattern::DrawToolsCommonAttributes(const QDomElement &domElement, quint32
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
|
||||||
QRectF VPattern::ActiveDrawBoundingRect() const
|
auto VPattern::ActiveDrawBoundingRect() const -> QRectF
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Not all tools were used.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Not all tools were used.");
|
||||||
|
@ -4611,8 +4627,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template <typename T>
|
template <typename T> auto VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const -> QRectF
|
||||||
QRectF VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const
|
|
||||||
{
|
{
|
||||||
QRectF recTool = rec;
|
QRectF recTool = rec;
|
||||||
if (tools.contains(id))
|
if (tools.contains(id))
|
||||||
|
|
|
@ -49,29 +49,30 @@ class VPattern : public VAbstractPattern
|
||||||
public:
|
public:
|
||||||
VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
||||||
QObject *parent = nullptr);
|
QObject *parent = nullptr);
|
||||||
|
~VPattern() override = default;
|
||||||
|
|
||||||
virtual void CreateEmptyFile() override;
|
void CreateEmptyFile() override;
|
||||||
|
|
||||||
void Parse(const Document &parse);
|
void Parse(const Document &parse);
|
||||||
|
|
||||||
void GarbageCollector(bool commit = false);
|
void GarbageCollector(bool commit = false);
|
||||||
|
|
||||||
void setCurrentData();
|
void setCurrentData();
|
||||||
virtual void UpdateToolData(const quint32 &id, VContainer *data) override;
|
void UpdateToolData(const quint32 &id, VContainer *data) override;
|
||||||
|
|
||||||
virtual VContainer GetCompleteData() const override;
|
auto GetCompleteData() const -> VContainer override;
|
||||||
virtual VContainer GetCompletePPData(const QString &name) const override;
|
auto GetCompletePPData(const QString &name) const -> VContainer override;
|
||||||
|
|
||||||
virtual void IncrementReferens(quint32 id) const override;
|
void IncrementReferens(quint32 id) const override;
|
||||||
virtual void DecrementReferens(quint32 id) const override;
|
void DecrementReferens(quint32 id) const override;
|
||||||
|
|
||||||
quint32 SPointActiveDraw();
|
auto SPointActiveDraw() -> quint32;
|
||||||
|
|
||||||
QVector<quint32> GetActivePPPieces() const;
|
auto GetActivePPPieces() const -> QVector<quint32>;
|
||||||
|
|
||||||
virtual bool SaveDocument(const QString &fileName, QString &error) override;
|
auto SaveDocument(const QString &fileName, QString &error) -> bool override;
|
||||||
|
|
||||||
QRectF ActiveDrawBoundingRect() const;
|
auto ActiveDrawBoundingRect() const -> QRectF;
|
||||||
|
|
||||||
void AddEmptyIncrement(const QString &name, IncrementType type = IncrementType::Increment);
|
void AddEmptyIncrement(const QString &name, IncrementType type = IncrementType::Increment);
|
||||||
void AddEmptyPreviewCalculation(const QString &name, IncrementType type = IncrementType::Increment);
|
void AddEmptyPreviewCalculation(const QString &name, IncrementType type = IncrementType::Increment);
|
||||||
|
@ -97,33 +98,33 @@ public:
|
||||||
|
|
||||||
void ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName);
|
void ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName);
|
||||||
|
|
||||||
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const override;
|
auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString override;
|
||||||
virtual QString GenerateSuffix() const override;
|
auto GenerateSuffix() const -> QString override;
|
||||||
virtual void Clear() override;
|
void Clear() override;
|
||||||
|
|
||||||
bool IsReadOnly() const;
|
auto IsReadOnly() const -> bool;
|
||||||
void SetReadOnly(bool rOnly);
|
void SetReadOnly(bool rOnly);
|
||||||
|
|
||||||
QString GetLabelPrefix() const;
|
auto GetLabelPrefix() const -> QString;
|
||||||
void SetLabelPrefix(const QString &prefix);
|
void SetLabelPrefix(const QString &prefix);
|
||||||
|
|
||||||
void LiteParseIncrements();
|
void LiteParseIncrements();
|
||||||
|
|
||||||
static const QString AttrReadOnly;
|
static const QString AttrReadOnly;
|
||||||
static const QString AttrLabelPrefix;
|
static const QString AttrLabelPrefix;
|
||||||
|
|
||||||
int ElementsToParse() const;
|
auto ElementsToParse() const -> int;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PreParseState();
|
void PreParseState();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void LiteParseTree(const Document &parse) override;
|
void LiteParseTree(const Document &parse) override;
|
||||||
|
|
||||||
void RefreshPieceGeometry();
|
void RefreshPieceGeometry();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void customEvent(QEvent * event) override;
|
void customEvent(QEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
|
@ -141,50 +142,46 @@ private:
|
||||||
* finish */
|
* finish */
|
||||||
bool m_parsing{false};
|
bool m_parsing{false};
|
||||||
|
|
||||||
VNodeDetail ParseDetailNode(const QDomElement &domElement) const;
|
static auto ParseDetailNode(const QDomElement &domElement) -> VNodeDetail;
|
||||||
|
|
||||||
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
void ParseRootElement(const Document &parse, const QDomNode &node);
|
||||||
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
||||||
void ParseDetailElement(QDomElement &domElement, const Document &parse);
|
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
||||||
void ParseDetailInternals(const QDomElement &domElement, VPiece &detail) const;
|
void ParseDrawModeElement(QDomElement &domElement, const Document &parse, const Draw &mode);
|
||||||
QVector<VPieceNode> ParseDetailNodes(const QDomElement &domElement, qreal width, bool closed) const;
|
void ParseDetailElement(QDomElement &domElement, const Document &parse);
|
||||||
VPieceLabelData ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData ppData) const;
|
void ParseDetailInternals(const QDomElement &domElement, VPiece &detail) const;
|
||||||
VPatternLabelData ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabelData patternInfo) const;
|
auto ParseDetailNodes(const QDomElement &domElement, qreal width, bool closed) const -> QVector<VPieceNode>;
|
||||||
VGrainlineData ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const;
|
auto ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData ppData) const -> VPieceLabelData;
|
||||||
void ParseDetails(const QDomElement &domElement, const Document &parse);
|
auto ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabelData patternInfo) const -> VPatternLabelData;
|
||||||
|
auto ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const -> VGrainlineData;
|
||||||
|
void ParseDetails(const QDomElement &domElement, const Document &parse);
|
||||||
|
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
|
const QString &type);
|
||||||
|
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||||
|
void ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
|
const QString &type);
|
||||||
|
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
|
const QString &type);
|
||||||
|
void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
|
const QString &type);
|
||||||
|
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse,
|
||||||
|
const QString &type);
|
||||||
|
void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
||||||
|
const QString &type);
|
||||||
|
void ParsePathElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
|
void ParseIncrementsElement(const QDomNode &node, const Document &parse);
|
||||||
|
|
||||||
void ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void PrepareForParse(const Document &parse);
|
||||||
const Document &parse, const QString &type);
|
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
|
||||||
void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
void DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString ¬es);
|
||||||
const Document &parse);
|
void PointsWithLineCommonAttributes(const QDomElement &domElement, VToolLinePointInitData &initData);
|
||||||
void ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData);
|
||||||
const Document &parse, const QString& type);
|
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
|
||||||
void ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement,
|
void DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my, QString ¬es);
|
||||||
const Document &parse, const QString& type);
|
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool);
|
||||||
void ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
template <typename T> auto ToolBoundingRect(const QRectF &rec, quint32 id) const -> QRectF;
|
||||||
const QString &type);
|
void ParseCurrentPP();
|
||||||
void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement,
|
auto GetLabelBase(quint32 index) const -> QString;
|
||||||
const Document &parse, const QString& type);
|
|
||||||
void ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
|
|
||||||
const QString& type);
|
|
||||||
|
|
||||||
void ParsePathElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
|
||||||
|
|
||||||
void ParseIncrementsElement(const QDomNode& node, const Document &parse);
|
|
||||||
void PrepareForParse(const Document &parse);
|
|
||||||
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
|
|
||||||
void DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString ¬es);
|
|
||||||
void PointsWithLineCommonAttributes(const QDomElement &domElement, VToolLinePointInitData &initData);
|
|
||||||
void PointsCommonAttributes(const QDomElement &domElement, VToolSinglePointInitData &initData);
|
|
||||||
void PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my);
|
|
||||||
void DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my,
|
|
||||||
QString ¬es);
|
|
||||||
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
|
|
||||||
quint32 &idTool);
|
|
||||||
template <typename T>
|
|
||||||
QRectF ToolBoundingRect(const QRectF &rec, quint32 id) const;
|
|
||||||
void ParseCurrentPP();
|
|
||||||
QString GetLabelBase(quint32 index)const;
|
|
||||||
|
|
||||||
void ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
void ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||||
void ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
|
@ -245,10 +242,10 @@ private:
|
||||||
void ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
void ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
void ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||||
|
|
||||||
qreal EvalFormula(VContainer *data, const QString &formula, bool *ok) const;
|
auto EvalFormula(VContainer *data, const QString &formula, bool *ok) const -> qreal;
|
||||||
|
|
||||||
QDomElement MakeEmptyIncrement(const QString &name, IncrementType type);
|
auto MakeEmptyIncrement(const QString &name, IncrementType type) -> QDomElement;
|
||||||
QDomElement FindIncrement(const QString &name) const;
|
auto FindIncrement(const QString &name) const -> QDomElement;
|
||||||
|
|
||||||
void NewEmptyIncrement(const QString &type, const QString &name, IncrementType varType);
|
void NewEmptyIncrement(const QString &type, const QString &name, IncrementType varType);
|
||||||
void NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name, IncrementType varType);
|
void NewEmptyIncrementAfter(const QString &type, const QString &after, const QString &name, IncrementType varType);
|
||||||
|
@ -258,9 +255,9 @@ private:
|
||||||
|
|
||||||
void SetIncrementAttribute(const QString &name, const QString &attr, const QString &text);
|
void SetIncrementAttribute(const QString &name, const QString &attr, const QString &text);
|
||||||
|
|
||||||
QString LastDrawName() const;
|
auto LastDrawName() const -> QString;
|
||||||
quint32 LastToolId() const;
|
auto LastToolId() const -> quint32;
|
||||||
quint32 PPLastToolId(const QString &name) const;
|
auto PPLastToolId(const QString &name) const -> quint32;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPATTERN_H
|
#endif // VPATTERN_H
|
||||||
|
|
|
@ -32,7 +32,7 @@ FvAvailableUpdate::FvAvailableUpdate(QObject *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QUrl FvAvailableUpdate::GetEnclosureUrl() const
|
auto FvAvailableUpdate::GetEnclosureUrl() const -> QUrl
|
||||||
{
|
{
|
||||||
return m_enclosureUrl;
|
return m_enclosureUrl;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ void FvAvailableUpdate::SetEnclosureUrl(const QString &enclosureUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString FvAvailableUpdate::GetEnclosureVersion() const
|
auto FvAvailableUpdate::GetEnclosureVersion() const -> QString
|
||||||
{
|
{
|
||||||
return m_enclosureVersion;
|
return m_enclosureVersion;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ void FvAvailableUpdate::SetEnclosureVersion(const QString &enclosureVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString FvAvailableUpdate::GetEnclosurePlatform() const
|
auto FvAvailableUpdate::GetEnclosurePlatform() const -> QString
|
||||||
{
|
{
|
||||||
return m_enclosurePlatform;
|
return m_enclosurePlatform;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,14 +36,14 @@ class FvAvailableUpdate final : public QObject
|
||||||
public:
|
public:
|
||||||
explicit FvAvailableUpdate(QObject *parent = nullptr);
|
explicit FvAvailableUpdate(QObject *parent = nullptr);
|
||||||
|
|
||||||
QUrl GetEnclosureUrl() const;
|
auto GetEnclosureUrl() const -> QUrl;
|
||||||
void SetEnclosureUrl(const QUrl &enclosureUrl);
|
void SetEnclosureUrl(const QUrl &enclosureUrl);
|
||||||
void SetEnclosureUrl(const QString &enclosureUrl);
|
void SetEnclosureUrl(const QString &enclosureUrl);
|
||||||
|
|
||||||
QString GetEnclosureVersion() const;
|
auto GetEnclosureVersion() const -> QString;
|
||||||
void SetEnclosureVersion(const QString &enclosureVersion);
|
void SetEnclosureVersion(const QString &enclosureVersion);
|
||||||
|
|
||||||
QString GetEnclosurePlatform() const;
|
auto GetEnclosurePlatform() const -> QString;
|
||||||
void SetEnclosurePlatform(const QString &enclosurePlatform);
|
void SetEnclosurePlatform(const QString &enclosurePlatform);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -60,7 +60,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL, // NOLINT
|
||||||
QPointer<FvUpdater> FvUpdater::m_Instance;
|
QPointer<FvUpdater> FvUpdater::m_Instance;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
FvUpdater* FvUpdater::sharedUpdater()
|
auto FvUpdater::sharedUpdater() -> FvUpdater *
|
||||||
{
|
{
|
||||||
static QMutex mutex;
|
static QMutex mutex;
|
||||||
if (m_Instance.isNull())
|
if (m_Instance.isNull())
|
||||||
|
@ -83,13 +83,13 @@ void FvUpdater::drop()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString FvUpdater::CurrentFeedURL()
|
auto FvUpdater::CurrentFeedURL() -> QString
|
||||||
{
|
{
|
||||||
return FvUpdater::IsTestBuild() ? *testFeedURL : *defaultFeedURL;
|
return FvUpdater::IsTestBuild() ? *testFeedURL : *defaultFeedURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::IsTestBuild()
|
auto FvUpdater::IsTestBuild() -> bool
|
||||||
{
|
{
|
||||||
return (MAJOR_VERSION * 1000 + MINOR_VERSION) % 2 != 0;
|
return (MAJOR_VERSION * 1000 + MINOR_VERSION) % 2 != 0;
|
||||||
}
|
}
|
||||||
|
@ -154,13 +154,13 @@ void FvUpdater::SetFeedURL(const QString &feedURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString FvUpdater::GetFeedURL() const
|
auto FvUpdater::GetFeedURL() const -> QString
|
||||||
{
|
{
|
||||||
return m_feedURL.toString();
|
return m_feedURL.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::IsDropOnFinnish() const
|
auto FvUpdater::IsDropOnFinnish() const -> bool
|
||||||
{
|
{
|
||||||
return m_dropOnFinnish;
|
return m_dropOnFinnish;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ void FvUpdater::SetDropOnFinnish(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPointer<FvAvailableUpdate> FvUpdater::GetProposedUpdate()
|
auto FvUpdater::GetProposedUpdate() -> QPointer<FvAvailableUpdate>
|
||||||
{
|
{
|
||||||
return m_proposedUpdate;
|
return m_proposedUpdate;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ void FvUpdater::UpdateInstallationConfirmed()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet)
|
auto FvUpdater::CheckForUpdates(bool silentAsMuchAsItCouldGet) -> bool
|
||||||
{
|
{
|
||||||
if (m_feedURL.isEmpty())
|
if (m_feedURL.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -396,7 +396,7 @@ void FvUpdater::httpFeedDownloadFinished()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::xmlParseFeed()
|
auto FvUpdater::xmlParseFeed() -> bool
|
||||||
{
|
{
|
||||||
QString xmlEnclosureUrl, xmlEnclosureVersion, xmlEnclosurePlatform;
|
QString xmlEnclosureUrl, xmlEnclosureVersion, xmlEnclosurePlatform;
|
||||||
|
|
||||||
|
@ -478,9 +478,8 @@ bool FvUpdater::xmlParseFeed()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl,
|
auto FvUpdater::searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl, const QString &xmlEnclosureVersion,
|
||||||
const QString &xmlEnclosureVersion,
|
const QString &xmlEnclosurePlatform) -> bool
|
||||||
const QString &xmlEnclosurePlatform)
|
|
||||||
{
|
{
|
||||||
qDebug() << "Enclosure URL:" << xmlEnclosureUrl;
|
qDebug() << "Enclosure URL:" << xmlEnclosureUrl;
|
||||||
qDebug() << "Enclosure version:" << xmlEnclosureVersion;
|
qDebug() << "Enclosure version:" << xmlEnclosureVersion;
|
||||||
|
@ -521,7 +520,7 @@ bool FvUpdater::searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl,
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::VersionIsIgnored(const QString &version)
|
auto FvUpdater::VersionIsIgnored(const QString &version) -> bool
|
||||||
{
|
{
|
||||||
// We assume that variable 'version' contains either:
|
// We assume that variable 'version' contains either:
|
||||||
// 1) The current version of the application (ignore)
|
// 1) The current version of the application (ignore)
|
||||||
|
@ -589,7 +588,7 @@ void FvUpdater::IgnoreVersion(const QString &version)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdater::CurrentlyRunningOnPlatform(const QString &platform)
|
auto FvUpdater::CurrentlyRunningOnPlatform(const QString &platform) -> bool
|
||||||
{
|
{
|
||||||
const QStringList platforms = QStringList() << "Q_OS_LINUX"
|
const QStringList platforms = QStringList() << "Q_OS_LINUX"
|
||||||
<< "Q_OS_MAC"
|
<< "Q_OS_MAC"
|
||||||
|
|
|
@ -43,30 +43,30 @@ class FvUpdater final : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Singleton
|
// Singleton
|
||||||
static FvUpdater* sharedUpdater();
|
static auto sharedUpdater() -> FvUpdater *;
|
||||||
static void drop();
|
static void drop();
|
||||||
static QString CurrentFeedURL();
|
static auto CurrentFeedURL() -> QString;
|
||||||
static bool IsTestBuild();
|
static auto IsTestBuild() -> bool;
|
||||||
|
|
||||||
// Set / get feed URL
|
// Set / get feed URL
|
||||||
void SetFeedURL(const QUrl &feedURL);
|
void SetFeedURL(const QUrl &feedURL);
|
||||||
void SetFeedURL(const QString &feedURL);
|
void SetFeedURL(const QString &feedURL);
|
||||||
QString GetFeedURL() const;
|
auto GetFeedURL() const -> QString;
|
||||||
|
|
||||||
bool IsDropOnFinnish() const;
|
auto IsDropOnFinnish() const -> bool;
|
||||||
void SetDropOnFinnish(bool value);
|
void SetDropOnFinnish(bool value);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Check for updates
|
// Check for updates
|
||||||
bool CheckForUpdates(bool silentAsMuchAsItCouldGet = true);
|
auto CheckForUpdates(bool silentAsMuchAsItCouldGet = true) -> bool;
|
||||||
|
|
||||||
// Aliases
|
// Aliases
|
||||||
bool CheckForUpdatesSilent();
|
auto CheckForUpdatesSilent() -> bool;
|
||||||
bool CheckForUpdatesNotSilent();
|
auto CheckForUpdatesNotSilent() -> bool;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class FvUpdateWindow; // Uses GetProposedUpdate() and others
|
friend class FvUpdateWindow; // Uses GetProposedUpdate() and others
|
||||||
QPointer<FvAvailableUpdate> GetProposedUpdate();
|
auto GetProposedUpdate() -> QPointer<FvAvailableUpdate>;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// Update window button slots
|
// Update window button slots
|
||||||
|
@ -123,15 +123,13 @@ private:
|
||||||
// Show an informational message
|
// Show an informational message
|
||||||
void showInformationDialog(const QString &message, bool showEvenInSilentMode = false);
|
void showInformationDialog(const QString &message, bool showEvenInSilentMode = false);
|
||||||
|
|
||||||
|
auto xmlParseFeed() -> bool; // Parse feed in m_xml
|
||||||
|
auto searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl, const QString &xmlEnclosureVersion,
|
||||||
|
const QString &xmlEnclosurePlatform) -> bool;
|
||||||
|
|
||||||
bool xmlParseFeed(); // Parse feed in m_xml
|
static auto VersionIsIgnored(const QString &version) -> bool;
|
||||||
bool searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl,
|
|
||||||
const QString &xmlEnclosureVersion,
|
|
||||||
const QString &xmlEnclosurePlatform);
|
|
||||||
|
|
||||||
static bool VersionIsIgnored(const QString &version);
|
|
||||||
static void IgnoreVersion(const QString &version);
|
static void IgnoreVersion(const QString &version);
|
||||||
static bool CurrentlyRunningOnPlatform(const QString &platform);
|
static auto CurrentlyRunningOnPlatform(const QString &platform) -> bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FVUPDATER_H
|
#endif // FVUPDATER_H
|
||||||
|
|
|
@ -59,7 +59,7 @@ FvUpdateWindow::~FvUpdateWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate()
|
auto FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate() -> bool
|
||||||
{
|
{
|
||||||
QPointer<FvAvailableUpdate> proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
|
QPointer<FvAvailableUpdate> proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
|
||||||
if (proposedUpdate.isNull())
|
if (proposedUpdate.isNull())
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
virtual ~FvUpdateWindow();
|
virtual ~FvUpdateWindow();
|
||||||
|
|
||||||
// Update the current update proposal from FvUpdater
|
// Update the current update proposal from FvUpdater
|
||||||
bool UpdateWindowWithCurrentProposedUpdate();
|
auto UpdateWindowWithCurrentProposedUpdate() -> bool;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
|
|
|
@ -62,7 +62,7 @@ VException::VException(const VException &e) V_NOEXCEPT_EXPR (true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VException &VException::operator=(const VException &e) V_NOEXCEPT_EXPR (true)
|
auto VException::operator=(const VException &e) V_NOEXCEPT_EXPR(true) -> VException &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ VException &VException::operator=(const VException &e) V_NOEXCEPT_EXPR (true)
|
||||||
* @brief ErrorMessage return main error message
|
* @brief ErrorMessage return main error message
|
||||||
* @return error message
|
* @return error message
|
||||||
*/
|
*/
|
||||||
QString VException::ErrorMessage() const
|
auto VException::ErrorMessage() const -> QString
|
||||||
{
|
{
|
||||||
return tr("Exception: %1").arg(error);
|
return tr("Exception: %1").arg(error);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ void VException::AddMoreInformation(const QString &info)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VException::MoreInfo(const QString &detInfo) const
|
auto VException::MoreInfo(const QString &detInfo) const -> QString
|
||||||
{
|
{
|
||||||
if (not moreInfo.isEmpty())
|
if (not moreInfo.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -114,7 +114,7 @@ QString VException::MoreInfo(const QString &detInfo) const
|
||||||
* @brief DetailedInformation return detailed information about error
|
* @brief DetailedInformation return detailed information about error
|
||||||
* @return detailed information
|
* @return detailed information
|
||||||
*/
|
*/
|
||||||
QString VException::DetailedInformation() const
|
auto VException::DetailedInformation() const -> QString
|
||||||
{
|
{
|
||||||
return moreInfo;
|
return moreInfo;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ QString VException::DetailedInformation() const
|
||||||
* @return new exception
|
* @return new exception
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
VException *VException::clone() const
|
auto VException::clone() const -> VException *
|
||||||
{
|
{
|
||||||
return new VException(*this);
|
return new VException(*this);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,8 @@ VExceptionToolWasDeleted::VExceptionToolWasDeleted(const VExceptionToolWasDelete
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionToolWasDeleted &VExceptionToolWasDeleted::operator=(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionToolWasDeleted::operator=(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR(true)
|
||||||
|
-> VExceptionToolWasDeleted &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -174,7 +175,7 @@ Q_NORETURN void VExceptionToolWasDeleted::raise() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionToolWasDeleted *VExceptionToolWasDeleted::clone() const
|
auto VExceptionToolWasDeleted::clone() const -> VExceptionToolWasDeleted *
|
||||||
{
|
{
|
||||||
return new VExceptionToolWasDeleted(*this);
|
return new VExceptionToolWasDeleted(*this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,19 +49,19 @@ class VException : public QException
|
||||||
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);
|
||||||
VException &operator=(const VException &e) V_NOEXCEPT_EXPR (true);
|
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;
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
Q_REQUIRED_RESULT virtual VException *clone() const override;
|
Q_REQUIRED_RESULT virtual auto clone() const -> VException * override;
|
||||||
|
|
||||||
virtual QString ErrorMessage() const;
|
virtual auto ErrorMessage() const -> QString;
|
||||||
virtual QString DetailedInformation() const;
|
virtual auto DetailedInformation() const -> QString;
|
||||||
QString WhatUtf8() const V_NOEXCEPT_EXPR (true);
|
auto WhatUtf8() const V_NOEXCEPT_EXPR(true) -> QString;
|
||||||
void AddMoreInformation(const QString &info);
|
void AddMoreInformation(const QString &info);
|
||||||
QString MoreInformation() const;
|
auto MoreInformation() const -> QString;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief error string with error */
|
/** @brief error string with error */
|
||||||
|
@ -70,7 +70,7 @@ protected:
|
||||||
/** @brief moreInfo more information about error */
|
/** @brief moreInfo more information about error */
|
||||||
QString moreInfo {};
|
QString moreInfo {};
|
||||||
|
|
||||||
QString MoreInfo(const QString &detInfo) const;
|
auto MoreInfo(const QString &detInfo) const -> QString;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -80,7 +80,7 @@ QT_WARNING_POP
|
||||||
* @brief What return string with error
|
* @brief What return string with error
|
||||||
* @return string with error
|
* @return string with error
|
||||||
*/
|
*/
|
||||||
inline QString VException::WhatUtf8() const V_NOEXCEPT_EXPR (true)
|
inline auto VException::WhatUtf8() const V_NOEXCEPT_EXPR(true) -> QString
|
||||||
{
|
{
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ inline QString VException::WhatUtf8() const V_NOEXCEPT_EXPR (true)
|
||||||
* @brief MoreInformation return more information for error
|
* @brief MoreInformation return more information for error
|
||||||
* @return information
|
* @return information
|
||||||
*/
|
*/
|
||||||
inline QString VException::MoreInformation() const
|
inline auto VException::MoreInformation() const -> QString
|
||||||
{
|
{
|
||||||
return moreInfo;
|
return moreInfo;
|
||||||
}
|
}
|
||||||
|
@ -102,12 +102,12 @@ class VExceptionToolWasDeleted : public VException
|
||||||
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);
|
||||||
VExceptionToolWasDeleted &operator=(const VExceptionToolWasDeleted &e) V_NOEXCEPT_EXPR (true);
|
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
|
||||||
virtual VExceptionToolWasDeleted *clone() const override;
|
virtual auto clone() const -> VExceptionToolWasDeleted * override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VEXCEPTION_H
|
#endif // VEXCEPTION_H
|
||||||
|
|
|
@ -57,7 +57,7 @@ VExceptionBadId::VExceptionBadId(const VExceptionBadId &e) V_NOEXCEPT_EXPR (true
|
||||||
:VException(e), id(e.BadId()), key(e.BadKey()){}
|
:VException(e), id(e.BadId()), key(e.BadKey()){}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionBadId &VExceptionBadId::operator=(const VExceptionBadId &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionBadId::operator=(const VExceptionBadId &e) V_NOEXCEPT_EXPR(true) -> VExceptionBadId &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ VExceptionBadId &VExceptionBadId::operator=(const VExceptionBadId &e) V_NOEXCEPT
|
||||||
* @brief ErrorMessage return main error message
|
* @brief ErrorMessage return main error message
|
||||||
* @return main error message
|
* @return main error message
|
||||||
*/
|
*/
|
||||||
QString VExceptionBadId::ErrorMessage() const
|
auto VExceptionBadId::ErrorMessage() const -> QString
|
||||||
{
|
{
|
||||||
QString error;
|
QString error;
|
||||||
if (key.isEmpty())
|
if (key.isEmpty())
|
||||||
|
|
|
@ -45,16 +45,17 @@ 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);
|
||||||
VExceptionBadId &operator=(const VExceptionBadId &e) V_NOEXCEPT_EXPR (true);
|
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; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionBadId *clone() const override { return new VExceptionBadId(*this); }
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionBadId * override { return new VExceptionBadId(*this); }
|
||||||
|
|
||||||
|
virtual auto ErrorMessage() const -> QString override;
|
||||||
|
auto BadId() const -> quint32;
|
||||||
|
auto BadKey() const -> QString;
|
||||||
|
|
||||||
virtual QString ErrorMessage() const override;
|
|
||||||
quint32 BadId() const;
|
|
||||||
QString BadKey() const;
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief id id */
|
/** @brief id id */
|
||||||
quint32 id;
|
quint32 id;
|
||||||
|
@ -68,7 +69,7 @@ protected:
|
||||||
* @brief BadId return bad id
|
* @brief BadId return bad id
|
||||||
* @return id
|
* @return id
|
||||||
*/
|
*/
|
||||||
inline quint32 VExceptionBadId::BadId() const
|
inline auto VExceptionBadId::BadId() const -> quint32
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ inline quint32 VExceptionBadId::BadId() const
|
||||||
* @brief BadKey return bad key
|
* @brief BadKey return bad key
|
||||||
* @return key
|
* @return key
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionBadId::BadKey() const
|
inline auto VExceptionBadId::BadKey() const -> QString
|
||||||
{
|
{
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,8 +54,8 @@ VExceptionConversionError::VExceptionConversionError(const VExceptionConversionE
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionConversionError &
|
auto VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR(true)
|
||||||
VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true)
|
-> VExceptionConversionError &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXC
|
||||||
* @brief ErrorMessage return main error message
|
* @brief ErrorMessage return main error message
|
||||||
* @return main error message
|
* @return main error message
|
||||||
*/
|
*/
|
||||||
QString VExceptionConversionError::ErrorMessage() const
|
auto VExceptionConversionError::ErrorMessage() const -> QString
|
||||||
{
|
{
|
||||||
return QString("ExceptionConversionError: %1 \"%2\"").arg(error, str);
|
return QString("ExceptionConversionError: %1 \"%2\"").arg(error, str);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,16 +43,17 @@ class VExceptionConversionError final : public VException
|
||||||
public:
|
public:
|
||||||
VExceptionConversionError(const QString &error, const QString &str) V_NOEXCEPT_EXPR (true);
|
VExceptionConversionError(const QString &error, const QString &str) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionConversionError(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true);
|
VExceptionConversionError(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionConversionError &operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR(true) -> VExceptionConversionError &;
|
||||||
virtual ~VExceptionConversionError() V_NOEXCEPT_EXPR (true) = default;
|
virtual ~VExceptionConversionError() V_NOEXCEPT_EXPR (true) = default;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionConversionError *clone() const override
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionConversionError * override
|
||||||
{ return new VExceptionConversionError(*this); }
|
{ return new VExceptionConversionError(*this); }
|
||||||
|
|
||||||
virtual QString ErrorMessage() const override;
|
virtual auto ErrorMessage() const -> QString override;
|
||||||
QString String() const;
|
auto String() const -> QString;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief str string, where happend error */
|
/** @brief str string, where happend error */
|
||||||
QString str;
|
QString str;
|
||||||
|
@ -63,7 +64,7 @@ protected:
|
||||||
* @brief String return string, where happend error
|
* @brief String return string, where happend error
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionConversionError::String() const
|
inline auto VExceptionConversionError::String() const -> QString
|
||||||
{
|
{
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,8 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParamete
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionEmptyParameter &VExceptionEmptyParameter::operator=(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionEmptyParameter::operator=(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR(true)
|
||||||
|
-> VExceptionEmptyParameter &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -81,7 +82,7 @@ VExceptionEmptyParameter &VExceptionEmptyParameter::operator=(const VExceptionEm
|
||||||
* @brief ErrorMessage return main error message
|
* @brief ErrorMessage return main error message
|
||||||
* @return main error message
|
* @return main error message
|
||||||
*/
|
*/
|
||||||
QString VExceptionEmptyParameter::ErrorMessage() const
|
auto VExceptionEmptyParameter::ErrorMessage() const -> QString
|
||||||
{
|
{
|
||||||
return QString("ExceptionEmptyParameter: %1 %2").arg(error, name);
|
return QString("ExceptionEmptyParameter: %1 %2").arg(error, name);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +92,7 @@ QString VExceptionEmptyParameter::ErrorMessage() const
|
||||||
* @brief DetailedInformation return detailed information about error
|
* @brief DetailedInformation return detailed information about error
|
||||||
* @return detailed information
|
* @return detailed information
|
||||||
*/
|
*/
|
||||||
QString VExceptionEmptyParameter::DetailedInformation() const
|
auto VExceptionEmptyParameter::DetailedInformation() const -> QString
|
||||||
{
|
{
|
||||||
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));
|
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,20 +47,21 @@ public:
|
||||||
VExceptionEmptyParameter(const QString &what, const QString &name,
|
VExceptionEmptyParameter(const QString &what, const QString &name,
|
||||||
const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
|
const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionEmptyParameter(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR (true);
|
VExceptionEmptyParameter(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionEmptyParameter &operator=(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionEmptyParameter &e) V_NOEXCEPT_EXPR(true) -> VExceptionEmptyParameter &;
|
||||||
virtual ~VExceptionEmptyParameter() V_NOEXCEPT_EXPR (true) = default;
|
virtual ~VExceptionEmptyParameter() V_NOEXCEPT_EXPR (true) = default;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionEmptyParameter *clone() const override
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionEmptyParameter * override
|
||||||
{ return new VExceptionEmptyParameter(*this); }
|
{ return new VExceptionEmptyParameter(*this); }
|
||||||
|
|
||||||
virtual QString ErrorMessage() const override;
|
virtual auto ErrorMessage() const -> QString override;
|
||||||
virtual QString DetailedInformation() const override;
|
virtual auto DetailedInformation() const -> QString override;
|
||||||
QString Name() const;
|
auto Name() const -> QString;
|
||||||
QString TagText() const;
|
auto TagText() const -> QString;
|
||||||
QString TagName() const;
|
auto TagName() const -> QString;
|
||||||
qint32 LineNumber() const;
|
auto LineNumber() const -> qint32;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief name name attribute */
|
/** @brief name name attribute */
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -80,7 +81,7 @@ protected:
|
||||||
* @brief Name return name of attribute where error
|
* @brief Name return name of attribute where error
|
||||||
* @return name
|
* @return name
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionEmptyParameter::Name() const
|
inline auto VExceptionEmptyParameter::Name() const -> QString
|
||||||
{
|
{
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +91,7 @@ inline QString VExceptionEmptyParameter::Name() const
|
||||||
* @brief TagText return tag text
|
* @brief TagText return tag text
|
||||||
* @return tag text
|
* @return tag text
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionEmptyParameter::TagText() const
|
inline auto VExceptionEmptyParameter::TagText() const -> QString
|
||||||
{
|
{
|
||||||
return tagText;
|
return tagText;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +101,7 @@ inline QString VExceptionEmptyParameter::TagText() const
|
||||||
* @brief TagName return tag name
|
* @brief TagName return tag name
|
||||||
* @return tag name
|
* @return tag name
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionEmptyParameter::TagName() const
|
inline auto VExceptionEmptyParameter::TagName() const -> QString
|
||||||
{
|
{
|
||||||
return tagName;
|
return tagName;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +111,7 @@ inline QString VExceptionEmptyParameter::TagName() const
|
||||||
* @brief LineNumber return line number of tag
|
* @brief LineNumber return line number of tag
|
||||||
* @return line number
|
* @return line number
|
||||||
*/
|
*/
|
||||||
inline qint32 VExceptionEmptyParameter::LineNumber() const
|
inline auto VExceptionEmptyParameter::LineNumber() const -> qint32
|
||||||
{
|
{
|
||||||
return lineNumber;
|
return lineNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,8 @@ VExceptionInvalidHistory::VExceptionInvalidHistory(const VExceptionInvalidHistor
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionInvalidHistory &VExceptionInvalidHistory::operator=(const VExceptionInvalidHistory &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionInvalidHistory::operator=(const VExceptionInvalidHistory &e) V_NOEXCEPT_EXPR(true)
|
||||||
|
-> VExceptionInvalidHistory &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,12 +35,12 @@ class VExceptionInvalidHistory : public VException
|
||||||
public:
|
public:
|
||||||
explicit VExceptionInvalidHistory(const QString &error) V_NOEXCEPT_EXPR (true);
|
explicit VExceptionInvalidHistory(const QString &error) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionInvalidHistory(const VExceptionInvalidHistory &e) V_NOEXCEPT_EXPR (true);
|
VExceptionInvalidHistory(const VExceptionInvalidHistory &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionInvalidHistory &operator=(const VExceptionInvalidHistory &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionInvalidHistory &e) V_NOEXCEPT_EXPR(true) -> VExceptionInvalidHistory &;
|
||||||
virtual ~VExceptionInvalidHistory() V_NOEXCEPT_EXPR (true) = default;
|
virtual ~VExceptionInvalidHistory() V_NOEXCEPT_EXPR (true) = default;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionInvalidHistory *clone() const override
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionInvalidHistory * override
|
||||||
{ return new VExceptionInvalidHistory(*this); }
|
{ return new VExceptionInvalidHistory(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ VExceptionInvalidNotch::VExceptionInvalidNotch(const VExceptionInvalidNotch &e)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionInvalidNotch &VExceptionInvalidNotch::operator=(const VExceptionInvalidNotch &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionInvalidNotch::operator=(const VExceptionInvalidNotch &e) V_NOEXCEPT_EXPR(true)
|
||||||
|
-> VExceptionInvalidNotch &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,12 +35,12 @@ class VExceptionInvalidNotch : public VException
|
||||||
public:
|
public:
|
||||||
explicit VExceptionInvalidNotch(const QString &error) V_NOEXCEPT_EXPR (true);
|
explicit VExceptionInvalidNotch(const QString &error) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionInvalidNotch(const VExceptionInvalidNotch &e) V_NOEXCEPT_EXPR (true);
|
VExceptionInvalidNotch(const VExceptionInvalidNotch &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionInvalidNotch &operator=(const VExceptionInvalidNotch &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionInvalidNotch &e) V_NOEXCEPT_EXPR(true) -> VExceptionInvalidNotch &;
|
||||||
virtual ~VExceptionInvalidNotch() V_NOEXCEPT_EXPR (true) = default;
|
virtual ~VExceptionInvalidNotch() V_NOEXCEPT_EXPR (true) = default;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionInvalidNotch *clone() const override
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionInvalidNotch * override
|
||||||
{ return new VExceptionInvalidNotch(*this); }
|
{ return new VExceptionInvalidNotch(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e) V_N
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionObjectError &VExceptionObjectError::operator=(const VExceptionObjectError &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionObjectError::operator=(const VExceptionObjectError &e) V_NOEXCEPT_EXPR(true) -> VExceptionObjectError &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ VExceptionObjectError &VExceptionObjectError::operator=(const VExceptionObjectEr
|
||||||
* @brief ErrorMessage return main error message
|
* @brief ErrorMessage return main error message
|
||||||
* @return main error message
|
* @return main error message
|
||||||
*/
|
*/
|
||||||
QString VExceptionObjectError::ErrorMessage() const
|
auto VExceptionObjectError::ErrorMessage() const -> QString
|
||||||
{
|
{
|
||||||
return QString("ExceptionObjectError: %1").arg(error);
|
return QString("ExceptionObjectError: %1").arg(error);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ QString VExceptionObjectError::ErrorMessage() const
|
||||||
* @brief DetailedInformation return detailed information about error
|
* @brief DetailedInformation return detailed information about error
|
||||||
* @return detailed information
|
* @return detailed information
|
||||||
*/
|
*/
|
||||||
QString VExceptionObjectError::DetailedInformation() const
|
auto VExceptionObjectError::DetailedInformation() const -> QString
|
||||||
{
|
{
|
||||||
return MoreInfo(QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText));
|
return MoreInfo(QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText));
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,18 +47,22 @@ public:
|
||||||
VExceptionObjectError(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
|
VExceptionObjectError(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
|
||||||
explicit VExceptionObjectError(const QString &what) V_NOEXCEPT_EXPR (true);
|
explicit VExceptionObjectError(const QString &what) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionObjectError(const VExceptionObjectError &e) V_NOEXCEPT_EXPR (true);
|
VExceptionObjectError(const VExceptionObjectError &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionObjectError &operator=(const VExceptionObjectError &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionObjectError &e) V_NOEXCEPT_EXPR(true) -> VExceptionObjectError &;
|
||||||
virtual ~VExceptionObjectError() V_NOEXCEPT_EXPR (true) = default;
|
virtual ~VExceptionObjectError() V_NOEXCEPT_EXPR (true) = default;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionObjectError *clone() const override { return new VExceptionObjectError(*this); }
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionObjectError * override
|
||||||
|
{
|
||||||
|
return new VExceptionObjectError(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual auto ErrorMessage() const -> QString override;
|
||||||
|
virtual auto DetailedInformation() const -> QString override;
|
||||||
|
auto TagText() const -> QString;
|
||||||
|
auto TagName() const -> QString;
|
||||||
|
auto LineNumber() const -> qint32;
|
||||||
|
|
||||||
virtual QString ErrorMessage() const override;
|
|
||||||
virtual QString DetailedInformation() const override;
|
|
||||||
QString TagText() const;
|
|
||||||
QString TagName() const;
|
|
||||||
qint32 LineNumber() const;
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief tagText tag text */
|
/** @brief tagText tag text */
|
||||||
QString tagText;
|
QString tagText;
|
||||||
|
@ -75,7 +79,7 @@ protected:
|
||||||
* @brief TagText return tag text
|
* @brief TagText return tag text
|
||||||
* @return tag text
|
* @return tag text
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionObjectError::TagText() const
|
inline auto VExceptionObjectError::TagText() const -> QString
|
||||||
{
|
{
|
||||||
return tagText;
|
return tagText;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +89,7 @@ inline QString VExceptionObjectError::TagText() const
|
||||||
* @brief TagName return tag name
|
* @brief TagName return tag name
|
||||||
* @return tag name
|
* @return tag name
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionObjectError::TagName() const
|
inline auto VExceptionObjectError::TagName() const -> QString
|
||||||
{
|
{
|
||||||
return tagName;
|
return tagName;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +99,7 @@ inline QString VExceptionObjectError::TagName() const
|
||||||
* @brief LineNumber return line number in file
|
* @brief LineNumber return line number in file
|
||||||
* @return line number
|
* @return line number
|
||||||
*/
|
*/
|
||||||
inline qint32 VExceptionObjectError::LineNumber() const
|
inline auto VExceptionObjectError::LineNumber() const -> qint32
|
||||||
{
|
{
|
||||||
return lineNumber;
|
return lineNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ V_NOEXCEPT_EXPR (true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionTerminatedPosition &VExceptionTerminatedPosition::operator=(const VExceptionTerminatedPosition &e)
|
auto VExceptionTerminatedPosition::operator=(const VExceptionTerminatedPosition &e) V_NOEXCEPT_EXPR(true)
|
||||||
V_NOEXCEPT_EXPR (true)
|
-> VExceptionTerminatedPosition &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ void VExceptionTerminatedPosition::raise() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionTerminatedPosition *VExceptionTerminatedPosition::clone() const
|
auto VExceptionTerminatedPosition::clone() const -> VExceptionTerminatedPosition *
|
||||||
{
|
{
|
||||||
return new VExceptionTerminatedPosition(*this);
|
return new VExceptionTerminatedPosition(*this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,13 +35,13 @@ class VExceptionTerminatedPosition : public VException
|
||||||
public:
|
public:
|
||||||
explicit VExceptionTerminatedPosition(const QString &error) V_NOEXCEPT_EXPR (true);
|
explicit VExceptionTerminatedPosition(const QString &error) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionTerminatedPosition(const VExceptionTerminatedPosition &e) V_NOEXCEPT_EXPR (true);
|
VExceptionTerminatedPosition(const VExceptionTerminatedPosition &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionTerminatedPosition &operator=(const VExceptionTerminatedPosition &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionTerminatedPosition &e) V_NOEXCEPT_EXPR(true) -> VExceptionTerminatedPosition &;
|
||||||
virtual ~VExceptionTerminatedPosition() V_NOEXCEPT_EXPR (true);
|
virtual ~VExceptionTerminatedPosition() V_NOEXCEPT_EXPR (true);
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override;
|
Q_NORETURN virtual void raise() const override;
|
||||||
|
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
Q_REQUIRED_RESULT virtual VExceptionTerminatedPosition *clone() const override;
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionTerminatedPosition * override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VEXCEPTIONTERMINATEDPOSITION_H
|
#endif // VEXCEPTIONTERMINATEDPOSITION_H
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionUndo *clone() const override { return new VExceptionUndo(*this); }
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionUndo * override { return new VExceptionUndo(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VEXCEPTIONUNDO_H
|
#endif // VEXCEPTIONUNDO_H
|
||||||
|
|
|
@ -59,7 +59,7 @@ VExceptionWrongId::VExceptionWrongId(const VExceptionWrongId &e) V_NOEXCEPT_EXPR
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VExceptionWrongId &VExceptionWrongId::operator=(const VExceptionWrongId &e) V_NOEXCEPT_EXPR (true)
|
auto VExceptionWrongId::operator=(const VExceptionWrongId &e) V_NOEXCEPT_EXPR(true) -> VExceptionWrongId &
|
||||||
{
|
{
|
||||||
if ( &e == this )
|
if ( &e == this )
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ VExceptionWrongId &VExceptionWrongId::operator=(const VExceptionWrongId &e) V_NO
|
||||||
* @brief ErrorMessage return main error message
|
* @brief ErrorMessage return main error message
|
||||||
* @return main error message
|
* @return main error message
|
||||||
*/
|
*/
|
||||||
QString VExceptionWrongId::ErrorMessage() const
|
auto VExceptionWrongId::ErrorMessage() const -> QString
|
||||||
{
|
{
|
||||||
return QString("ExceptionWrongId: %1").arg(error);
|
return QString("ExceptionWrongId: %1").arg(error);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ QString VExceptionWrongId::ErrorMessage() const
|
||||||
* @brief DetailedInformation return detailed information about error
|
* @brief DetailedInformation return detailed information about error
|
||||||
* @return detailed information
|
* @return detailed information
|
||||||
*/
|
*/
|
||||||
QString VExceptionWrongId::DetailedInformation() const
|
auto VExceptionWrongId::DetailedInformation() const -> QString
|
||||||
{
|
{
|
||||||
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));
|
return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText));
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,18 +46,22 @@ class VExceptionWrongId : public VException
|
||||||
public:
|
public:
|
||||||
VExceptionWrongId(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
|
VExceptionWrongId(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionWrongId(const VExceptionWrongId &e) V_NOEXCEPT_EXPR (true);
|
VExceptionWrongId(const VExceptionWrongId &e) V_NOEXCEPT_EXPR (true);
|
||||||
VExceptionWrongId &operator=(const VExceptionWrongId &e) V_NOEXCEPT_EXPR (true);
|
auto operator=(const VExceptionWrongId &e) V_NOEXCEPT_EXPR(true) -> VExceptionWrongId &;
|
||||||
virtual ~VExceptionWrongId() V_NOEXCEPT_EXPR (true) = default;
|
virtual ~VExceptionWrongId() V_NOEXCEPT_EXPR (true) = default;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override { throw *this; }
|
Q_NORETURN virtual void raise() const override { throw *this; }
|
||||||
|
|
||||||
Q_REQUIRED_RESULT virtual VExceptionWrongId *clone() const override { return new VExceptionWrongId(*this); }
|
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionWrongId * override
|
||||||
|
{
|
||||||
|
return new VExceptionWrongId(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual auto ErrorMessage() const -> QString override;
|
||||||
|
virtual auto DetailedInformation() const -> QString override;
|
||||||
|
auto TagText() const -> QString;
|
||||||
|
auto TagName() const -> QString;
|
||||||
|
auto LineNumber() const -> qint32;
|
||||||
|
|
||||||
virtual QString ErrorMessage() const override;
|
|
||||||
virtual QString DetailedInformation() const override;
|
|
||||||
QString TagText() const;
|
|
||||||
QString TagName() const;
|
|
||||||
qint32 LineNumber() const;
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief tagText tag text */
|
/** @brief tagText tag text */
|
||||||
QString tagText;
|
QString tagText;
|
||||||
|
@ -74,7 +78,7 @@ protected:
|
||||||
* @brief TagText return tag text
|
* @brief TagText return tag text
|
||||||
* @return tag text
|
* @return tag text
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionWrongId::TagText() const
|
inline auto VExceptionWrongId::TagText() const -> QString
|
||||||
{
|
{
|
||||||
return tagText;
|
return tagText;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +88,7 @@ inline QString VExceptionWrongId::TagText() const
|
||||||
* @brief TagName return tag name
|
* @brief TagName return tag name
|
||||||
* @return tag name
|
* @return tag name
|
||||||
*/
|
*/
|
||||||
inline QString VExceptionWrongId::TagName() const
|
inline auto VExceptionWrongId::TagName() const -> QString
|
||||||
{
|
{
|
||||||
return tagName;
|
return tagName;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +98,7 @@ inline QString VExceptionWrongId::TagName() const
|
||||||
* @brief LineNumber return line number in file
|
* @brief LineNumber return line number in file
|
||||||
* @return line number
|
* @return line number
|
||||||
*/
|
*/
|
||||||
inline qint32 VExceptionWrongId::LineNumber() const
|
inline auto VExceptionWrongId::LineNumber() const -> qint32
|
||||||
{
|
{
|
||||||
return lineNumber;
|
return lineNumber;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,7 @@ const QString TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
|
||||||
* @brief Styles return list of all line styles.
|
* @brief Styles return list of all line styles.
|
||||||
* @return list of all line styles.
|
* @return list of all line styles.
|
||||||
*/
|
*/
|
||||||
QStringList StylesList()
|
auto StylesList() -> QStringList
|
||||||
{
|
{
|
||||||
return QStringList{
|
return QStringList{
|
||||||
TypeLineNone,
|
TypeLineNone,
|
||||||
|
@ -176,7 +176,7 @@ QStringList StylesList()
|
||||||
* @brief LineStyle return pen style for current line style.
|
* @brief LineStyle return pen style for current line style.
|
||||||
* @return pen style.
|
* @return pen style.
|
||||||
*/
|
*/
|
||||||
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine)
|
auto LineStyleToPenStyle(const QString &typeLine) -> Qt::PenStyle
|
||||||
{
|
{
|
||||||
const QStringList styles = StylesList();
|
const QStringList styles = StylesList();
|
||||||
switch (styles.indexOf(typeLine))
|
switch (styles.indexOf(typeLine))
|
||||||
|
@ -197,7 +197,7 @@ Qt::PenStyle LineStyleToPenStyle(const QString &typeLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString PenStyleToLineStyle(Qt::PenStyle penStyle)
|
auto PenStyleToLineStyle(Qt::PenStyle penStyle) -> QString
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
||||||
|
@ -225,7 +225,7 @@ QString PenStyleToLineStyle(Qt::PenStyle penStyle)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QIcon PenStylePic(Qt::PenStyle style)
|
auto PenStylePic(Qt::PenStyle style) -> QIcon
|
||||||
{
|
{
|
||||||
QPixmap pix(80, 14);
|
QPixmap pix(80, 14);
|
||||||
pix.fill(Qt::white);
|
pix.fill(Qt::white);
|
||||||
|
@ -241,12 +241,12 @@ QIcon PenStylePic(Qt::PenStyle style)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QIcon> LineStylesPics()
|
auto LineStylesPics() -> QMap<QString, QIcon>
|
||||||
{
|
{
|
||||||
QMap<QString, QIcon> map;
|
QMap<QString, QIcon> map;
|
||||||
const QStringList styles = StylesList();
|
const QStringList styles = StylesList();
|
||||||
|
|
||||||
for (auto &s : styles)
|
for (const auto &s : styles)
|
||||||
{
|
{
|
||||||
map.insert(s, PenStylePic(LineStyleToPenStyle(s)));
|
map.insert(s, PenStylePic(LineStyleToPenStyle(s)));
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ QMap<QString, QIcon> LineStylesPics()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QIcon> CurvePenStylesPics()
|
auto CurvePenStylesPics() -> QMap<QString, QIcon>
|
||||||
{
|
{
|
||||||
QMap<QString, QIcon> map = LineStylesPics();
|
QMap<QString, QIcon> map = LineStylesPics();
|
||||||
map.remove(TypeLineNone);
|
map.remove(TypeLineNone);
|
||||||
|
|
|
@ -176,12 +176,12 @@ extern const QString TypeLineDotLine;
|
||||||
extern const QString TypeLineDashDotLine;
|
extern const QString TypeLineDashDotLine;
|
||||||
extern const QString TypeLineDashDotDotLine;
|
extern const QString TypeLineDashDotDotLine;
|
||||||
|
|
||||||
QStringList StylesList();
|
auto StylesList() -> QStringList;
|
||||||
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
|
auto LineStyleToPenStyle(const QString &typeLine) -> Qt::PenStyle;
|
||||||
QString PenStyleToLineStyle(Qt::PenStyle penStyle);
|
auto PenStyleToLineStyle(Qt::PenStyle penStyle) -> QString;
|
||||||
QIcon PenStylePic(Qt::PenStyle style);
|
auto PenStylePic(Qt::PenStyle style) -> QIcon;
|
||||||
QMap<QString, QIcon> LineStylesPics();
|
auto LineStylesPics() -> QMap<QString, QIcon>;
|
||||||
QMap<QString, QIcon> CurvePenStylesPics();
|
auto CurvePenStylesPics() -> QMap<QString, QIcon>;
|
||||||
|
|
||||||
extern const QString ColorDefault;
|
extern const QString ColorDefault;
|
||||||
extern const QString ColorBlack;
|
extern const QString ColorBlack;
|
||||||
|
|
|
@ -44,9 +44,9 @@ auto IsMimeTypeImage(const QMimeType &mime) -> bool
|
||||||
QStringList aliases = mime.aliases();
|
QStringList aliases = mime.aliases();
|
||||||
aliases.prepend(mime.name());
|
aliases.prepend(mime.name());
|
||||||
|
|
||||||
QRegularExpression rx(QStringLiteral("^image\\/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$"));
|
static QRegularExpression rx(QStringLiteral("^image\\/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$"));
|
||||||
|
|
||||||
return std::any_of(aliases.begin(), aliases.end(), [rx](const QString &name) { return rx.match(name).hasMatch(); });
|
return std::any_of(aliases.begin(), aliases.end(), [](const QString &name) { return rx.match(name).hasMatch(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -64,7 +64,7 @@ VAbstractConverter::VAbstractConverter(const QString &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractConverter::Convert()
|
auto VAbstractConverter::Convert() -> QString
|
||||||
{
|
{
|
||||||
if (m_ver == MaxVer())
|
if (m_ver == MaxVer())
|
||||||
{
|
{
|
||||||
|
@ -369,7 +369,7 @@ void VAbstractConverter::SetVersion(const QString &version)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractConverter::XSDSchema(unsigned int ver) const
|
auto VAbstractConverter::XSDSchema(unsigned int ver) const -> QString
|
||||||
{
|
{
|
||||||
const QHash <unsigned, QString> schemas = Schemas();
|
const QHash <unsigned, QString> schemas = Schemas();
|
||||||
if (schemas.contains(ver))
|
if (schemas.contains(ver))
|
||||||
|
|
|
@ -48,9 +48,9 @@ public:
|
||||||
explicit VAbstractConverter(const QString &fileName);
|
explicit VAbstractConverter(const QString &fileName);
|
||||||
virtual ~VAbstractConverter() = default;
|
virtual ~VAbstractConverter() = default;
|
||||||
|
|
||||||
QString Convert();
|
auto Convert() -> QString;
|
||||||
|
|
||||||
unsigned GetCurrentFormatVersion() const;
|
auto GetCurrentFormatVersion() const -> unsigned;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned m_ver;
|
unsigned m_ver;
|
||||||
|
@ -62,17 +62,17 @@ protected:
|
||||||
virtual void Save();
|
virtual void Save();
|
||||||
virtual void SetVersion(const QString &version);
|
virtual void SetVersion(const QString &version);
|
||||||
|
|
||||||
virtual unsigned MinVer() const =0;
|
virtual auto MinVer() const -> unsigned = 0;
|
||||||
virtual unsigned MaxVer() const =0;
|
virtual auto MaxVer() const -> unsigned = 0;
|
||||||
|
|
||||||
virtual QString MinVerStr() const =0;
|
virtual auto MinVerStr() const -> QString = 0;
|
||||||
virtual QString MaxVerStr() const =0;
|
virtual auto MaxVerStr() const -> QString = 0;
|
||||||
|
|
||||||
virtual QString XSDSchema(unsigned ver) const;
|
virtual auto XSDSchema(unsigned ver) const -> QString;
|
||||||
virtual void ApplyPatches() =0;
|
virtual void ApplyPatches() =0;
|
||||||
virtual void DowngradeToCurrentMaxVersion() =0;
|
virtual void DowngradeToCurrentMaxVersion() =0;
|
||||||
|
|
||||||
virtual bool IsReadOnly() const =0;
|
virtual auto IsReadOnly() const -> bool = 0;
|
||||||
|
|
||||||
virtual auto Schemas() const -> QHash <unsigned, QString> =0;
|
virtual auto Schemas() const -> QHash <unsigned, QString> =0;
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ void VAbstractMConverter::AddRootComment()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMultiMap<QString, QString> VAbstractMConverter::OldNamesToNewNames_InV0_3_0()
|
auto VAbstractMConverter::OldNamesToNewNames_InV0_3_0() -> QMultiMap<QString, QString>
|
||||||
{
|
{
|
||||||
// new name, old name
|
// new name, old name
|
||||||
QMultiMap<QString, QString> names;
|
QMultiMap<QString, QString> names;
|
||||||
|
@ -250,7 +250,7 @@ QMultiMap<QString, QString> VAbstractMConverter::OldNamesToNewNames_InV0_3_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QString> VAbstractMConverter::OldNamesToNewNames_InV0_3_3()
|
auto VAbstractMConverter::OldNamesToNewNames_InV0_3_3() -> QMap<QString, QString>
|
||||||
{
|
{
|
||||||
// new name, old name
|
// new name, old name
|
||||||
QMap<QString, QString> names;
|
QMap<QString, QString> names;
|
||||||
|
|
|
@ -47,8 +47,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddRootComment();
|
void AddRootComment();
|
||||||
static QMultiMap<QString, QString> OldNamesToNewNames_InV0_3_0();
|
static auto OldNamesToNewNames_InV0_3_0() -> QMultiMap<QString, QString>;
|
||||||
static QMap<QString, QString> OldNamesToNewNames_InV0_3_3();
|
static auto OldNamesToNewNames_InV0_3_3() -> QMap<QString, QString>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VAbstractMConverter) // NOLINT
|
Q_DISABLE_COPY_MOVE(VAbstractMConverter) // NOLINT
|
||||||
|
|
|
@ -187,7 +187,7 @@ void ReadExpressionAttribute(QVector<VFormulaField> &expressions, const QDomElem
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QString> GetTokens(const VFormulaField &formula)
|
auto GetTokens(const VFormulaField &formula) -> QList<QString>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ void GatherTokens(QSet<QString> &tokens, const QList<QString> &tokenList)
|
||||||
* @param materials materials from pattern
|
* @param materials materials from pattern
|
||||||
* @return combined list
|
* @return combined list
|
||||||
*/
|
*/
|
||||||
QMap<int, QString> AdjustMaterials(QMap<int, QString> materials)
|
auto AdjustMaterials(QMap<int, QString> materials) -> QMap<int, QString>
|
||||||
{
|
{
|
||||||
const QMap<int, QString> cliMaterials = VAbstractValApplication::VApp()->GetUserMaterials();
|
const QMap<int, QString> cliMaterials = VAbstractValApplication::VApp()->GetUserMaterials();
|
||||||
QMap<int, QString>::const_iterator i = cliMaterials.constBegin();
|
QMap<int, QString>::const_iterator i = cliMaterials.constBegin();
|
||||||
|
@ -239,7 +239,7 @@ QMap<int, QString> AdjustMaterials(QMap<int, QString> materials)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString PrepareGroupTags(QStringList tags)
|
auto PrepareGroupTags(QStringList tags) -> QString
|
||||||
{
|
{
|
||||||
for (auto &tag : tags)
|
for (auto &tag : tags)
|
||||||
{
|
{
|
||||||
|
@ -316,13 +316,13 @@ VAbstractPattern::~VAbstractPattern()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractPattern::RequiresMeasurements() const
|
auto VAbstractPattern::RequiresMeasurements() const -> bool
|
||||||
{
|
{
|
||||||
return not ListMeasurements().isEmpty();
|
return not ListMeasurements().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::ListMeasurements() const
|
auto VAbstractPattern::ListMeasurements() const -> QStringList
|
||||||
{
|
{
|
||||||
const QFuture<QStringList> futureIncrements = QtConcurrent::run([this](){return ListIncrements();});
|
const QFuture<QStringList> futureIncrements = QtConcurrent::run([this](){return ListIncrements();});
|
||||||
const QList<QString> tokens = ConvertToList(QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens,
|
const QList<QString> tokens = ConvertToList(QtConcurrent::blockingMappedReduced(ListExpressions(), GetTokens,
|
||||||
|
@ -369,7 +369,7 @@ void VAbstractPattern::ChangeActivPP(const QString &name, const Document &parse)
|
||||||
* @param element draw tag.
|
* @param element draw tag.
|
||||||
* @return true if found.
|
* @return true if found.
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const
|
auto VAbstractPattern::GetActivDrawElement(QDomElement &element) const -> bool
|
||||||
{
|
{
|
||||||
if (nameActivPP.isEmpty() == false)
|
if (nameActivPP.isEmpty() == false)
|
||||||
{
|
{
|
||||||
|
@ -396,7 +396,7 @@ bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VToolRecord> VAbstractPattern::getLocalHistory(const QString &draw) const
|
auto VAbstractPattern::getLocalHistory(const QString &draw) const -> QVector<VToolRecord>
|
||||||
{
|
{
|
||||||
QVector<VToolRecord> historyPP;
|
QVector<VToolRecord> historyPP;
|
||||||
for (qint32 i = 0; i< history.size(); ++i)
|
for (qint32 i = 0; i< history.size(); ++i)
|
||||||
|
@ -416,7 +416,7 @@ QVector<VToolRecord> VAbstractPattern::getLocalHistory(const QString &draw) cons
|
||||||
* @param name pattern peace name.
|
* @param name pattern peace name.
|
||||||
* @return true if exist.
|
* @return true if exist.
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::CheckExistNamePP(const QString &name) const
|
auto VAbstractPattern::CheckExistNamePP(const QString &name) const -> bool
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty");
|
||||||
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
|
||||||
|
@ -445,7 +445,7 @@ bool VAbstractPattern::CheckExistNamePP(const QString &name) const
|
||||||
* @param element element.
|
* @param element element.
|
||||||
* @return true if found.
|
* @return true if found.
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::GetActivNodeElement(const QString &name, QDomElement &element) const
|
auto VAbstractPattern::GetActivNodeElement(const QString &name, QDomElement &element) const -> bool
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name draw is empty");
|
||||||
QDomElement drawElement;
|
QDomElement drawElement;
|
||||||
|
@ -522,7 +522,7 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VAbstractPattern::CountPP() const
|
auto VAbstractPattern::CountPP() const -> int
|
||||||
{
|
{
|
||||||
const QDomElement rootElement = this->documentElement();
|
const QDomElement rootElement = this->documentElement();
|
||||||
if (rootElement.isNull())
|
if (rootElement.isNull())
|
||||||
|
@ -534,7 +534,7 @@ int VAbstractPattern::CountPP() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VAbstractPattern::GetPPElement(const QString &name)
|
auto VAbstractPattern::GetPPElement(const QString &name) -> QDomElement
|
||||||
{
|
{
|
||||||
if (not name.isEmpty())
|
if (not name.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -566,7 +566,7 @@ QDomElement VAbstractPattern::GetPPElement(const QString &name)
|
||||||
* @param newName new pattern piece name.
|
* @param newName new pattern piece name.
|
||||||
* @return true if success.
|
* @return true if success.
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newName)
|
auto VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newName) -> bool
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not newName.isEmpty(), Q_FUNC_INFO, "new name pattern piece is empty");
|
Q_ASSERT_X(not newName.isEmpty(), Q_FUNC_INFO, "new name pattern piece is empty");
|
||||||
Q_ASSERT_X(not oldName.isEmpty(), Q_FUNC_INFO, "old name pattern piece is empty");
|
Q_ASSERT_X(not oldName.isEmpty(), Q_FUNC_INFO, "old name pattern piece is empty");
|
||||||
|
@ -595,11 +595,9 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa
|
||||||
emit ChangedNameDraw(oldName, newName);
|
emit ChangedNameDraw(oldName, newName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
qDebug() << "Can't find pattern piece node with name" << oldName << Q_FUNC_INFO;
|
||||||
qDebug()<<"Can't find pattern piece node with name"<<oldName<<Q_FUNC_INFO;
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -611,7 +609,7 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa
|
||||||
* @param name pattern peace name.
|
* @param name pattern peace name.
|
||||||
* @return true if success.
|
* @return true if success.
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::appendPP(const QString &name)
|
auto VAbstractPattern::appendPP(const QString &name) -> bool
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name pattern piece is empty");
|
||||||
if (name.isEmpty())
|
if (name.isEmpty())
|
||||||
|
@ -627,7 +625,7 @@ bool VAbstractPattern::appendPP(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VAbstractPattern::getCursor() const
|
auto VAbstractPattern::getCursor() const -> quint32
|
||||||
{
|
{
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
@ -676,7 +674,7 @@ void VAbstractPattern::Clear()
|
||||||
* @param id tool id.
|
* @param id tool id.
|
||||||
* @return tool.
|
* @return tool.
|
||||||
*/
|
*/
|
||||||
VDataTool *VAbstractPattern::getTool(quint32 id)
|
auto VAbstractPattern::getTool(quint32 id) -> VDataTool *
|
||||||
{
|
{
|
||||||
ToolExists(id);
|
ToolExists(id);
|
||||||
return tools.value(id);
|
return tools.value(id);
|
||||||
|
@ -702,7 +700,7 @@ void VAbstractPattern::RemoveTool(quint32 id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiecePath VAbstractPattern::ParsePieceNodes(const QDomElement &domElement)
|
auto VAbstractPattern::ParsePieceNodes(const QDomElement &domElement) -> VPiecePath
|
||||||
{
|
{
|
||||||
VPiecePath path;
|
VPiecePath path;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -718,7 +716,7 @@ VPiecePath VAbstractPattern::ParsePieceNodes(const QDomElement &domElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<CustomSARecord> VAbstractPattern::ParsePieceCSARecords(const QDomElement &domElement)
|
auto VAbstractPattern::ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>
|
||||||
{
|
{
|
||||||
QVector<CustomSARecord> records;
|
QVector<CustomSARecord> records;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -742,7 +740,7 @@ QVector<CustomSARecord> VAbstractPattern::ParsePieceCSARecords(const QDomElement
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<quint32> VAbstractPattern::ParsePieceInternalPaths(const QDomElement &domElement)
|
auto VAbstractPattern::ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>
|
||||||
{
|
{
|
||||||
QVector<quint32> records;
|
QVector<quint32> records;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -762,7 +760,7 @@ QVector<quint32> VAbstractPattern::ParsePieceInternalPaths(const QDomElement &do
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<quint32> VAbstractPattern::ParsePiecePointRecords(const QDomElement &domElement)
|
auto VAbstractPattern::ParsePiecePointRecords(const QDomElement &domElement) -> QVector<quint32>
|
||||||
{
|
{
|
||||||
QVector<quint32> records;
|
QVector<quint32> records;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -782,7 +780,7 @@ QVector<quint32> VAbstractPattern::ParsePiecePointRecords(const QDomElement &dom
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
|
auto VAbstractPattern::ParseSANode(const QDomElement &domElement) -> VPieceNode
|
||||||
{
|
{
|
||||||
const quint32 id = VDomDocument::GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
const quint32 id = VDomDocument::GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR);
|
||||||
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0'));
|
const bool reverse = VDomDocument::GetParametrUInt(domElement, VAbstractPattern::AttrNodeReverse, QChar('0'));
|
||||||
|
@ -874,19 +872,19 @@ void VAbstractPattern::AddToolOnRemove(VDataTool *tool)
|
||||||
* @brief getHistory return list with list of history records.
|
* @brief getHistory return list with list of history records.
|
||||||
* @return list of history records.
|
* @return list of history records.
|
||||||
*/
|
*/
|
||||||
QVector<VToolRecord> *VAbstractPattern::getHistory()
|
auto VAbstractPattern::getHistory() -> QVector<VToolRecord> *
|
||||||
{
|
{
|
||||||
return &history;
|
return &history;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
|
auto VAbstractPattern::getLocalHistory() const -> QVector<VToolRecord>
|
||||||
{
|
{
|
||||||
return getLocalHistory(GetNameActivPP());
|
return getLocalHistory(GetNameActivPP());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::MPath() const
|
auto VAbstractPattern::MPath() const -> QString
|
||||||
{
|
{
|
||||||
return m_MPath;
|
return m_MPath;
|
||||||
}
|
}
|
||||||
|
@ -920,7 +918,7 @@ void VAbstractPattern::SetMPath(const QString &path)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
|
auto VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const -> quint32
|
||||||
{
|
{
|
||||||
// This check helps to find missed tools in the switch
|
// This check helps to find missed tools in the switch
|
||||||
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Check if need to ignore modeling tools.");
|
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 59, "Check if need to ignore modeling tools.");
|
||||||
|
@ -975,13 +973,13 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::getPatternPieces() const
|
auto VAbstractPattern::getPatternPieces() const -> QStringList
|
||||||
{
|
{
|
||||||
return patternPieces;
|
return patternPieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetDescription() const
|
auto VAbstractPattern::GetDescription() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagDescription);
|
return UniqueTagText(TagDescription);
|
||||||
}
|
}
|
||||||
|
@ -996,7 +994,7 @@ void VAbstractPattern::SetDescription(const QString &text)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetNotes() const
|
auto VAbstractPattern::GetNotes() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagNotes);
|
return UniqueTagText(TagNotes);
|
||||||
}
|
}
|
||||||
|
@ -1011,7 +1009,7 @@ void VAbstractPattern::SetNotes(const QString &text)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetPatternName() const
|
auto VAbstractPattern::GetPatternName() const -> QString
|
||||||
{
|
{
|
||||||
return m_patternName;
|
return m_patternName;
|
||||||
}
|
}
|
||||||
|
@ -1028,7 +1026,7 @@ void VAbstractPattern::SetPatternName(const QString &qsName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetCompanyName() const
|
auto VAbstractPattern::GetCompanyName() const -> QString
|
||||||
{
|
{
|
||||||
return m_companyName;
|
return m_companyName;
|
||||||
}
|
}
|
||||||
|
@ -1045,7 +1043,7 @@ void VAbstractPattern::SetCompanyName(const QString& qsName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetPatternNumber() const
|
auto VAbstractPattern::GetPatternNumber() const -> QString
|
||||||
{
|
{
|
||||||
return m_patternNumber;
|
return m_patternNumber;
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1060,7 @@ void VAbstractPattern::SetPatternNumber(const QString& qsNum)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetCustomerName() const
|
auto VAbstractPattern::GetCustomerName() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagCustomerName);
|
return UniqueTagText(TagCustomerName);
|
||||||
}
|
}
|
||||||
|
@ -1078,7 +1076,7 @@ void VAbstractPattern::SetCustomerName(const QString& qsName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDate VAbstractPattern::GetCustomerBirthDate() const
|
auto VAbstractPattern::GetCustomerBirthDate() const -> QDate
|
||||||
{
|
{
|
||||||
return QDate::fromString(UniqueTagText(TagCustomerBirthDate), "yyyy-MM-dd");
|
return QDate::fromString(UniqueTagText(TagCustomerBirthDate), "yyyy-MM-dd");
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1092,7 @@ void VAbstractPattern::SetCustomerBirthDate(const QDate &date)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetCustomerEmail() const
|
auto VAbstractPattern::GetCustomerEmail() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagCustomerEmail);
|
return UniqueTagText(TagCustomerEmail);
|
||||||
}
|
}
|
||||||
|
@ -1110,7 +1108,7 @@ void VAbstractPattern::SetCustomerEmail(const QString &email)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetLabelDateFormat() const
|
auto VAbstractPattern::GetLabelDateFormat() const -> QString
|
||||||
{
|
{
|
||||||
return m_labelDateFormat;
|
return m_labelDateFormat;
|
||||||
}
|
}
|
||||||
|
@ -1127,7 +1125,7 @@ void VAbstractPattern::SetLabelDateFormat(const QString &format)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetLabelTimeFormat() const
|
auto VAbstractPattern::GetLabelTimeFormat() const -> QString
|
||||||
{
|
{
|
||||||
QString globalLabelTimeFormat = VAbstractApplication::VApp()->Settings()->GetLabelTimeFormat();
|
QString globalLabelTimeFormat = VAbstractApplication::VApp()->Settings()->GetLabelTimeFormat();
|
||||||
|
|
||||||
|
@ -1164,7 +1162,7 @@ void VAbstractPattern::SetPatternLabelTemplate(const QVector<VLabelTemplateLine>
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLabelTemplateLine> VAbstractPattern::GetPatternLabelTemplate() const
|
auto VAbstractPattern::GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>
|
||||||
{
|
{
|
||||||
if (patternLabelLines.isEmpty())
|
if (patternLabelLines.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1181,7 +1179,7 @@ QVector<VLabelTemplateLine> VAbstractPattern::GetPatternLabelTemplate() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractPattern::SetWatermarkPath(const QString &path)
|
auto VAbstractPattern::SetWatermarkPath(const QString &path) -> bool
|
||||||
{
|
{
|
||||||
QDomElement tag = CheckTagExists(TagWatermark);
|
QDomElement tag = CheckTagExists(TagWatermark);
|
||||||
|
|
||||||
|
@ -1196,26 +1194,24 @@ bool VAbstractPattern::SetWatermarkPath(const QString &path)
|
||||||
modified = true;
|
modified = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (setTagText(tag, path))
|
||||||
|
{
|
||||||
|
emit patternChanged(false);
|
||||||
|
patternLabelWasChanged = true;
|
||||||
|
m_watermarkPath = path;
|
||||||
|
modified = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (setTagText(tag, path))
|
qDebug() << "Can't save path to watermark" << Q_FUNC_INFO;
|
||||||
{
|
return false;
|
||||||
emit patternChanged(false);
|
|
||||||
patternLabelWasChanged = true;
|
|
||||||
m_watermarkPath = path;
|
|
||||||
modified = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug() << "Can't save path to watermark" << Q_FUNC_INFO;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetWatermarkPath() const
|
auto VAbstractPattern::GetWatermarkPath() const -> QString
|
||||||
{
|
{
|
||||||
return m_watermarkPath;
|
return m_watermarkPath;
|
||||||
}
|
}
|
||||||
|
@ -1233,7 +1229,7 @@ void VAbstractPattern::SetPatternMaterials(const QMap<int, QString> &materials)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<int, QString> VAbstractPattern::GetPatternMaterials() const
|
auto VAbstractPattern::GetPatternMaterials() const -> QMap<int, QString>
|
||||||
{
|
{
|
||||||
if (patternMaterials.isEmpty())
|
if (patternMaterials.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1250,7 +1246,7 @@ QMap<int, QString> VAbstractPattern::GetPatternMaterials() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFinalMeasurement> VAbstractPattern::GetFinalMeasurements() const
|
auto VAbstractPattern::GetFinalMeasurements() const -> QVector<VFinalMeasurement>
|
||||||
{
|
{
|
||||||
const QDomNodeList list = elementsByTagName(TagFinalMeasurements);
|
const QDomNodeList list = elementsByTagName(TagFinalMeasurements);
|
||||||
if (list.isEmpty() || list.at(0).childNodes().count() == 0)
|
if (list.isEmpty() || list.at(0).childNodes().count() == 0)
|
||||||
|
@ -1272,7 +1268,7 @@ void VAbstractPattern::SetFinalMeasurements(const QVector<VFinalMeasurement> &me
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetDefaultPieceLabelPath() const
|
auto VAbstractPattern::GetDefaultPieceLabelPath() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagPieceLabel);
|
return UniqueTagText(TagPieceLabel);
|
||||||
}
|
}
|
||||||
|
@ -1293,13 +1289,13 @@ void VAbstractPattern::SetPatternWasChanged(bool changed)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractPattern::GetPatternWasChanged() const
|
auto VAbstractPattern::GetPatternWasChanged() const -> bool
|
||||||
{
|
{
|
||||||
return patternLabelWasChanged;
|
return patternLabelWasChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetPassmarkLengthVariable() const
|
auto VAbstractPattern::GetPassmarkLengthVariable() const -> QString
|
||||||
{
|
{
|
||||||
const QDomElement pattern = documentElement();
|
const QDomElement pattern = documentElement();
|
||||||
|
|
||||||
|
@ -1487,7 +1483,7 @@ void VAbstractPattern::DeleteBackgroundImage(const QUuid &id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetVersion() const
|
auto VAbstractPattern::GetVersion() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagVersion, VPatternConverter::PatternMaxVerStr);
|
return UniqueTagText(TagVersion, VPatternConverter::PatternMaxVerStr);
|
||||||
}
|
}
|
||||||
|
@ -1548,7 +1544,7 @@ void VAbstractPattern::ToolExists(const quint32 &id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiecePath VAbstractPattern::ParsePathNodes(const QDomElement &domElement)
|
auto VAbstractPattern::ParsePathNodes(const QDomElement &domElement) -> VPiecePath
|
||||||
{
|
{
|
||||||
VPiecePath path;
|
VPiecePath path;
|
||||||
const QDomNodeList nodeList = domElement.childNodes();
|
const QDomNodeList nodeList = domElement.childNodes();
|
||||||
|
@ -1676,7 +1672,7 @@ void VAbstractPattern::InsertTag(const QStringList &tags, const QDomElement &ele
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VAbstractPattern::GetIndexActivPP() const
|
auto VAbstractPattern::GetIndexActivPP() const -> int
|
||||||
{
|
{
|
||||||
const QDomNodeList drawList = elementsByTagName(TagDraw);
|
const QDomNodeList drawList = elementsByTagName(TagDraw);
|
||||||
|
|
||||||
|
@ -1698,7 +1694,7 @@ int VAbstractPattern::GetIndexActivPP() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::ListIncrements() const
|
auto VAbstractPattern::ListIncrements() const -> QStringList
|
||||||
{
|
{
|
||||||
QStringList increments;
|
QStringList increments;
|
||||||
|
|
||||||
|
@ -1722,7 +1718,7 @@ QStringList VAbstractPattern::ListIncrements() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListExpressions() const
|
auto VAbstractPattern::ListExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
// If new tool bring absolutely new type and has formula(s) create new method to cover it.
|
||||||
// Note. Tool Union Details also contains formulas, but we don't use them for union and keep only to simplifying
|
// Note. Tool Union Details also contains formulas, but we don't use them for union and keep only to simplifying
|
||||||
|
@ -1752,7 +1748,7 @@ QVector<VFormulaField> VAbstractPattern::ListExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListPointExpressions() const
|
auto VAbstractPattern::ListPointExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment a number.
|
// If no just increment a number.
|
||||||
|
@ -1780,7 +1776,7 @@ QVector<VFormulaField> VAbstractPattern::ListPointExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListArcExpressions() const
|
auto VAbstractPattern::ListArcExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1804,7 +1800,7 @@ QVector<VFormulaField> VAbstractPattern::ListArcExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListElArcExpressions() const
|
auto VAbstractPattern::ListElArcExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1829,7 +1825,7 @@ QVector<VFormulaField> VAbstractPattern::ListElArcExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListSplineExpressions() const
|
auto VAbstractPattern::ListSplineExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
expressions << ListPathPointExpressions();
|
expressions << ListPathPointExpressions();
|
||||||
|
@ -1837,7 +1833,7 @@ QVector<VFormulaField> VAbstractPattern::ListSplineExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListPathPointExpressions() const
|
auto VAbstractPattern::ListPathPointExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1860,7 +1856,7 @@ QVector<VFormulaField> VAbstractPattern::ListPathPointExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListIncrementExpressions() const
|
auto VAbstractPattern::ListIncrementExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagIncrement);
|
const QDomNodeList list = elementsByTagName(TagIncrement);
|
||||||
|
@ -1875,7 +1871,7 @@ QVector<VFormulaField> VAbstractPattern::ListIncrementExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListOperationExpressions() const
|
auto VAbstractPattern::ListOperationExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1897,7 +1893,7 @@ QVector<VFormulaField> VAbstractPattern::ListOperationExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListNodesExpressions(const QDomElement &nodes) const
|
auto VAbstractPattern::ListNodesExpressions(const QDomElement &nodes) const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1921,7 +1917,7 @@ QVector<VFormulaField> VAbstractPattern::ListNodesExpressions(const QDomElement
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListPathExpressions() const
|
auto VAbstractPattern::ListPathExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1945,7 +1941,7 @@ QVector<VFormulaField> VAbstractPattern::ListPathExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListGrainlineExpressions(const QDomElement &element) const
|
auto VAbstractPattern::ListGrainlineExpressions(const QDomElement &element) const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
if (not element.isNull())
|
if (not element.isNull())
|
||||||
|
@ -1959,7 +1955,7 @@ QVector<VFormulaField> VAbstractPattern::ListGrainlineExpressions(const QDomElem
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListPieceExpressions() const
|
auto VAbstractPattern::ListPieceExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
// Check if new tool doesn't bring new attribute with a formula.
|
// Check if new tool doesn't bring new attribute with a formula.
|
||||||
// If no just increment number.
|
// If no just increment number.
|
||||||
|
@ -1987,7 +1983,7 @@ QVector<VFormulaField> VAbstractPattern::ListPieceExpressions() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFormulaField> VAbstractPattern::ListFinalMeasurementsExpressions() const
|
auto VAbstractPattern::ListFinalMeasurementsExpressions() const -> QVector<VFormulaField>
|
||||||
{
|
{
|
||||||
QVector<VFormulaField> expressions;
|
QVector<VFormulaField> expressions;
|
||||||
const QDomNodeList list = elementsByTagName(TagFMeasurement);
|
const QDomNodeList list = elementsByTagName(TagFMeasurement);
|
||||||
|
@ -2007,9 +2003,9 @@ QVector<VFormulaField> VAbstractPattern::ListFinalMeasurementsExpressions() cons
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractPattern::IsVariable(const QString &token) const
|
auto VAbstractPattern::IsVariable(const QString &token) const -> bool
|
||||||
{
|
{
|
||||||
for (auto &var : builInVariables)
|
for (const auto &var : builInVariables)
|
||||||
{
|
{
|
||||||
if (token.indexOf( var ) == 0)
|
if (token.indexOf( var ) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2017,10 +2013,8 @@ bool VAbstractPattern::IsVariable(const QString &token) const
|
||||||
{
|
{
|
||||||
return token == var;
|
return token == var;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2033,9 +2027,9 @@ bool VAbstractPattern::IsVariable(const QString &token) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractPattern::IsFunction(const QString &token) const
|
auto VAbstractPattern::IsFunction(const QString &token) const -> bool
|
||||||
{
|
{
|
||||||
for (auto &fn : builInFunctions)
|
for (const auto &fn : builInFunctions)
|
||||||
{
|
{
|
||||||
if (token.indexOf(fn) == 0)
|
if (token.indexOf(fn) == 0)
|
||||||
{
|
{
|
||||||
|
@ -2047,7 +2041,7 @@ bool VAbstractPattern::IsFunction(const QString &token) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QPair<bool, QMap<quint32, quint32> > VAbstractPattern::ParseItemElement(const QDomElement &domElement)
|
auto VAbstractPattern::ParseItemElement(const QDomElement &domElement) -> QPair<bool, QMap<quint32, quint32>>
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
|
@ -2086,7 +2080,7 @@ QPair<bool, QMap<quint32, quint32> > VAbstractPattern::ParseItemElement(const QD
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<int, QString> VAbstractPattern::GetMaterials(const QDomElement &element) const
|
auto VAbstractPattern::GetMaterials(const QDomElement &element) const -> QMap<int, QString>
|
||||||
{
|
{
|
||||||
QMap<int, QString> materials;
|
QMap<int, QString> materials;
|
||||||
|
|
||||||
|
@ -2132,7 +2126,7 @@ void VAbstractPattern::SetMaterials(QDomElement &element, const QMap<int, QStrin
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VFinalMeasurement> VAbstractPattern::GetFMeasurements(const QDomElement &element) const
|
auto VAbstractPattern::GetFMeasurements(const QDomElement &element) const -> QVector<VFinalMeasurement>
|
||||||
{
|
{
|
||||||
QVector<VFinalMeasurement> measurements;
|
QVector<VFinalMeasurement> measurements;
|
||||||
|
|
||||||
|
@ -2163,7 +2157,7 @@ void VAbstractPattern::SetFMeasurements(QDomElement &element, const QVector<VFin
|
||||||
{
|
{
|
||||||
if (not element.isNull())
|
if (not element.isNull())
|
||||||
{
|
{
|
||||||
for (auto &m : measurements)
|
for (const auto &m : measurements)
|
||||||
{
|
{
|
||||||
QDomElement tagFMeasurement = createElement(TagFMeasurement);
|
QDomElement tagFMeasurement = createElement(TagFMeasurement);
|
||||||
|
|
||||||
|
@ -2278,7 +2272,7 @@ void VAbstractPattern::WriteBackgroundImage(QDomElement &element, const VBackgro
|
||||||
* @brief IsModified state of the document for cases that do not cover QUndoStack.
|
* @brief IsModified state of the document for cases that do not cover QUndoStack.
|
||||||
* @return true if the document was modified without using QUndoStack.
|
* @return true if the document was modified without using QUndoStack.
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::IsModified() const
|
auto VAbstractPattern::IsModified() const -> bool
|
||||||
{
|
{
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
|
@ -2290,7 +2284,7 @@ void VAbstractPattern::SetModified(bool modified)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VAbstractPattern::GetDraw(const QString &name) const
|
auto VAbstractPattern::GetDraw(const QString &name) const -> QDomElement
|
||||||
{
|
{
|
||||||
const QDomNodeList draws = documentElement().elementsByTagName(TagDraw);
|
const QDomNodeList draws = documentElement().elementsByTagName(TagDraw);
|
||||||
for (int i=0; i < draws.size(); ++i)
|
for (int i=0; i < draws.size(); ++i)
|
||||||
|
@ -2374,7 +2368,7 @@ auto VAbstractPattern::CreateGroup(quint32 id, const QString &name, const QStrin
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
vidtype VAbstractPattern::GroupLinkedToTool(vidtype toolId) const
|
auto VAbstractPattern::GroupLinkedToTool(vidtype toolId) const -> vidtype
|
||||||
{
|
{
|
||||||
const QDomNodeList groups = elementsByTagName(TagGroup);
|
const QDomNodeList groups = elementsByTagName(TagGroup);
|
||||||
for (int i=0; i < groups.size(); ++i)
|
for (int i=0; i < groups.size(); ++i)
|
||||||
|
@ -2395,7 +2389,7 @@ vidtype VAbstractPattern::GroupLinkedToTool(vidtype toolId) const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::GetGroupName(quint32 id)
|
auto VAbstractPattern::GetGroupName(quint32 id) -> QString
|
||||||
{
|
{
|
||||||
QString name = tr("New group");
|
QString name = tr("New group");
|
||||||
QDomElement group = elementById(id, TagGroup);
|
QDomElement group = elementById(id, TagGroup);
|
||||||
|
@ -2421,7 +2415,7 @@ void VAbstractPattern::SetGroupName(quint32 id, const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::GetGroupTags(vidtype id)
|
auto VAbstractPattern::GetGroupTags(vidtype id) -> QStringList
|
||||||
{
|
{
|
||||||
QStringList tags;
|
QStringList tags;
|
||||||
QDomElement group = elementById(id, TagGroup);
|
QDomElement group = elementById(id, TagGroup);
|
||||||
|
@ -2534,7 +2528,7 @@ void VAbstractPattern::SetDimensionCValue(double value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::GetGroupCategories() const
|
auto VAbstractPattern::GetGroupCategories() const -> QStringList
|
||||||
{
|
{
|
||||||
QSet<QString> categories;
|
QSet<QString> categories;
|
||||||
|
|
||||||
|
@ -2627,7 +2621,8 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap<quint3
|
||||||
* @param containItem |true if the groups have to contain the given item, false if they musn't contain the item
|
* @param containItem |true if the groups have to contain the given item, false if they musn't contain the item
|
||||||
* @return groups that contain or do not contain the item identified by the toolid and the objectid
|
* @return groups that contain or do not contain the item identified by the toolid and the objectid
|
||||||
*/
|
*/
|
||||||
QMap<quint32, QString> VAbstractPattern::GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem)
|
auto VAbstractPattern::GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem)
|
||||||
|
-> QMap<quint32, QString>
|
||||||
{
|
{
|
||||||
QMap<quint32, QString> data;
|
QMap<quint32, QString> data;
|
||||||
|
|
||||||
|
@ -2679,7 +2674,7 @@ QMap<quint32, QString> VAbstractPattern::GetGroupsContainingItem(quint32 toolId,
|
||||||
* @param objectId object id
|
* @param objectId object id
|
||||||
* @return true if the given group has the item with the given toolId and objectId
|
* @return true if the given group has the item with the given toolId and objectId
|
||||||
*/
|
*/
|
||||||
bool VAbstractPattern::GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId)
|
auto VAbstractPattern::GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId) -> bool
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
@ -2720,13 +2715,13 @@ auto VAbstractPattern::ReadUnits() const -> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::ReadPatternNumber() const
|
auto VAbstractPattern::ReadPatternNumber() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagPatternNum);
|
return UniqueTagText(TagPatternNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::ReadLabelDateFormat() const
|
auto VAbstractPattern::ReadLabelDateFormat() const -> QString
|
||||||
{
|
{
|
||||||
const QString globalLabelDateFormat = VAbstractApplication::VApp()->Settings()->GetLabelDateFormat();
|
const QString globalLabelDateFormat = VAbstractApplication::VApp()->Settings()->GetLabelDateFormat();
|
||||||
|
|
||||||
|
@ -2750,7 +2745,7 @@ QString VAbstractPattern::ReadLabelDateFormat() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::ReadPatternName() const
|
auto VAbstractPattern::ReadPatternName() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagPatternName);
|
return UniqueTagText(TagPatternName);
|
||||||
}
|
}
|
||||||
|
@ -2768,13 +2763,13 @@ auto VAbstractPattern::ReadMPath() const -> QString
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::ReadWatermarkPath() const
|
auto VAbstractPattern::ReadWatermarkPath() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagWatermark);
|
return UniqueTagText(TagWatermark);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::ReadCompanyName() const
|
auto VAbstractPattern::ReadCompanyName() const -> QString
|
||||||
{
|
{
|
||||||
return UniqueTagText(TagCompanyName);
|
return UniqueTagText(TagCompanyName);
|
||||||
}
|
}
|
||||||
|
@ -2787,7 +2782,7 @@ QString VAbstractPattern::ReadCompanyName() const
|
||||||
* @param groupId group id
|
* @param groupId group id
|
||||||
* @return group element
|
* @return group element
|
||||||
*/
|
*/
|
||||||
QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId)
|
auto VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement group = elementById(groupId, TagGroup);
|
QDomElement group = elementById(groupId, TagGroup);
|
||||||
|
|
||||||
|
@ -2833,7 +2828,7 @@ QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, q
|
||||||
* @param groupId group id
|
* @param groupId group id
|
||||||
* @return item element or null element is none
|
* @return item element or null element is none
|
||||||
*/
|
*/
|
||||||
QDomElement VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId)
|
auto VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement group = elementById(groupId, TagGroup);
|
QDomElement group = elementById(groupId, TagGroup);
|
||||||
|
|
||||||
|
@ -2889,22 +2884,19 @@ QDomElement VAbstractPattern::RemoveItemFromGroup(quint32 toolId, quint32 object
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VAbstractPattern::GetGroupVisibility(quint32 id)
|
auto VAbstractPattern::GetGroupVisibility(quint32 id) -> bool
|
||||||
{
|
{
|
||||||
QDomElement group = elementById(id, TagGroup);
|
QDomElement group = elementById(id, TagGroup);
|
||||||
if (group.isElement())
|
if (group.isElement())
|
||||||
{
|
{
|
||||||
return GetParametrBool(group, AttrVisible, trueStr);
|
return GetParametrBool(group, AttrVisible, trueStr);
|
||||||
}
|
}
|
||||||
else
|
qDebug("Can't get group by id = %u.", id);
|
||||||
{
|
return true;
|
||||||
qDebug("Can't get group by id = %u.", id);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VAbstractPattern::PieceDrawName(quint32 id)
|
auto VAbstractPattern::PieceDrawName(quint32 id) -> QString
|
||||||
{
|
{
|
||||||
const QDomElement detail = elementById(id, VAbstractPattern::TagDetail);
|
const QDomElement detail = elementById(id, VAbstractPattern::TagDetail);
|
||||||
if (detail.isNull())
|
if (detail.isNull())
|
||||||
|
@ -2922,26 +2914,26 @@ QString VAbstractPattern::PieceDrawName(quint32 id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer VAbstractPattern::GetCompleteData() const
|
auto VAbstractPattern::GetCompleteData() const -> VContainer
|
||||||
{
|
{
|
||||||
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
|
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VContainer VAbstractPattern::GetCompletePPData(const QString &name) const
|
auto VAbstractPattern::GetCompletePPData(const QString &name) const -> VContainer
|
||||||
{
|
{
|
||||||
Q_UNUSED(name)
|
Q_UNUSED(name)
|
||||||
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
|
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
Unit VAbstractPattern::Units() const
|
auto VAbstractPattern::Units() const -> Unit
|
||||||
{
|
{
|
||||||
return m_units;
|
return m_units;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QStringList VAbstractPattern::FilterGroupTags(const QString &tags)
|
auto VAbstractPattern::FilterGroupTags(const QString &tags) -> QStringList
|
||||||
{
|
{
|
||||||
if (tags.isEmpty())
|
if (tags.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,24 +101,24 @@ public:
|
||||||
explicit VAbstractPattern(QObject *parent = nullptr);
|
explicit VAbstractPattern(QObject *parent = nullptr);
|
||||||
virtual ~VAbstractPattern();
|
virtual ~VAbstractPattern();
|
||||||
|
|
||||||
bool RequiresMeasurements() const;
|
auto RequiresMeasurements() const -> bool;
|
||||||
QStringList ListMeasurements() const;
|
auto ListMeasurements() const -> QStringList;
|
||||||
QVector<VFormulaField> ListExpressions() const;
|
auto ListExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListIncrementExpressions() const;
|
auto ListIncrementExpressions() const -> QVector<VFormulaField>;
|
||||||
|
|
||||||
virtual void CreateEmptyFile()=0;
|
virtual void CreateEmptyFile()=0;
|
||||||
|
|
||||||
void ChangeActivPP(const QString& name, const Document &parse = Document::FullParse);
|
void ChangeActivPP(const QString& name, const Document &parse = Document::FullParse);
|
||||||
QString GetNameActivPP() const;
|
auto GetNameActivPP() const -> QString;
|
||||||
bool CheckExistNamePP(const QString& name) const;
|
auto CheckExistNamePP(const QString &name) const -> bool;
|
||||||
int CountPP() const;
|
auto CountPP() const -> int;
|
||||||
QDomElement GetPPElement(const QString &name);
|
auto GetPPElement(const QString &name) -> QDomElement;
|
||||||
bool ChangeNamePP(const QString& oldName, const QString &newName);
|
auto ChangeNamePP(const QString &oldName, const QString &newName) -> bool;
|
||||||
bool appendPP(const QString& name);
|
auto appendPP(const QString &name) -> bool;
|
||||||
|
|
||||||
bool GetActivNodeElement(const QString& name, QDomElement& element) const;
|
auto GetActivNodeElement(const QString &name, QDomElement &element) const -> bool;
|
||||||
|
|
||||||
quint32 getCursor() const;
|
auto getCursor() const -> quint32;
|
||||||
void setCursor(const quint32 &value);
|
void setCursor(const quint32 &value);
|
||||||
|
|
||||||
virtual void setXMLContent(const QString &fileName) override;
|
virtual void setXMLContent(const QString &fileName) override;
|
||||||
|
@ -126,87 +126,87 @@ public:
|
||||||
virtual void IncrementReferens(quint32 id) const=0;
|
virtual void IncrementReferens(quint32 id) const=0;
|
||||||
virtual void DecrementReferens(quint32 id) const=0;
|
virtual void DecrementReferens(quint32 id) const=0;
|
||||||
|
|
||||||
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const=0;
|
virtual auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString = 0;
|
||||||
virtual QString GenerateSuffix() const=0;
|
virtual auto GenerateSuffix() const -> QString = 0;
|
||||||
|
|
||||||
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;
|
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;
|
||||||
|
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
static VDataTool* getTool(quint32 id);
|
static auto getTool(quint32 id) -> VDataTool *;
|
||||||
static void AddTool(quint32 id, VDataTool *tool);
|
static void AddTool(quint32 id, VDataTool *tool);
|
||||||
static void RemoveTool(quint32 id);
|
static void RemoveTool(quint32 id);
|
||||||
|
|
||||||
static VPiecePath ParsePieceNodes(const QDomElement &domElement);
|
static auto ParsePieceNodes(const QDomElement &domElement) -> VPiecePath;
|
||||||
static QVector<CustomSARecord> ParsePieceCSARecords(const QDomElement &domElement);
|
static auto ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>;
|
||||||
static QVector<quint32> ParsePieceInternalPaths(const QDomElement &domElement);
|
static auto ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>;
|
||||||
static QVector<quint32> ParsePiecePointRecords(const QDomElement &domElement);
|
static auto ParsePiecePointRecords(const QDomElement &domElement) -> QVector<quint32>;
|
||||||
|
|
||||||
void AddToolOnRemove(VDataTool *tool);
|
void AddToolOnRemove(VDataTool *tool);
|
||||||
|
|
||||||
QVector<VToolRecord> *getHistory();
|
auto getHistory() -> QVector<VToolRecord> *;
|
||||||
QVector<VToolRecord> getLocalHistory() const;
|
auto getLocalHistory() const -> QVector<VToolRecord>;
|
||||||
|
|
||||||
QString MPath() const;
|
auto MPath() const -> QString;
|
||||||
void SetMPath(const QString &path);
|
void SetMPath(const QString &path);
|
||||||
|
|
||||||
quint32 SiblingNodeId(const quint32 &nodeId) const;
|
auto SiblingNodeId(const quint32 &nodeId) const -> quint32;
|
||||||
|
|
||||||
QStringList getPatternPieces() const;
|
auto getPatternPieces() const -> QStringList;
|
||||||
|
|
||||||
QString GetDescription() const;
|
auto GetDescription() const -> QString;
|
||||||
void SetDescription(const QString &text);
|
void SetDescription(const QString &text);
|
||||||
|
|
||||||
QString GetNotes() const;
|
auto GetNotes() const -> QString;
|
||||||
void SetNotes(const QString &text);
|
void SetNotes(const QString &text);
|
||||||
|
|
||||||
QString GetPatternName() const;
|
auto GetPatternName() const -> QString;
|
||||||
void SetPatternName(const QString& qsName);
|
void SetPatternName(const QString& qsName);
|
||||||
|
|
||||||
QString GetCompanyName() const;
|
auto GetCompanyName() const -> QString;
|
||||||
void SetCompanyName(const QString& qsName);
|
void SetCompanyName(const QString& qsName);
|
||||||
|
|
||||||
QString GetPatternNumber() const;
|
auto GetPatternNumber() const -> QString;
|
||||||
void SetPatternNumber(const QString &qsNum);
|
void SetPatternNumber(const QString &qsNum);
|
||||||
|
|
||||||
QString GetCustomerName() const;
|
auto GetCustomerName() const -> QString;
|
||||||
void SetCustomerName(const QString& qsName);
|
void SetCustomerName(const QString& qsName);
|
||||||
|
|
||||||
QDate GetCustomerBirthDate() const;
|
auto GetCustomerBirthDate() const -> QDate;
|
||||||
void SetCustomerBirthDate(const QDate& date);
|
void SetCustomerBirthDate(const QDate& date);
|
||||||
|
|
||||||
QString GetCustomerEmail() const;
|
auto GetCustomerEmail() const -> QString;
|
||||||
void SetCustomerEmail(const QString& email);
|
void SetCustomerEmail(const QString& email);
|
||||||
|
|
||||||
QString GetLabelDateFormat() const;
|
auto GetLabelDateFormat() const -> QString;
|
||||||
void SetLabelDateFormat(const QString &format);
|
void SetLabelDateFormat(const QString &format);
|
||||||
|
|
||||||
QString GetLabelTimeFormat() const;
|
auto GetLabelTimeFormat() const -> QString;
|
||||||
void SetLabelTimeFormat(const QString &format);
|
void SetLabelTimeFormat(const QString &format);
|
||||||
|
|
||||||
void SetPatternLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
void SetPatternLabelTemplate(const QVector<VLabelTemplateLine> &lines);
|
||||||
QVector<VLabelTemplateLine> GetPatternLabelTemplate() const;
|
auto GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>;
|
||||||
|
|
||||||
bool SetWatermarkPath(const QString &path);
|
auto SetWatermarkPath(const QString &path) -> bool;
|
||||||
QString GetWatermarkPath() const;
|
auto GetWatermarkPath() const -> QString;
|
||||||
|
|
||||||
void SetPatternMaterials(const QMap<int, QString> &materials);
|
void SetPatternMaterials(const QMap<int, QString> &materials);
|
||||||
QMap<int, QString> GetPatternMaterials() const;
|
auto GetPatternMaterials() const -> QMap<int, QString>;
|
||||||
|
|
||||||
QVector<VFinalMeasurement> GetFinalMeasurements() const;
|
auto GetFinalMeasurements() const -> QVector<VFinalMeasurement>;
|
||||||
void SetFinalMeasurements(const QVector<VFinalMeasurement> &measurements);
|
void SetFinalMeasurements(const QVector<VFinalMeasurement> &measurements);
|
||||||
|
|
||||||
QString GetDefaultPieceLabelPath() const;
|
auto GetDefaultPieceLabelPath() const -> QString;
|
||||||
void SetDefaultPieceLabelPath(const QString &path);
|
void SetDefaultPieceLabelPath(const QString &path);
|
||||||
|
|
||||||
void SetPatternWasChanged(bool changed);
|
void SetPatternWasChanged(bool changed);
|
||||||
bool GetPatternWasChanged() const;
|
auto GetPatternWasChanged() const -> bool;
|
||||||
|
|
||||||
QString GetPassmarkLengthVariable() const;
|
auto GetPassmarkLengthVariable() const -> QString;
|
||||||
void SetPassmarkLengthVariable(const QString &name);
|
void SetPassmarkLengthVariable(const QString &name);
|
||||||
|
|
||||||
VPatternImage GetImage() const;
|
auto GetImage() const -> VPatternImage;
|
||||||
bool SetImage(const VPatternImage &image);
|
auto SetImage(const VPatternImage &image) -> bool;
|
||||||
void DeleteImage();
|
void DeleteImage();
|
||||||
|
|
||||||
auto GetBackgroundImages() const -> QVector<VBackgroundPatternImage>;
|
auto GetBackgroundImages() const -> QVector<VBackgroundPatternImage>;
|
||||||
|
@ -215,24 +215,24 @@ public:
|
||||||
void SaveBackgroundImage(const VBackgroundPatternImage &image);
|
void SaveBackgroundImage(const VBackgroundPatternImage &image);
|
||||||
void DeleteBackgroundImage(const QUuid &id);
|
void DeleteBackgroundImage(const QUuid &id);
|
||||||
|
|
||||||
QString GetVersion() const;
|
auto GetVersion() const -> QString;
|
||||||
void SetVersion();
|
void SetVersion();
|
||||||
|
|
||||||
bool IsModified() const;
|
auto IsModified() const -> bool;
|
||||||
void SetModified(bool modified);
|
void SetModified(bool modified);
|
||||||
|
|
||||||
QDomElement GetDraw(const QString &name) const;
|
auto GetDraw(const QString &name) const -> QDomElement;
|
||||||
|
|
||||||
void ParseGroups(const QDomElement &domElement);
|
void ParseGroups(const QDomElement &domElement);
|
||||||
QDomElement CreateGroups(const QString &patternPieceName = QString());
|
auto CreateGroups(const QString &patternPieceName = QString()) -> QDomElement;
|
||||||
QDomElement CreateGroup(quint32 id, const QString &name, const QStringList &tags,
|
auto CreateGroup(quint32 id, const QString &name, const QStringList &tags, const QMap<quint32, quint32> &groupData,
|
||||||
const QMap<quint32, quint32> &groupData, vidtype tool=null_id);
|
vidtype tool = null_id) -> QDomElement;
|
||||||
vidtype GroupLinkedToTool(vidtype toolId) const;
|
auto GroupLinkedToTool(vidtype toolId) const -> vidtype;
|
||||||
|
|
||||||
QString GetGroupName(quint32 id);
|
auto GetGroupName(quint32 id) -> QString;
|
||||||
void SetGroupName(quint32 id, const QString &name);
|
void SetGroupName(quint32 id, const QString &name);
|
||||||
|
|
||||||
QStringList GetGroupTags(vidtype id);
|
auto GetGroupTags(vidtype id) -> QStringList;
|
||||||
void SetGroupTags(quint32 id, const QStringList &tags);
|
void SetGroupTags(quint32 id, const QStringList &tags);
|
||||||
|
|
||||||
auto GetDimensionAValue() -> double;
|
auto GetDimensionAValue() -> double;
|
||||||
|
@ -244,20 +244,20 @@ public:
|
||||||
auto GetDimensionCValue() -> double;
|
auto GetDimensionCValue() -> double;
|
||||||
void SetDimensionCValue(double value);
|
void SetDimensionCValue(double value);
|
||||||
|
|
||||||
QStringList GetGroupCategories() const;
|
auto GetGroupCategories() const -> QStringList;
|
||||||
|
|
||||||
QMap<quint32, VGroupData> GetGroups(const QString &patternPieceName = QString());
|
auto GetGroups(const QString &patternPieceName = QString()) -> QMap<quint32, VGroupData>;
|
||||||
QMap<quint32, QString> GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem);
|
auto GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem) -> QMap<quint32, QString>;
|
||||||
QDomElement AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId);
|
auto AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement;
|
||||||
QDomElement RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId);
|
auto RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement;
|
||||||
bool GetGroupVisibility(quint32 id);
|
auto GetGroupVisibility(quint32 id) -> bool;
|
||||||
|
|
||||||
static QStringList FilterGroupTags(const QString &tags);
|
static auto FilterGroupTags(const QString &tags) -> QStringList;
|
||||||
|
|
||||||
QString PieceDrawName(quint32 id);
|
auto PieceDrawName(quint32 id) -> QString;
|
||||||
|
|
||||||
virtual VContainer GetCompleteData() const;
|
virtual auto GetCompleteData() const -> VContainer;
|
||||||
virtual VContainer GetCompletePPData(const QString &name) const;
|
virtual auto GetCompletePPData(const QString &name) const -> VContainer;
|
||||||
|
|
||||||
auto Units() const -> Unit;
|
auto Units() const -> Unit;
|
||||||
|
|
||||||
|
@ -463,22 +463,22 @@ protected:
|
||||||
static bool patternLabelWasChanged;
|
static bool patternLabelWasChanged;
|
||||||
|
|
||||||
static void ToolExists(const quint32 &id);
|
static void ToolExists(const quint32 &id);
|
||||||
static VPiecePath ParsePathNodes(const QDomElement &domElement);
|
static auto ParsePathNodes(const QDomElement &domElement) -> VPiecePath;
|
||||||
static VPieceNode ParseSANode(const QDomElement &domElement);
|
static auto ParseSANode(const QDomElement &domElement) -> VPieceNode;
|
||||||
|
|
||||||
void SetActivPP(const QString& name);
|
void SetActivPP(const QString& name);
|
||||||
|
|
||||||
QDomElement CheckTagExists(const QString &tag);
|
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);
|
||||||
|
|
||||||
int GetIndexActivPP() const;
|
auto GetIndexActivPP() const -> int;
|
||||||
bool GetActivDrawElement(QDomElement &element) const;
|
auto GetActivDrawElement(QDomElement &element) const -> bool;
|
||||||
|
|
||||||
QVector<VToolRecord> getLocalHistory(const QString &draw) const;
|
auto getLocalHistory(const QString &draw) const -> QVector<VToolRecord>;
|
||||||
|
|
||||||
bool GroupHasItem(const QDomElement &groupDomElement, quint32 toolId, quint32 objectId);
|
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;
|
||||||
|
@ -491,28 +491,28 @@ protected:
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(VAbstractPattern) // NOLINT
|
Q_DISABLE_COPY_MOVE(VAbstractPattern) // NOLINT
|
||||||
|
|
||||||
QStringList ListIncrements() const;
|
auto ListIncrements() const -> QStringList;
|
||||||
QVector<VFormulaField> ListPointExpressions() const;
|
auto ListPointExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListArcExpressions() const;
|
auto ListArcExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListElArcExpressions() const;
|
auto ListElArcExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListSplineExpressions() const;
|
auto ListSplineExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListPathPointExpressions() const;
|
auto ListPathPointExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListOperationExpressions() const;
|
auto ListOperationExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListNodesExpressions(const QDomElement &nodes) const;
|
auto ListNodesExpressions(const QDomElement &nodes) const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListPathExpressions() const;
|
auto ListPathExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListGrainlineExpressions(const QDomElement &element) const;
|
auto ListGrainlineExpressions(const QDomElement &element) const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListPieceExpressions() const;
|
auto ListPieceExpressions() const -> QVector<VFormulaField>;
|
||||||
QVector<VFormulaField> ListFinalMeasurementsExpressions() const;
|
auto ListFinalMeasurementsExpressions() const -> QVector<VFormulaField>;
|
||||||
|
|
||||||
bool IsVariable(const QString& token) const;
|
auto IsVariable(const QString &token) const -> bool;
|
||||||
bool IsFunction(const QString& token) const;
|
auto IsFunction(const QString &token) const -> bool;
|
||||||
|
|
||||||
QPair<bool, QMap<quint32, quint32> > ParseItemElement(const QDomElement &domElement);
|
auto ParseItemElement(const QDomElement &domElement) -> QPair<bool, QMap<quint32, quint32>>;
|
||||||
|
|
||||||
QMap<int, QString> GetMaterials(const QDomElement &element) const;
|
auto GetMaterials(const QDomElement &element) const -> QMap<int, QString>;
|
||||||
void SetMaterials(QDomElement &element, const QMap<int, QString> &materials);
|
void SetMaterials(QDomElement &element, const QMap<int, QString> &materials);
|
||||||
|
|
||||||
QVector<VFinalMeasurement> GetFMeasurements(const QDomElement &element) const;
|
auto GetFMeasurements(const QDomElement &element) const -> QVector<VFinalMeasurement>;
|
||||||
void SetFMeasurements(QDomElement &element, const QVector<VFinalMeasurement> &measurements);
|
void SetFMeasurements(QDomElement &element, const QVector<VFinalMeasurement> &measurements);
|
||||||
|
|
||||||
auto GetBackgroundPatternImage(const QDomElement &element) const -> VBackgroundPatternImage;
|
auto GetBackgroundPatternImage(const QDomElement &element) const -> VBackgroundPatternImage;
|
||||||
|
@ -527,7 +527,7 @@ QT_WARNING_POP
|
||||||
* @brief GetNameActivPP return current pattern piece name.
|
* @brief GetNameActivPP return current pattern piece name.
|
||||||
* @return pattern piece name.
|
* @return pattern piece name.
|
||||||
*/
|
*/
|
||||||
inline QString VAbstractPattern::GetNameActivPP() const
|
inline auto VAbstractPattern::GetNameActivPP() const -> QString
|
||||||
{
|
{
|
||||||
return nameActivPP;
|
return nameActivPP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ void SaveNodeCanonically(QXmlStreamWriter &stream, const QDomNode &domNode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QDomNode> GetChildElements(const QDomNode& e)
|
auto GetChildElements(const QDomNode &e) -> QList<QDomNode>
|
||||||
{
|
{
|
||||||
QDomNodeList children = e.childNodes();
|
QDomNodeList children = e.childNodes();
|
||||||
QList<QDomNode> r;
|
QList<QDomNode> r;
|
||||||
|
@ -136,7 +136,7 @@ QList<QDomNode> GetChildElements(const QDomNode& e)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<QDomNode> GetElementAttributes(const QDomNode& e)
|
auto GetElementAttributes(const QDomNode &e) -> QList<QDomNode>
|
||||||
{
|
{
|
||||||
QDomNamedNodeMap attributes = e.attributes();
|
QDomNamedNodeMap attributes = e.attributes();
|
||||||
QList<QDomNode> r;
|
QList<QDomNode> r;
|
||||||
|
@ -149,7 +149,7 @@ QList<QDomNode> GetElementAttributes(const QDomNode& e)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool LessThen(const QDomNode &element1, const QDomNode &element2)
|
auto LessThen(const QDomNode &element1, const QDomNode &element2) -> bool
|
||||||
{
|
{
|
||||||
if (element1.nodeType() != element2.nodeType())
|
if (element1.nodeType() != element2.nodeType())
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ VDomDocument::~VDomDocument()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VDomDocument::elementById(quint32 id, const QString &tagName, bool updateCache)
|
auto VDomDocument::elementById(quint32 id, const QString &tagName, bool updateCache) -> QDomElement
|
||||||
{
|
{
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
|
@ -383,7 +383,7 @@ auto VDomDocument::find(QHash<quint32, QDomElement> &cache, const QDomElement &n
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QHash<quint32, QDomElement> VDomDocument::RefreshCache(const QDomElement &root) const
|
auto VDomDocument::RefreshCache(const QDomElement &root) const -> QHash<quint32, QDomElement>
|
||||||
{
|
{
|
||||||
QHash<quint32, QDomElement> cache;
|
QHash<quint32, QDomElement> cache;
|
||||||
VDomDocument::find(cache, root, NULL_ID);
|
VDomDocument::find(cache, root, NULL_ID);
|
||||||
|
@ -391,7 +391,7 @@ QHash<quint32, QDomElement> VDomDocument::RefreshCache(const QDomElement &root)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDomDocument::SaveCanonicalXML(QIODevice *file, int indent, QString &error) const
|
auto VDomDocument::SaveCanonicalXML(QIODevice *file, int indent, QString &error) const -> bool
|
||||||
{
|
{
|
||||||
SCASSERT(file != nullptr)
|
SCASSERT(file != nullptr)
|
||||||
|
|
||||||
|
@ -428,7 +428,8 @@ bool VDomDocument::SaveCanonicalXML(QIODevice *file, int indent, QString &error)
|
||||||
* @param name attribute name
|
* @param name attribute name
|
||||||
* @return long long value
|
* @return long long value
|
||||||
*/
|
*/
|
||||||
quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
|
auto VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
|
||||||
|
-> quint32
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591
|
||||||
|
@ -457,7 +458,7 @@ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QStri
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int VDomDocument::GetParametrInt(const QDomElement &domElement, const QString &name, const QString &defValue)
|
auto VDomDocument::GetParametrInt(const QDomElement &domElement, const QString &name, const QString &defValue) -> int
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); //-V591
|
||||||
|
@ -486,7 +487,7 @@ int VDomDocument::GetParametrInt(const QDomElement &domElement, const QString &n
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString &name, const QString &defValue)
|
auto VDomDocument::GetParametrBool(const QDomElement &domElement, const QString &name, const QString &defValue) -> bool
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -525,17 +526,14 @@ bool VDomDocument::GetParametrBool(const QDomElement &domElement, const QString
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
NodeUsage VDomDocument::GetParametrUsage(const QDomElement &domElement, const QString &name)
|
auto VDomDocument::GetParametrUsage(const QDomElement &domElement, const QString &name) -> NodeUsage
|
||||||
{
|
{
|
||||||
const bool value = GetParametrBool(domElement, name, trueStr);
|
const bool value = GetParametrBool(domElement, name, trueStr);
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
return NodeUsage::InUse;
|
return NodeUsage::InUse;
|
||||||
}
|
}
|
||||||
else
|
return NodeUsage::NotInUse;
|
||||||
{
|
|
||||||
return NodeUsage::NotInUse;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -559,8 +557,8 @@ void VDomDocument::SetParametrUsage(QDomElement &domElement, const QString &name
|
||||||
* @return attribute value
|
* @return attribute value
|
||||||
* @throw VExceptionEmptyParameter when attribute is empty
|
* @throw VExceptionEmptyParameter when attribute is empty
|
||||||
*/
|
*/
|
||||||
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name,
|
auto VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue)
|
||||||
const QString &defValue)
|
-> QString
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -571,16 +569,13 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt
|
||||||
{
|
{
|
||||||
throw VExceptionEmptyParameter(QObject::tr("Got empty parameter"), name, domElement);
|
throw VExceptionEmptyParameter(QObject::tr("Got empty parameter"), name, domElement);
|
||||||
}
|
}
|
||||||
else
|
return defValue;
|
||||||
{
|
|
||||||
return defValue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VDomDocument::GetParametrEmptyString(const QDomElement &domElement, const QString &name)
|
auto VDomDocument::GetParametrEmptyString(const QDomElement &domElement, const QString &name) -> QString
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -594,7 +589,8 @@ QString VDomDocument::GetParametrEmptyString(const QDomElement &domElement, cons
|
||||||
* @param name attribute name
|
* @param name attribute name
|
||||||
* @return double value
|
* @return double value
|
||||||
*/
|
*/
|
||||||
qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue)
|
auto VDomDocument::GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue)
|
||||||
|
-> qreal
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
Q_ASSERT_X(not name.isEmpty(), Q_FUNC_INFO, "name of parametr is empty");
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
@ -626,7 +622,7 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri
|
||||||
* @param domElement tag in xml tree.
|
* @param domElement tag in xml tree.
|
||||||
* @return id value.
|
* @return id value.
|
||||||
*/
|
*/
|
||||||
quint32 VDomDocument::GetParametrId(const QDomElement &domElement)
|
auto VDomDocument::GetParametrId(const QDomElement &domElement) -> quint32
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
|
||||||
|
|
||||||
|
@ -711,7 +707,7 @@ void VDomDocument::RefreshElementIdCache()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDomDocument::Compare(const QDomElement &element1, const QDomElement &element2)
|
auto VDomDocument::Compare(const QDomElement &element1, const QDomElement &element2) -> bool
|
||||||
{
|
{
|
||||||
QFuture<bool> lessThen2 = QtConcurrent::run(LessThen, element2, element1);
|
QFuture<bool> lessThen2 = QtConcurrent::run(LessThen, element2, element1);
|
||||||
return !LessThen(element1, element2) && !lessThen2.result();
|
return !LessThen(element1, element2) && !lessThen2.result();
|
||||||
|
@ -749,7 +745,7 @@ void VDomDocument::setXMLContent(const QString &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VDomDocument::UnitsHelpString()
|
auto VDomDocument::UnitsHelpString() -> QString
|
||||||
{
|
{
|
||||||
QString r;
|
QString r;
|
||||||
for (auto i = static_cast<int>(Unit::Mm), last = static_cast<int>(Unit::LAST_UNIT_DO_NOT_USE); i < last;++i)
|
for (auto i = static_cast<int>(Unit::Mm), last = static_cast<int>(Unit::LAST_UNIT_DO_NOT_USE); i < last;++i)
|
||||||
|
@ -764,7 +760,7 @@ QString VDomDocument::UnitsHelpString()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VDomDocument::CreateElementWithText(const QString &tagName, const QString &text)
|
auto VDomDocument::CreateElementWithText(const QString &tagName, const QString &text) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement tag = createElement(tagName);
|
QDomElement tag = createElement(tagName);
|
||||||
tag.appendChild(createTextNode(text));
|
tag.appendChild(createTextNode(text));
|
||||||
|
@ -772,7 +768,7 @@ QDomElement VDomDocument::CreateElementWithText(const QString &tagName, const QS
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDomDocument::SaveDocument(const QString &fileName, QString &error)
|
auto VDomDocument::SaveDocument(const QString &fileName, QString &error) -> bool
|
||||||
{
|
{
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -809,7 +805,7 @@ bool VDomDocument::SaveDocument(const QString &fileName, QString &error)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QString VDomDocument::Major() const
|
auto VDomDocument::Major() const -> QString
|
||||||
{
|
{
|
||||||
QString version = UniqueTagText(TagVersion, "0.0.0");
|
QString version = UniqueTagText(TagVersion, "0.0.0");
|
||||||
QStringList v = version.split(QChar('.'));
|
QStringList v = version.split(QChar('.'));
|
||||||
|
@ -818,7 +814,7 @@ QString VDomDocument::Major() const
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QString VDomDocument::Minor() const
|
auto VDomDocument::Minor() const -> QString
|
||||||
{
|
{
|
||||||
QString version = UniqueTagText(TagVersion, "0.0.0");
|
QString version = UniqueTagText(TagVersion, "0.0.0");
|
||||||
QStringList v = version.split(QChar('.'));
|
QStringList v = version.split(QChar('.'));
|
||||||
|
@ -827,7 +823,7 @@ QString VDomDocument::Minor() const
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QString VDomDocument::Patch() const
|
auto VDomDocument::Patch() const -> QString
|
||||||
{
|
{
|
||||||
QString version = UniqueTagText(TagVersion, "0.0.0");
|
QString version = UniqueTagText(TagVersion, "0.0.0");
|
||||||
QStringList v = version.split(QChar('.'));
|
QStringList v = version.split(QChar('.'));
|
||||||
|
@ -835,7 +831,7 @@ QString VDomDocument::Patch() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VDomDocument::GetFormatVersionStr() const
|
auto VDomDocument::GetFormatVersionStr() const -> QString
|
||||||
{
|
{
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(TagVersion);
|
const QDomNodeList nodeList = this->elementsByTagName(TagVersion);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
|
@ -944,7 +940,7 @@ auto VDomDocument::setTagText(QDomElement &domElement, const QString &text) -> b
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VDomDocument::UniqueTag(const QString &tagName) const
|
auto VDomDocument::UniqueTag(const QString &tagName) const -> QDomElement
|
||||||
{
|
{
|
||||||
const QDomNodeList nodeList = this->elementsByTagName(tagName);
|
const QDomNodeList nodeList = this->elementsByTagName(tagName);
|
||||||
if (nodeList.isEmpty())
|
if (nodeList.isEmpty())
|
||||||
|
@ -981,21 +977,21 @@ void VDomDocument::RemoveAllChildren(QDomElement &domElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomNode VDomDocument::ParentNodeById(const quint32 &nodeId)
|
auto VDomDocument::ParentNodeById(const quint32 &nodeId) -> QDomNode
|
||||||
{
|
{
|
||||||
QDomElement domElement = NodeById(nodeId);
|
QDomElement domElement = NodeById(nodeId);
|
||||||
return domElement.parentNode();
|
return domElement.parentNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VDomDocument::CloneNodeById(const quint32 &nodeId)
|
auto VDomDocument::CloneNodeById(const quint32 &nodeId) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement domElement = NodeById(nodeId);
|
QDomElement domElement = NodeById(nodeId);
|
||||||
return domElement.cloneNode().toElement();
|
return domElement.cloneNode().toElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VDomDocument::NodeById(const quint32 &nodeId, const QString &tagName)
|
auto VDomDocument::NodeById(const quint32 &nodeId, const QString &tagName) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement domElement = elementById(nodeId, tagName);
|
QDomElement domElement = elementById(nodeId, tagName);
|
||||||
if (domElement.isNull() || domElement.isElement() == false)
|
if (domElement.isNull() || domElement.isElement() == false)
|
||||||
|
@ -1006,7 +1002,7 @@ QDomElement VDomDocument::NodeById(const quint32 &nodeId, const QString &tagName
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VDomDocument::SafeCopy(const QString &source, const QString &destination, QString &error)
|
auto VDomDocument::SafeCopy(const QString &source, const QString &destination, QString &error) -> bool
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
@ -1072,7 +1068,7 @@ bool VDomDocument::SafeCopy(const QString &source, const QString &destination, Q
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QVector<VLabelTemplateLine> VDomDocument::GetLabelTemplate(const QDomElement &element) const
|
auto VDomDocument::GetLabelTemplate(const QDomElement &element) const -> QVector<VLabelTemplateLine>
|
||||||
{
|
{
|
||||||
// We use implicit conversion. That's why check if values are still the same as excpected.
|
// We use implicit conversion. That's why check if values are still the same as excpected.
|
||||||
Q_STATIC_ASSERT(Qt::AlignLeft == 1);
|
Q_STATIC_ASSERT(Qt::AlignLeft == 1);
|
||||||
|
@ -1108,7 +1104,7 @@ void VDomDocument::SetLabelTemplate(QDomElement &element, const QVector<VLabelTe
|
||||||
{
|
{
|
||||||
if (not element.isNull())
|
if (not element.isNull())
|
||||||
{
|
{
|
||||||
for (auto &line : lines)
|
for (const auto &line : lines)
|
||||||
{
|
{
|
||||||
QDomElement tagLine = createElement(TagLine);
|
QDomElement tagLine = createElement(TagLine);
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
explicit VDomDocument(QObject *parent = nullptr);
|
explicit VDomDocument(QObject *parent = nullptr);
|
||||||
virtual ~VDomDocument();
|
virtual ~VDomDocument();
|
||||||
QDomElement elementById(quint32 id, const QString &tagName = QString(), bool updateCache=true);
|
auto elementById(quint32 id, const QString &tagName = QString(), bool updateCache = true) -> QDomElement;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const;
|
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const;
|
||||||
|
@ -107,52 +107,52 @@ public:
|
||||||
void SetAttributeOrRemoveIf(QDomElement &domElement, const QString &name, const T &value,
|
void SetAttributeOrRemoveIf(QDomElement &domElement, const QString &name, const T &value,
|
||||||
const std::function<bool(const T&)> &removeCondition) const;
|
const std::function<bool(const T&)> &removeCondition) const;
|
||||||
|
|
||||||
static quint32 GetParametrUInt(const QDomElement& domElement, const QString &name, const QString &defValue);
|
static auto GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) -> quint32;
|
||||||
static int GetParametrInt(const QDomElement& domElement, const QString &name, const QString &defValue);
|
static auto GetParametrInt(const QDomElement &domElement, const QString &name, const QString &defValue) -> int;
|
||||||
static bool GetParametrBool(const QDomElement& domElement, const QString &name, const QString &defValue);
|
static auto GetParametrBool(const QDomElement &domElement, const QString &name, const QString &defValue) -> bool;
|
||||||
|
|
||||||
static NodeUsage GetParametrUsage(const QDomElement& domElement, const QString &name);
|
static auto GetParametrUsage(const QDomElement &domElement, const QString &name) -> NodeUsage;
|
||||||
static void SetParametrUsage(QDomElement& domElement, const QString &name, const NodeUsage &value);
|
static void SetParametrUsage(QDomElement& domElement, const QString &name, const NodeUsage &value);
|
||||||
|
|
||||||
static QString GetParametrString(const QDomElement& domElement, const QString &name,
|
static auto GetParametrString(const QDomElement &domElement, const QString &name,
|
||||||
const QString &defValue = QString());
|
const QString &defValue = QString()) -> QString;
|
||||||
static QString GetParametrEmptyString(const QDomElement& domElement, const QString &name);
|
static auto GetParametrEmptyString(const QDomElement &domElement, const QString &name) -> QString;
|
||||||
static qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue);
|
static auto GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) -> qreal;
|
||||||
static quint32 GetParametrId(const QDomElement& domElement);
|
static auto GetParametrId(const QDomElement &domElement) -> quint32;
|
||||||
|
|
||||||
virtual void setXMLContent(const QString &fileName);
|
virtual void setXMLContent(const QString &fileName);
|
||||||
static QString UnitsHelpString();
|
static auto UnitsHelpString() -> QString;
|
||||||
|
|
||||||
QDomElement CreateElementWithText(const QString& tagName, const QString& text);
|
auto CreateElementWithText(const QString &tagName, const QString &text) -> QDomElement;
|
||||||
|
|
||||||
virtual bool SaveDocument(const QString &fileName, QString &error);
|
virtual auto SaveDocument(const QString &fileName, QString &error) -> bool;
|
||||||
QString Major() const;
|
auto Major() const -> QString;
|
||||||
QString Minor() const;
|
auto Minor() const -> QString;
|
||||||
QString Patch() const;
|
auto Patch() const -> QString;
|
||||||
virtual QString GetFormatVersionStr() const;
|
virtual auto GetFormatVersionStr() const -> QString;
|
||||||
static unsigned GetFormatVersion(const QString &version);
|
static auto GetFormatVersion(const QString &version) -> unsigned;
|
||||||
static void RemoveAllChildren(QDomElement &domElement);
|
static void RemoveAllChildren(QDomElement &domElement);
|
||||||
|
|
||||||
QDomNode ParentNodeById(const quint32 &nodeId);
|
auto ParentNodeById(const quint32 &nodeId) -> QDomNode;
|
||||||
QDomElement CloneNodeById(const quint32 &nodeId);
|
auto CloneNodeById(const quint32 &nodeId) -> QDomElement;
|
||||||
QDomElement NodeById(const quint32 &nodeId, const QString &tagName = QString());
|
auto NodeById(const quint32 &nodeId, const QString &tagName = QString()) -> QDomElement;
|
||||||
|
|
||||||
static bool SafeCopy(const QString &source, const QString &destination, QString &error);
|
static auto SafeCopy(const QString &source, const QString &destination, QString &error) -> bool;
|
||||||
|
|
||||||
QVector<VLabelTemplateLine> GetLabelTemplate(const QDomElement &element) const;
|
auto GetLabelTemplate(const QDomElement &element) const -> QVector<VLabelTemplateLine>;
|
||||||
void SetLabelTemplate(QDomElement &element, const QVector<VLabelTemplateLine> &lines);
|
void SetLabelTemplate(QDomElement &element, const QVector<VLabelTemplateLine> &lines);
|
||||||
|
|
||||||
void TestUniqueId() const;
|
void TestUniqueId() const;
|
||||||
|
|
||||||
void RefreshElementIdCache();
|
void RefreshElementIdCache();
|
||||||
|
|
||||||
static bool Compare(const QDomElement &element1, const QDomElement &element2);
|
static auto Compare(const QDomElement &element1, const QDomElement &element2) -> bool;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool setTagText(const QString &tag, const QString &text);
|
auto setTagText(const QString &tag, const QString &text) -> bool;
|
||||||
bool setTagText(QDomElement &domElement, const QString &text);
|
auto setTagText(QDomElement &domElement, const QString &text) -> bool;
|
||||||
QDomElement UniqueTag(const QString &tagName) const;
|
auto UniqueTag(const QString &tagName) const -> QDomElement;
|
||||||
QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const;
|
auto UniqueTagText(const QString &tagName, const QString &defVal = QString()) const -> QString;
|
||||||
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
|
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
|
||||||
|
|
||||||
static void ValidateVersion(const QString &version);
|
static void ValidateVersion(const QString &version);
|
||||||
|
@ -167,10 +167,10 @@ private:
|
||||||
QHash<quint32, QDomElement> m_elementIdCache;
|
QHash<quint32, QDomElement> m_elementIdCache;
|
||||||
QFutureWatcher<QHash<quint32, QDomElement>> *m_watcher;
|
QFutureWatcher<QHash<quint32, QDomElement>> *m_watcher;
|
||||||
|
|
||||||
static bool find(QHash<quint32, QDomElement> &cache, const QDomElement &node, quint32 id);
|
static auto find(QHash<quint32, QDomElement> &cache, const QDomElement &node, quint32 id) -> bool;
|
||||||
QHash<quint32, QDomElement> RefreshCache(const QDomElement &root) const;
|
auto RefreshCache(const QDomElement &root) const -> QHash<quint32, QDomElement>;
|
||||||
|
|
||||||
bool SaveCanonicalXML(QIODevice *file, int indent, QString &error) const;
|
auto SaveCanonicalXML(QIODevice *file, int indent, QString &error) const -> bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -63,25 +63,25 @@ auto VLabelTemplateConverter::XSDSchemas() -> QHash<unsigned int, QString>
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
unsigned VLabelTemplateConverter::MinVer() const
|
auto VLabelTemplateConverter::MinVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return LabelTemplateMinVer;
|
return LabelTemplateMinVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
unsigned VLabelTemplateConverter::MaxVer() const
|
auto VLabelTemplateConverter::MaxVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return LabelTemplateMaxVer;
|
return LabelTemplateMaxVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VLabelTemplateConverter::MinVerStr() const
|
auto VLabelTemplateConverter::MinVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return LabelTemplateMinVerStr;
|
return LabelTemplateMinVerStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VLabelTemplateConverter::MaxVerStr() const
|
auto VLabelTemplateConverter::MaxVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return LabelTemplateMaxVerStr;
|
return LabelTemplateMaxVerStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,16 +46,16 @@ public:
|
||||||
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual unsigned MinVer() const override;
|
virtual auto MinVer() const -> unsigned override;
|
||||||
virtual unsigned MaxVer() const override;
|
virtual auto MaxVer() const -> unsigned override;
|
||||||
|
|
||||||
virtual QString MinVerStr() const override;
|
virtual auto MinVerStr() const -> QString override;
|
||||||
virtual QString MaxVerStr() const override;
|
virtual auto MaxVerStr() const -> QString override;
|
||||||
|
|
||||||
virtual void ApplyPatches() override;
|
virtual void ApplyPatches() override;
|
||||||
virtual void DowngradeToCurrentMaxVersion() override;
|
virtual void DowngradeToCurrentMaxVersion() override;
|
||||||
|
|
||||||
virtual bool IsReadOnly() const override {return false;}
|
virtual auto IsReadOnly() const -> bool override { return false; }
|
||||||
|
|
||||||
auto Schemas() const -> QHash <unsigned, QString> override;
|
auto Schemas() const -> QHash <unsigned, QString> override;
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VPatternConverter::IsReadOnly() const
|
auto VPatternConverter::IsReadOnly() const -> bool
|
||||||
{
|
{
|
||||||
// Check if attribute readOnly was not changed in file format
|
// Check if attribute readOnly was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 2),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FormatVersion(0, 9, 2),
|
||||||
|
@ -620,7 +620,7 @@ void VPatternConverter::ConvertMeasurementsToV0_2_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QSet<QString> VPatternConverter::FixIncrementsToV0_2_0()
|
auto VPatternConverter::FixIncrementsToV0_2_0() -> QSet<QString>
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -994,7 +994,8 @@ void VPatternConverter::ConvertPathPointExpressionsToV0_2_0(const QMap<QString,
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names)
|
auto VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names)
|
||||||
|
-> QString
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -1028,7 +1029,7 @@ QString VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formul
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names)
|
auto VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names) -> QString
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -1116,7 +1117,7 @@ void VPatternConverter::RemoveColorToolCutV0_3_1()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VPatternConverter::MUnitV0_1_4() const
|
auto VPatternConverter::MUnitV0_1_4() const -> QString
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -1136,7 +1137,7 @@ QString VPatternConverter::MUnitV0_1_4() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPatternConverter::TagMeasurementsV0_1_4() const
|
auto VPatternConverter::TagMeasurementsV0_1_4() const -> QDomElement
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -1153,7 +1154,7 @@ QDomElement VPatternConverter::TagMeasurementsV0_1_4() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPatternConverter::TagIncrementsV0_1_4() const
|
auto VPatternConverter::TagIncrementsV0_1_4() const -> QDomElement
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -1247,7 +1248,7 @@ void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QString> VPatternConverter::OldNamesToNewNames_InV0_2_0()
|
auto VPatternConverter::OldNamesToNewNames_InV0_2_0() -> QMap<QString, QString>
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.0
|
// TODO. Delete if minimal supported version is 0.2.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 0),
|
||||||
|
@ -1427,7 +1428,7 @@ QMap<QString, QString> VPatternConverter::OldNamesToNewNames_InV0_2_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QString> VPatternConverter::OldNamesToNewNames_InV0_2_1()
|
auto VPatternConverter::OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.2.1
|
// TODO. Delete if minimal supported version is 0.2.1
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 1),
|
||||||
|
@ -1741,7 +1742,7 @@ void VPatternConverter::TagDetailToV0_4_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &detail)
|
auto VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &detail) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement tagNodes = createElement(*strNodes);
|
QDomElement tagNodes = createElement(*strNodes);
|
||||||
|
|
||||||
|
@ -1773,7 +1774,7 @@ QDomElement VPatternConverter::GetUnionDetailNodesV0_4_0(const QDomElement &deta
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail)
|
auto VPatternConverter::GetUnionChildrenNodesV0_4_0(const QDomElement &detail) -> QDomElement
|
||||||
{
|
{
|
||||||
QDomElement tagNodes = createElement(*strNodes);
|
QDomElement tagNodes = createElement(*strNodes);
|
||||||
|
|
||||||
|
@ -1847,7 +1848,7 @@ void VPatternConverter::LabelTagToV0_4_4(const QString &tagName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VPatternConverter::AddTagPatternLabelV0_5_1()
|
auto VPatternConverter::AddTagPatternLabelV0_5_1() -> QDomElement
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.6.0
|
// TODO. Delete if minimal supported version is 0.6.0
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),
|
||||||
|
|
|
@ -61,16 +61,16 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void Save() override;
|
void Save() override;
|
||||||
|
|
||||||
virtual unsigned MinVer() const override;
|
virtual auto MinVer() const -> unsigned override;
|
||||||
virtual unsigned MaxVer() const override;
|
virtual auto MaxVer() const -> unsigned override;
|
||||||
|
|
||||||
virtual QString MinVerStr() const override;
|
virtual auto MinVerStr() const -> QString override;
|
||||||
virtual QString MaxVerStr() const override;
|
virtual auto MaxVerStr() const -> QString override;
|
||||||
|
|
||||||
virtual void ApplyPatches() override;
|
virtual void ApplyPatches() override;
|
||||||
virtual void DowngradeToCurrentMaxVersion() override;
|
virtual void DowngradeToCurrentMaxVersion() override;
|
||||||
|
|
||||||
virtual bool IsReadOnly() const override;
|
virtual auto IsReadOnly() const -> bool override;
|
||||||
|
|
||||||
auto Schemas() const -> QHash <unsigned, QString> override;
|
auto Schemas() const -> QHash <unsigned, QString> override;
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ private:
|
||||||
|
|
||||||
void RemoveColorToolCutV0_3_1();
|
void RemoveColorToolCutV0_3_1();
|
||||||
|
|
||||||
QSet<QString> FixIncrementsToV0_2_0();
|
auto FixIncrementsToV0_2_0() -> QSet<QString>;
|
||||||
QString FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names);
|
auto FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names) -> QString;
|
||||||
void FixPointExpressionsToV0_2_0(const QSet<QString> &names);
|
void FixPointExpressionsToV0_2_0(const QSet<QString> &names);
|
||||||
void FixArcExpressionsToV0_2_0(const QSet<QString> &names);
|
void FixArcExpressionsToV0_2_0(const QSet<QString> &names);
|
||||||
void FixPathPointExpressionsToV0_2_0(const QSet<QString> &names);
|
void FixPathPointExpressionsToV0_2_0(const QSet<QString> &names);
|
||||||
|
@ -110,18 +110,18 @@ private:
|
||||||
void ConvertPointExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
void ConvertPointExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
||||||
void ConvertArcExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
void ConvertArcExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
||||||
void ConvertPathPointExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
void ConvertPathPointExpressionsToV0_2_0(const QMap<QString, QString> &names);
|
||||||
QString FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names);
|
auto FixMeasurementInFormulaToV0_2_0(const QString &formula, const QMap<QString, QString> &names) -> QString;
|
||||||
|
|
||||||
QString MUnitV0_1_4() const;
|
auto MUnitV0_1_4() const -> QString;
|
||||||
QDomElement TagMeasurementsV0_1_4() const;
|
auto TagMeasurementsV0_1_4() const -> QDomElement;
|
||||||
QDomElement TagIncrementsV0_1_4() const;
|
auto TagIncrementsV0_1_4() const -> QDomElement;
|
||||||
|
|
||||||
void FixToolUnionToV0_2_4();
|
void FixToolUnionToV0_2_4();
|
||||||
void ParseModelingToV0_2_4(const QDomElement &modeling);
|
void ParseModelingToV0_2_4(const QDomElement &modeling);
|
||||||
void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children);
|
void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children);
|
||||||
|
|
||||||
static QMap<QString, QString> OldNamesToNewNames_InV0_2_0();
|
static auto OldNamesToNewNames_InV0_2_0() -> QMap<QString, QString>;
|
||||||
static QMap<QString, QString> OldNamesToNewNames_InV0_2_1();
|
static auto OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>;
|
||||||
|
|
||||||
void FixCutPoint();
|
void FixCutPoint();
|
||||||
void FixSubPaths(int i, quint32 id, quint32 baseCurve);
|
void FixSubPaths(int i, quint32 id, quint32 baseCurve);
|
||||||
|
@ -129,12 +129,12 @@ private:
|
||||||
void TagRemoveAttributeTypeObjectInV0_4_0();
|
void TagRemoveAttributeTypeObjectInV0_4_0();
|
||||||
void TagDetailToV0_4_0();
|
void TagDetailToV0_4_0();
|
||||||
void TagUnionDetailsToV0_4_0();
|
void TagUnionDetailsToV0_4_0();
|
||||||
QDomElement GetUnionDetailNodesV0_4_0(const QDomElement &detail);
|
auto GetUnionDetailNodesV0_4_0(const QDomElement &detail) -> QDomElement;
|
||||||
QDomElement GetUnionChildrenNodesV0_4_0(const QDomElement &detail);
|
auto GetUnionChildrenNodesV0_4_0(const QDomElement &detail) -> QDomElement;
|
||||||
|
|
||||||
void LabelTagToV0_4_4(const QString &tagName);
|
void LabelTagToV0_4_4(const QString &tagName);
|
||||||
|
|
||||||
QDomElement AddTagPatternLabelV0_5_1();
|
auto AddTagPatternLabelV0_5_1() -> QDomElement;
|
||||||
void PortPatternLabeltoV0_6_0(QDomElement &label);
|
void PortPatternLabeltoV0_6_0(QDomElement &label);
|
||||||
void AddLabelTemplateLineV0_6_0(QDomElement &label, const QString &text, bool bold, bool italic, int alignment,
|
void AddLabelTemplateLineV0_6_0(QDomElement &label, const QString &text, bool bold, bool italic, int alignment,
|
||||||
int fontSizeIncrement);
|
int fontSizeIncrement);
|
||||||
|
@ -155,25 +155,25 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline unsigned VPatternConverter::MinVer() const
|
inline auto VPatternConverter::MinVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return PatternMinVer;
|
return PatternMinVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline unsigned VPatternConverter::MaxVer() const
|
inline auto VPatternConverter::MaxVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return PatternMaxVer;
|
return PatternMaxVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VPatternConverter::MinVerStr() const
|
inline auto VPatternConverter::MinVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return PatternMinVerStr;
|
return PatternMinVerStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VPatternConverter::MaxVerStr() const
|
inline auto VPatternConverter::MaxVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return PatternMaxVerStr;
|
return PatternMaxVerStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ VToolRecord::VToolRecord(const quint32 &id, const Tool &typeTool, const QString
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VToolRecord &VToolRecord::operator=(const VToolRecord &record)
|
auto VToolRecord::operator=(const VToolRecord &record) -> VToolRecord &
|
||||||
{
|
{
|
||||||
if ( &record == this )
|
if ( &record == this )
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ VToolRecord::VToolRecord(const VToolRecord &record)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VToolRecord::IsMandatory() const
|
auto VToolRecord::IsMandatory() const -> bool
|
||||||
{
|
{
|
||||||
return typeTool != Tool::Pin
|
return typeTool != Tool::Pin
|
||||||
&& typeTool != Tool::NodePoint
|
&& typeTool != Tool::NodePoint
|
||||||
|
|
|
@ -42,21 +42,21 @@ class VToolRecord
|
||||||
public:
|
public:
|
||||||
VToolRecord();
|
VToolRecord();
|
||||||
VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw);
|
VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw);
|
||||||
bool operator==(const VToolRecord &record) const;
|
auto operator==(const VToolRecord &record) const -> bool;
|
||||||
VToolRecord &operator=(const VToolRecord &record);
|
auto operator=(const VToolRecord &record) -> VToolRecord &;
|
||||||
VToolRecord(const VToolRecord &record);
|
VToolRecord(const VToolRecord &record);
|
||||||
~VToolRecord() = default;
|
~VToolRecord() = default;
|
||||||
|
|
||||||
quint32 getId() const;
|
auto getId() const -> quint32;
|
||||||
void setId(const quint32 &value);
|
void setId(const quint32 &value);
|
||||||
|
|
||||||
Tool getTypeTool() const;
|
auto getTypeTool() const -> Tool;
|
||||||
void setTypeTool(const Tool &value);
|
void setTypeTool(const Tool &value);
|
||||||
|
|
||||||
QString getNameDraw() const;
|
auto getNameDraw() const -> QString;
|
||||||
void setNameDraw(const QString &value);
|
void setNameDraw(const QString &value);
|
||||||
|
|
||||||
bool IsMandatory() const;
|
auto IsMandatory() const -> bool;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** @brief id tool id. */
|
/** @brief id tool id. */
|
||||||
|
@ -74,7 +74,7 @@ private:
|
||||||
* @brief getId return tool id.
|
* @brief getId return tool id.
|
||||||
* @return id.
|
* @return id.
|
||||||
*/
|
*/
|
||||||
inline quint32 VToolRecord::getId() const
|
inline auto VToolRecord::getId() const -> quint32
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ inline void VToolRecord::setId(const quint32 &value)
|
||||||
* @brief getTypeTool return tool type.
|
* @brief getTypeTool return tool type.
|
||||||
* @return tool type.
|
* @return tool type.
|
||||||
*/
|
*/
|
||||||
inline Tool VToolRecord::getTypeTool() const
|
inline auto VToolRecord::getTypeTool() const -> Tool
|
||||||
{
|
{
|
||||||
return typeTool;
|
return typeTool;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ inline void VToolRecord::setTypeTool(const Tool &value)
|
||||||
* @brief getNameDraw return pattern peace name.
|
* @brief getNameDraw return pattern peace name.
|
||||||
* @return pattern peace name.
|
* @return pattern peace name.
|
||||||
*/
|
*/
|
||||||
inline QString VToolRecord::getNameDraw() const
|
inline auto VToolRecord::getNameDraw() const -> QString
|
||||||
{
|
{
|
||||||
return nameDraw;
|
return nameDraw;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ inline void VToolRecord::setNameDraw(const QString &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline bool VToolRecord::operator==(const VToolRecord &record) const
|
inline auto VToolRecord::operator==(const VToolRecord &record) const -> bool
|
||||||
{
|
{
|
||||||
// Id should be enough
|
// Id should be enough
|
||||||
return id == record.getId()/* && typeTool == record.getTypeTool() && nameDraw == record.getNameDraw()*/;
|
return id == record.getId()/* && typeTool == record.getTypeTool() && nameDraw == record.getNameDraw()*/;
|
||||||
|
|
|
@ -136,7 +136,7 @@ void VVITConverter::DowngradeToCurrentMaxVersion()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool VVITConverter::IsReadOnly() const
|
auto VVITConverter::IsReadOnly() const -> bool
|
||||||
{
|
{
|
||||||
// Check if attribute read-only was not changed in file format
|
// Check if attribute read-only was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == FormatVersion(0, 5, 2),
|
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMaxVer == FormatVersion(0, 5, 2),
|
||||||
|
@ -172,7 +172,7 @@ void VVITConverter::AddNewTagsForV0_3_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VVITConverter::MUnitV0_2_0()
|
auto VVITConverter::MUnitV0_2_0() -> QString
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.3.0
|
// TODO. Delete if minimal supported version is 0.3.0
|
||||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||||
|
@ -194,7 +194,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_0()
|
||||||
|
|
||||||
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
|
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
|
||||||
const QList<QString> keys = names.uniqueKeys();
|
const QList<QString> keys = names.uniqueKeys();
|
||||||
for (auto &key : keys)
|
for (const auto &key : keys)
|
||||||
{
|
{
|
||||||
qreal resValue = 0;
|
qreal resValue = 0;
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ void VVITConverter::ConvertMeasurementsToV0_3_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VVITConverter::AddMV0_3_0(const QString &name, qreal value)
|
auto VVITConverter::AddMV0_3_0(const QString &name, qreal value) -> QDomElement
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.3.0
|
// TODO. Delete if minimal supported version is 0.3.0
|
||||||
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),
|
||||||
|
|
|
@ -54,15 +54,15 @@ public:
|
||||||
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual unsigned MinVer() const override;
|
virtual auto MinVer() const -> unsigned override;
|
||||||
virtual unsigned MaxVer() const override;
|
virtual auto MaxVer() const -> unsigned override;
|
||||||
|
|
||||||
virtual QString MinVerStr() const override;
|
virtual auto MinVerStr() const -> QString override;
|
||||||
virtual QString MaxVerStr() const override;
|
virtual auto MaxVerStr() const -> QString override;
|
||||||
|
|
||||||
virtual void ApplyPatches() override;
|
virtual void ApplyPatches() override;
|
||||||
virtual void DowngradeToCurrentMaxVersion() override;
|
virtual void DowngradeToCurrentMaxVersion() override;
|
||||||
virtual bool IsReadOnly() const override;
|
virtual auto IsReadOnly() const -> bool override;
|
||||||
|
|
||||||
auto Schemas() const -> QHash <unsigned, QString> override;
|
auto Schemas() const -> QHash <unsigned, QString> override;
|
||||||
|
|
||||||
|
@ -71,9 +71,9 @@ private:
|
||||||
static const QString MeasurementMinVerStr;
|
static const QString MeasurementMinVerStr;
|
||||||
|
|
||||||
void AddNewTagsForV0_3_0();
|
void AddNewTagsForV0_3_0();
|
||||||
QString MUnitV0_2_0();
|
auto MUnitV0_2_0() -> QString;
|
||||||
void ConvertMeasurementsToV0_3_0();
|
void ConvertMeasurementsToV0_3_0();
|
||||||
QDomElement AddMV0_3_0(const QString &name, qreal value);
|
auto AddMV0_3_0(const QString &name, qreal value) -> QDomElement;
|
||||||
void GenderV0_3_1();
|
void GenderV0_3_1();
|
||||||
void PM_SystemV0_3_2();
|
void PM_SystemV0_3_2();
|
||||||
void ConvertMeasurementsToV0_3_3();
|
void ConvertMeasurementsToV0_3_3();
|
||||||
|
@ -88,25 +88,25 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline unsigned VVITConverter::MinVer() const
|
inline auto VVITConverter::MinVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return MeasurementMinVer;
|
return MeasurementMinVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline unsigned VVITConverter::MaxVer() const
|
inline auto VVITConverter::MaxVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return MeasurementMaxVer;
|
return MeasurementMaxVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VVITConverter::MinVerStr() const
|
inline auto VVITConverter::MinVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return MeasurementMinVerStr;
|
return MeasurementMinVerStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VVITConverter::MaxVerStr() const
|
inline auto VVITConverter::MaxVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return MeasurementMaxVerStr;
|
return MeasurementMaxVerStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,7 +209,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
|
||||||
|
|
||||||
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
|
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
|
||||||
const QList<QString> keys = names.uniqueKeys();
|
const QList<QString> keys = names.uniqueKeys();
|
||||||
for (auto &key : keys)
|
for (const auto &key : keys)
|
||||||
{
|
{
|
||||||
qreal resValue = 0;
|
qreal resValue = 0;
|
||||||
qreal resSizeIncrease = 0;
|
qreal resSizeIncrease = 0;
|
||||||
|
@ -247,7 +247,8 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QDomElement VVSTConverter::AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease)
|
auto VVSTConverter::AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease)
|
||||||
|
-> QDomElement
|
||||||
{
|
{
|
||||||
// TODO. Delete if minimal supported version is 0.4.0
|
// TODO. Delete if minimal supported version is 0.4.0
|
||||||
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),
|
||||||
|
|
|
@ -54,15 +54,15 @@ public:
|
||||||
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual unsigned MinVer() const override;
|
virtual auto MinVer() const -> unsigned override;
|
||||||
virtual unsigned MaxVer() const override;
|
virtual auto MaxVer() const -> unsigned override;
|
||||||
|
|
||||||
virtual QString MinVerStr() const override;
|
virtual auto MinVerStr() const -> QString override;
|
||||||
virtual QString MaxVerStr() const override;
|
virtual auto MaxVerStr() const -> QString override;
|
||||||
|
|
||||||
virtual void ApplyPatches() override;
|
virtual void ApplyPatches() override;
|
||||||
virtual void DowngradeToCurrentMaxVersion() override;
|
virtual void DowngradeToCurrentMaxVersion() override;
|
||||||
virtual bool IsReadOnly() const override;
|
virtual auto IsReadOnly() const -> bool override;
|
||||||
|
|
||||||
auto Schemas() const -> QHash <unsigned, QString> override;
|
auto Schemas() const -> QHash <unsigned, QString> override;
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
void AddNewTagsForV0_4_0();
|
void AddNewTagsForV0_4_0();
|
||||||
void RemoveTagsForV0_4_0();
|
void RemoveTagsForV0_4_0();
|
||||||
void ConvertMeasurementsToV0_4_0();
|
void ConvertMeasurementsToV0_4_0();
|
||||||
QDomElement AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease);
|
auto AddMV0_4_0(const QString &name, qreal value, qreal sizeIncrease, qreal heightIncrease) -> QDomElement;
|
||||||
void PM_SystemV0_4_1();
|
void PM_SystemV0_4_1();
|
||||||
void ConvertMeasurementsToV0_4_2();
|
void ConvertMeasurementsToV0_4_2();
|
||||||
|
|
||||||
|
@ -91,25 +91,25 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline unsigned VVSTConverter::MinVer() const
|
inline auto VVSTConverter::MinVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return MeasurementMinVer;
|
return MeasurementMinVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline unsigned VVSTConverter::MaxVer() const
|
inline auto VVSTConverter::MaxVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return MeasurementMaxVer;
|
return MeasurementMaxVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VVSTConverter::MinVerStr() const
|
inline auto VVSTConverter::MinVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return MeasurementMinVerStr;
|
return MeasurementMinVerStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString VVSTConverter::MaxVerStr() const
|
inline auto VVSTConverter::MaxVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return MeasurementMaxVerStr;
|
return MeasurementMaxVerStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,25 +65,25 @@ auto VWatermarkConverter::XSDSchemas() -> QHash<unsigned int, QString>
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
unsigned VWatermarkConverter::MinVer() const
|
auto VWatermarkConverter::MinVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return WatermarkMinVer;
|
return WatermarkMinVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
unsigned VWatermarkConverter::MaxVer() const
|
auto VWatermarkConverter::MaxVer() const -> unsigned
|
||||||
{
|
{
|
||||||
return WatermarkMaxVer;
|
return WatermarkMaxVer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VWatermarkConverter::MinVerStr() const
|
auto VWatermarkConverter::MinVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return WatermarkMinVerStr;
|
return WatermarkMinVerStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString VWatermarkConverter::MaxVerStr() const
|
auto VWatermarkConverter::MaxVerStr() const -> QString
|
||||||
{
|
{
|
||||||
return WatermarkMaxVerStr;
|
return WatermarkMaxVerStr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,16 +45,16 @@ public:
|
||||||
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
static auto XSDSchemas() -> QHash <unsigned, QString>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual unsigned MinVer() const override;
|
virtual auto MinVer() const -> unsigned override;
|
||||||
virtual unsigned MaxVer() const override;
|
virtual auto MaxVer() const -> unsigned override;
|
||||||
|
|
||||||
virtual QString MinVerStr() const override;
|
virtual auto MinVerStr() const -> QString override;
|
||||||
virtual QString MaxVerStr() const override;
|
virtual auto MaxVerStr() const -> QString override;
|
||||||
|
|
||||||
virtual void ApplyPatches() override;
|
virtual void ApplyPatches() override;
|
||||||
virtual void DowngradeToCurrentMaxVersion() override;
|
virtual void DowngradeToCurrentMaxVersion() override;
|
||||||
|
|
||||||
virtual bool IsReadOnly() const override {return false;}
|
virtual auto IsReadOnly() const -> bool override { return false; }
|
||||||
|
|
||||||
auto Schemas() const -> QHash <unsigned, QString> override;
|
auto Schemas() const -> QHash <unsigned, QString> override;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum InputToken
|
||||||
static const QChar QmuEOF = QChar(static_cast<ushort>(0xffff)); //guaranteed not to be a character.
|
static const QChar QmuEOF = QChar(static_cast<ushort>(0xffff)); //guaranteed not to be a character.
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
static QChar GetChar(const QString &formula, int &index)
|
static auto GetChar(const QString &formula, int &index) -> QChar
|
||||||
{
|
{
|
||||||
if (index >= formula.size())
|
if (index >= formula.size())
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ static QChar GetChar(const QString &formula, int &index)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
static QChar EatWhiteSpace(const QString &formula, int &index)
|
static auto EatWhiteSpace(const QString &formula, int &index) -> QChar
|
||||||
{
|
{
|
||||||
QChar c;
|
QChar c;
|
||||||
do
|
do
|
||||||
|
@ -74,7 +74,7 @@ static QChar EatWhiteSpace(const QString &formula, int &index)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
static int CheckChar(QChar &c, const QLocale &locale, const QChar &decimal, const QChar &thousand)
|
static auto CheckChar(QChar &c, const QLocale &locale, const QChar &decimal, const QChar &thousand) -> int
|
||||||
{
|
{
|
||||||
INIT_LOCALE_VARIABLES(locale);
|
INIT_LOCALE_VARIABLES(locale);
|
||||||
Q_UNUSED(decimalPoint)
|
Q_UNUSED(decimalPoint)
|
||||||
|
@ -167,8 +167,8 @@ static int CheckChar(QChar &c, const QLocale &locale, const QChar &decimal, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal,
|
auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal, const QChar &thousand)
|
||||||
const QChar &thousand)
|
-> qmusizetype
|
||||||
{
|
{
|
||||||
// Must not be equal
|
// Must not be equal
|
||||||
if (decimal == thousand || formula.isEmpty())
|
if (decimal == thousand || formula.isEmpty())
|
||||||
|
@ -279,7 +279,7 @@ qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale, c
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString NameRegExp()
|
auto NameRegExp() -> QString
|
||||||
{
|
{
|
||||||
static QString regex;
|
static QString regex;
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ QString NameRegExp()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qmusizetype FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos)
|
auto FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos) -> qmusizetype
|
||||||
{
|
{
|
||||||
qmusizetype chPos = pos;
|
qmusizetype chPos = pos;
|
||||||
QString::const_iterator it = string.constBegin() + pos;
|
QString::const_iterator it = string.constBegin() + pos;
|
||||||
|
@ -353,7 +353,7 @@ qmusizetype FindFirstNotOf(const QString &string, const QString &chars, qmusizet
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool SupportedLocale(const QLocale &locale)
|
auto SupportedLocale(const QLocale &locale) -> bool
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
return locale.positiveSign().size() == 1 &&
|
return locale.positiveSign().size() == 1 &&
|
||||||
|
@ -378,7 +378,7 @@ bool SupportedLocale(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocalePositiveSign(const QLocale &locale)
|
auto LocalePositiveSign(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
const QString sign = locale.positiveSign();
|
const QString sign = locale.positiveSign();
|
||||||
|
@ -394,7 +394,7 @@ QChar LocalePositiveSign(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleNegativeSign(const QLocale &locale)
|
auto LocaleNegativeSign(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
const QString sign = locale.negativeSign();
|
const QString sign = locale.negativeSign();
|
||||||
|
@ -410,7 +410,7 @@ QChar LocaleNegativeSign(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign0(const QLocale &locale)
|
auto LocaleSign0(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(0);
|
const QString sign = locale.toString(0);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -430,7 +430,7 @@ QChar LocaleSign0(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign1(const QLocale &locale)
|
auto LocaleSign1(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(1);
|
const QString sign = locale.toString(1);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -450,7 +450,7 @@ QChar LocaleSign1(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign2(const QLocale &locale)
|
auto LocaleSign2(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(2);
|
const QString sign = locale.toString(2);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -470,7 +470,7 @@ QChar LocaleSign2(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign3(const QLocale &locale)
|
auto LocaleSign3(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(3);
|
const QString sign = locale.toString(3);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -490,7 +490,7 @@ QChar LocaleSign3(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign4(const QLocale &locale)
|
auto LocaleSign4(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(4);
|
const QString sign = locale.toString(4);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -510,7 +510,7 @@ QChar LocaleSign4(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign5(const QLocale &locale)
|
auto LocaleSign5(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(5);
|
const QString sign = locale.toString(5);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -530,7 +530,7 @@ QChar LocaleSign5(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign6(const QLocale &locale)
|
auto LocaleSign6(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(6);
|
const QString sign = locale.toString(6);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -550,7 +550,7 @@ QChar LocaleSign6(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign7(const QLocale &locale)
|
auto LocaleSign7(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(7);
|
const QString sign = locale.toString(7);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -570,7 +570,7 @@ QChar LocaleSign7(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign8(const QLocale &locale)
|
auto LocaleSign8(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(8);
|
const QString sign = locale.toString(8);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -590,7 +590,7 @@ QChar LocaleSign8(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleSign9(const QLocale &locale)
|
auto LocaleSign9(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
const QString sign = locale.toString(9);
|
const QString sign = locale.toString(9);
|
||||||
if (sign.size() == 1)
|
if (sign.size() == 1)
|
||||||
|
@ -610,7 +610,7 @@ QChar LocaleSign9(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleExpUpper(const QLocale &locale)
|
auto LocaleExpUpper(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
const QString sign = locale.exponential();
|
const QString sign = locale.exponential();
|
||||||
|
@ -626,7 +626,7 @@ QChar LocaleExpUpper(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleExpLower(const QLocale &locale)
|
auto LocaleExpLower(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
const QString sign = locale.exponential();
|
const QString sign = locale.exponential();
|
||||||
|
@ -642,7 +642,7 @@ QChar LocaleExpLower(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleDecimalPoint(const QLocale &locale)
|
auto LocaleDecimalPoint(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
const QString sign = locale.decimalPoint();
|
const QString sign = locale.decimalPoint();
|
||||||
|
@ -658,7 +658,7 @@ QChar LocaleDecimalPoint(const QLocale &locale)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar LocaleGroupSeparator(const QLocale &locale)
|
auto LocaleGroupSeparator(const QLocale &locale) -> QChar
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
const QString sign = locale.groupSeparator();
|
const QString sign = locale.groupSeparator();
|
||||||
|
|
|
@ -143,12 +143,12 @@ const QChar expLower = LocaleExpLower((locale)); \
|
||||||
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
|
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
|
||||||
const QChar groupSeparator = LocaleGroupSeparator((locale));
|
const QChar groupSeparator = LocaleGroupSeparator((locale));
|
||||||
|
|
||||||
QMUPARSERSHARED_EXPORT QString NameRegExp();
|
QMUPARSERSHARED_EXPORT auto NameRegExp() -> QString;
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
Q_REQUIRED_RESULT static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2);
|
Q_REQUIRED_RESULT static inline auto QmuFuzzyComparePossibleNulls(double p1, double p2) -> bool;
|
||||||
static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
|
static inline auto QmuFuzzyComparePossibleNulls(double p1, double p2) -> bool
|
||||||
{
|
{
|
||||||
if(qFuzzyIsNull(p1))
|
if(qFuzzyIsNull(p1))
|
||||||
{
|
{
|
||||||
|
@ -163,9 +163,10 @@ static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
|
||||||
return qFuzzyCompare(p1, p2);
|
return qFuzzyCompare(p1, p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMUPARSERSHARED_EXPORT qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale,
|
QMUPARSERSHARED_EXPORT auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal,
|
||||||
const QChar &decimal, const QChar &thousand);
|
const QChar &thousand) -> qmusizetype;
|
||||||
|
|
||||||
QMUPARSERSHARED_EXPORT qmusizetype FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos = 0);
|
QMUPARSERSHARED_EXPORT auto FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos = 0)
|
||||||
|
-> qmusizetype;
|
||||||
|
|
||||||
#endif // QMUDEF_H
|
#endif // QMUDEF_H
|
||||||
|
|
|
@ -123,7 +123,7 @@ void QmuFormulaBase::InitCharSets()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// Factory function for creating new parser variables
|
// Factory function for creating new parser variables
|
||||||
// This could as well be a function performing database queries.
|
// This could as well be a function performing database queries.
|
||||||
qreal *QmuFormulaBase::AddVariable(const QString &a_szName, void *a_pUserData)
|
auto QmuFormulaBase::AddVariable(const QString &a_szName, void *a_pUserData) -> qreal *
|
||||||
{
|
{
|
||||||
Q_UNUSED(a_szName)
|
Q_UNUSED(a_szName)
|
||||||
Q_UNUSED(a_pUserData)
|
Q_UNUSED(a_pUserData)
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
static void RemoveAll(QMap<vsizetype, QString> &map, const QString &val);
|
static void RemoveAll(QMap<vsizetype, QString> &map, const QString &val);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static qreal* AddVariable(const QString &a_szName, void *a_pUserData);
|
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
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace
|
||||||
* @param arcLength length of arc that create two pieces after rotation
|
* @param arcLength length of arc that create two pieces after rotation
|
||||||
* @return an angle the second piece should be rotated
|
* @return an angle the second piece should be rotated
|
||||||
*/
|
*/
|
||||||
qreal CSR(qreal length, qreal split, qreal arcLength)
|
auto CSR(qreal length, qreal split, qreal arcLength) -> qreal
|
||||||
{
|
{
|
||||||
length = qAbs(length);
|
length = qAbs(length);
|
||||||
arcLength = qAbs(arcLength);
|
arcLength = qAbs(arcLength);
|
||||||
|
@ -130,85 +130,85 @@ namespace qmu
|
||||||
{
|
{
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// Trigonometric function
|
// Trigonometric function
|
||||||
qreal QmuParser::DegreeToRadian(qreal deg)
|
auto QmuParser::DegreeToRadian(qreal deg) -> qreal
|
||||||
{
|
{
|
||||||
return qDegreesToRadians(deg);
|
return qDegreesToRadians(deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::RadianToDegree(qreal rad)
|
auto QmuParser::RadianToDegree(qreal rad) -> qreal
|
||||||
{
|
{
|
||||||
return qRadiansToDegrees(rad);
|
return qRadiansToDegrees(rad);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::Sinh(qreal v)
|
auto QmuParser::Sinh(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return sinh(v);
|
return sinh(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::ASinh(qreal v)
|
auto QmuParser::ASinh(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return log(v + qSqrt(v * v + 1));
|
return log(v + qSqrt(v * v + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::Cosh(qreal v)
|
auto QmuParser::Cosh(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return cosh(v);
|
return cosh(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::ACosh(qreal v)
|
auto QmuParser::ACosh(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return log(v + qSqrt(v * v - 1));
|
return log(v + qSqrt(v * v - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::Tanh(qreal v)
|
auto QmuParser::Tanh(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return tanh(v);
|
return tanh(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::ATanh(qreal v)
|
auto QmuParser::ATanh(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return (0.5 * log((1 + v) / (1 - v)));
|
return (0.5 * log((1 + v) / (1 - v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::SinD(qreal v)
|
auto QmuParser::SinD(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qSin(qDegreesToRadians(v));
|
return qSin(qDegreesToRadians(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::ASinD(qreal v)
|
auto QmuParser::ASinD(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qRadiansToDegrees(qAsin(v));
|
return qRadiansToDegrees(qAsin(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::CosD(qreal v)
|
auto QmuParser::CosD(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qCos(qDegreesToRadians(v));
|
return qCos(qDegreesToRadians(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::ACosD(qreal v)
|
auto QmuParser::ACosD(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qRadiansToDegrees(qAcos(v));
|
return qRadiansToDegrees(qAcos(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::TanD(qreal v)
|
auto QmuParser::TanD(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qTan(qDegreesToRadians(v));
|
return qTan(qDegreesToRadians(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::ATanD(qreal v)
|
auto QmuParser::ATanD(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qRadiansToDegrees(qAtan(v));
|
return qRadiansToDegrees(qAtan(v));
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ qreal QmuParser::ATanD(qreal v)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// Logarithm base 2
|
// Logarithm base 2
|
||||||
qreal QmuParser::Log2(qreal v)
|
auto QmuParser::Log2(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
#ifdef MUP_MATH_EXCEPTIONS
|
#ifdef MUP_MATH_EXCEPTIONS
|
||||||
if (v<=0)
|
if (v<=0)
|
||||||
|
@ -231,7 +231,7 @@ qreal QmuParser::Log2(qreal v)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// Logarithm base 10
|
// Logarithm base 10
|
||||||
qreal QmuParser::Log10(qreal v)
|
auto QmuParser::Log10(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
#ifdef MUP_MATH_EXCEPTIONS
|
#ifdef MUP_MATH_EXCEPTIONS
|
||||||
if (v<=0)
|
if (v<=0)
|
||||||
|
@ -244,25 +244,25 @@ qreal QmuParser::Log10(qreal v)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// misc
|
// misc
|
||||||
qreal QmuParser::Abs(qreal v)
|
auto QmuParser::Abs(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qAbs(v);
|
return qAbs(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::Rint(qreal v)
|
auto QmuParser::Rint(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return qFloor(v + 0.5);
|
return qFloor(v + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::R2CM(qreal v)
|
auto QmuParser::R2CM(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return Rint(v*10.0)/10.0;
|
return Rint(v*10.0)/10.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::CSRCm(qreal length, qreal split, qreal arcLength)
|
auto QmuParser::CSRCm(qreal length, qreal split, qreal arcLength) -> qreal
|
||||||
{
|
{
|
||||||
length = ((length * 10.0) / 25.4) * PrintDPI;
|
length = ((length * 10.0) / 25.4) * PrintDPI;
|
||||||
split = ((split * 10.0) / 25.4) * PrintDPI;
|
split = ((split * 10.0) / 25.4) * PrintDPI;
|
||||||
|
@ -272,7 +272,7 @@ qreal QmuParser::CSRCm(qreal length, qreal split, qreal arcLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::CSRInch(qreal length, qreal split, qreal arcLength)
|
auto QmuParser::CSRInch(qreal length, qreal split, qreal arcLength) -> qreal
|
||||||
{
|
{
|
||||||
length = length * PrintDPI;
|
length = length * PrintDPI;
|
||||||
split = split * PrintDPI;
|
split = split * PrintDPI;
|
||||||
|
@ -282,13 +282,13 @@ qreal QmuParser::CSRInch(qreal length, qreal split, qreal arcLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::Sign(qreal v)
|
auto QmuParser::Sign(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return ((v<0) ? -1 : (v>0) ? 1 : 0);
|
return ((v<0) ? -1 : (v>0) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuParser::FMod(qreal number, qreal denom)
|
auto QmuParser::FMod(qreal number, qreal denom) -> qreal
|
||||||
{
|
{
|
||||||
return fmod(number, denom);
|
return fmod(number, denom);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ qreal QmuParser::FMod(qreal number, qreal denom)
|
||||||
* @param [in] a_afArg Vector with the function arguments
|
* @param [in] a_afArg Vector with the function arguments
|
||||||
* @param [in] a_iArgc The size of a_afArg
|
* @param [in] a_iArgc The size of a_afArg
|
||||||
*/
|
*/
|
||||||
qreal QmuParser::Sum(const qreal *a_afArg, qmusizetype a_iArgc)
|
auto QmuParser::Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if (a_iArgc == 0)
|
if (a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -320,7 +320,7 @@ qreal QmuParser::Sum(const qreal *a_afArg, qmusizetype a_iArgc)
|
||||||
* @param [in] a_afArg Vector with the function arguments
|
* @param [in] a_afArg Vector with the function arguments
|
||||||
* @param [in] a_iArgc The size of a_afArg
|
* @param [in] a_iArgc The size of a_afArg
|
||||||
*/
|
*/
|
||||||
qreal QmuParser::Avg(const qreal *a_afArg, qmusizetype a_iArgc)
|
auto QmuParser::Avg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if (a_iArgc == 0)
|
if (a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -341,7 +341,7 @@ qreal QmuParser::Avg(const qreal *a_afArg, qmusizetype a_iArgc)
|
||||||
* @param [in] a_afArg Vector with the function arguments
|
* @param [in] a_afArg Vector with the function arguments
|
||||||
* @param [in] a_iArgc The size of a_afArg
|
* @param [in] a_iArgc The size of a_afArg
|
||||||
*/
|
*/
|
||||||
qreal QmuParser::Min(const qreal *a_afArg, qmusizetype a_iArgc)
|
auto QmuParser::Min(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if (a_iArgc == 0)
|
if (a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -362,7 +362,7 @@ qreal QmuParser::Min(const qreal *a_afArg, qmusizetype a_iArgc)
|
||||||
* @param [in] a_afArg Vector with the function arguments
|
* @param [in] a_afArg Vector with the function arguments
|
||||||
* @param [in] a_iArgc The size of a_afArg
|
* @param [in] a_iArgc The size of a_afArg
|
||||||
*/
|
*/
|
||||||
qreal QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc)
|
auto QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if (a_iArgc == 0)
|
if (a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -385,8 +385,8 @@ qreal QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc)
|
||||||
* @param [out] a_fVal Pointer where the value should be stored in case one is found.
|
* @param [out] a_fVal Pointer where the value should be stored in case one is found.
|
||||||
* @return 1 if a value was found 0 otherwise.
|
* @return 1 if a value was found 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
|
auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
|
||||||
const QChar &decimal, const QChar &thousand)
|
const QChar &decimal, const QChar &thousand) -> int
|
||||||
{
|
{
|
||||||
qreal fVal(0);
|
qreal fVal(0);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ void QmuParser::OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizety
|
||||||
* http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843
|
* http://sourceforge.net/forum/forum.php?thread_id=1994611&forum_id=462843
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
qreal QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const
|
auto QmuParser::Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon) const -> qreal
|
||||||
{
|
{
|
||||||
qreal fRes(0),
|
qreal fRes(0),
|
||||||
fBuf(*a_Var),
|
fBuf(*a_Var),
|
||||||
|
|
|
@ -59,47 +59,48 @@ namespace qmu
|
||||||
virtual void InitConst() override;
|
virtual void InitConst() override;
|
||||||
virtual void InitOprt() override;
|
virtual void InitOprt() override;
|
||||||
virtual void OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd) override;
|
virtual void OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd) override;
|
||||||
qreal Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const;
|
auto Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const -> qreal;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static int 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, const QChar &decimal, const QChar &thousand);
|
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int;
|
||||||
// hyperbolic functions
|
// hyperbolic functions
|
||||||
static qreal Sinh(qreal);
|
static auto Sinh(qreal) -> qreal;
|
||||||
static qreal Cosh(qreal);
|
static auto Cosh(qreal) -> qreal;
|
||||||
static qreal Tanh(qreal);
|
static auto Tanh(qreal) -> qreal;
|
||||||
// arcus hyperbolic functions
|
// arcus hyperbolic functions
|
||||||
static qreal ASinh(qreal);
|
static auto ASinh(qreal) -> qreal;
|
||||||
static qreal ACosh(qreal);
|
static auto ACosh(qreal) -> qreal;
|
||||||
static qreal ATanh(qreal);
|
static auto ATanh(qreal) -> qreal;
|
||||||
// functions working with degrees
|
// functions working with degrees
|
||||||
static qreal DegreeToRadian(qreal);
|
static auto DegreeToRadian(qreal) -> qreal;
|
||||||
static qreal RadianToDegree(qreal);
|
static auto RadianToDegree(qreal) -> qreal;
|
||||||
static qreal SinD(qreal);
|
static auto SinD(qreal) -> qreal;
|
||||||
static qreal CosD(qreal);
|
static auto CosD(qreal) -> qreal;
|
||||||
static qreal TanD(qreal);
|
static auto TanD(qreal) -> qreal;
|
||||||
static qreal ASinD(qreal);
|
static auto ASinD(qreal) -> qreal;
|
||||||
static qreal ACosD(qreal);
|
static auto ACosD(qreal) -> qreal;
|
||||||
static qreal ATanD(qreal);
|
static auto ATanD(qreal) -> qreal;
|
||||||
|
|
||||||
// Logarithm functions
|
// Logarithm functions
|
||||||
static qreal Log2(qreal); // Logarithm Base 2
|
static auto Log2(qreal) -> qreal; // Logarithm Base 2
|
||||||
static qreal Log10(qreal); // Logarithm Base 10
|
static auto Log10(qreal) -> qreal; // Logarithm Base 10
|
||||||
// misc
|
// misc
|
||||||
static qreal Abs(qreal);
|
static auto Abs(qreal) -> qreal;
|
||||||
static qreal Rint(qreal);
|
static auto Rint(qreal) -> qreal;
|
||||||
static qreal R2CM(qreal);
|
static auto R2CM(qreal) -> qreal;
|
||||||
static qreal CSRCm(qreal length, qreal split, qreal arcLength);
|
static auto CSRCm(qreal length, qreal split, qreal arcLength) -> qreal;
|
||||||
static qreal CSRInch(qreal length, qreal split, qreal arcLength);
|
static auto CSRInch(qreal length, qreal split, qreal arcLength) -> qreal;
|
||||||
static qreal Sign(qreal);
|
static auto Sign(qreal) -> qreal;
|
||||||
static qreal FMod(qreal, qreal);
|
static auto FMod(qreal, qreal) -> qreal;
|
||||||
// Prefix operators
|
// Prefix operators
|
||||||
// !!! Unary Minus is a MUST if you want to use negative signs !!!
|
// !!! Unary Minus is a MUST if you want to use negative signs !!!
|
||||||
static qreal UnaryMinus(qreal v);
|
static auto UnaryMinus(qreal v) -> qreal;
|
||||||
// Functions with variable number of arguments
|
// Functions with variable number of arguments
|
||||||
static qreal Sum(const qreal*, qmusizetype); // sum
|
static auto Sum(const qreal *, qmusizetype) -> qreal; // sum
|
||||||
static qreal Avg(const qreal*, qmusizetype); // mean value
|
static auto Avg(const qreal *, qmusizetype) -> qreal; // mean value
|
||||||
static qreal Min(const qreal*, qmusizetype); // minimum
|
static auto Min(const qreal *, qmusizetype) -> qreal; // minimum
|
||||||
static qreal Max(const qreal*, qmusizetype); // maximum
|
static auto Max(const qreal *, qmusizetype) -> qreal; // maximum
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
@ -110,9 +111,9 @@ namespace qmu
|
||||||
* @param v The value to negate
|
* @param v The value to negate
|
||||||
* @return -v
|
* @return -v
|
||||||
*/
|
*/
|
||||||
inline qreal QmuParser::UnaryMinus(qreal v)
|
inline auto QmuParser::UnaryMinus(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
return -v;
|
return -v;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace qmu
|
} // namespace qmu
|
||||||
|
|
|
@ -146,7 +146,7 @@ QmuParserBase::~QmuParserBase()
|
||||||
* @return *this
|
* @return *this
|
||||||
* @throw nothrow
|
* @throw nothrow
|
||||||
*/
|
*/
|
||||||
QmuParserBase& QmuParserBase::operator=(const QmuParserBase &a_Parser)
|
auto QmuParserBase::operator=(const QmuParserBase &a_Parser) -> QmuParserBase &
|
||||||
{
|
{
|
||||||
if (this != &a_Parser)
|
if (this != &a_Parser)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,7 @@ void QmuParserBase::setAllowSubexpressions(bool value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QLocale QmuParserBase::getLocale() const
|
auto QmuParserBase::getLocale() const -> QLocale
|
||||||
{
|
{
|
||||||
return m_locale;
|
return m_locale;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ void QmuParserBase::setLocale(const QLocale &value)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar QmuParserBase::getDecimalPoint() const
|
auto QmuParserBase::getDecimalPoint() const -> QChar
|
||||||
{
|
{
|
||||||
return m_decimalPoint;
|
return m_decimalPoint;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ void QmuParserBase::setDecimalPoint(const QChar &c)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QChar QmuParserBase::getThousandsSeparator() const
|
auto QmuParserBase::getThousandsSeparator() const -> QChar
|
||||||
{
|
{
|
||||||
return m_thousandsSeparator;
|
return m_thousandsSeparator;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ void QmuParserBase::setThousandsSeparator(const QChar &c)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
bool QmuParserBase::getCNumbers() const
|
auto QmuParserBase::getCNumbers() const -> bool
|
||||||
{
|
{
|
||||||
return m_cNumbers;
|
return m_cNumbers;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ void QmuParserBase::setCNumbers(bool cNumbers)
|
||||||
* Format is as follows: "MAJOR.MINOR (COMPILER_FLAGS)" The COMPILER_FLAGS are returned only if eInfo==pviFULL.
|
* Format is as follows: "MAJOR.MINOR (COMPILER_FLAGS)" The COMPILER_FLAGS are returned only if eInfo==pviFULL.
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
QString QmuParserBase::GetVersion(EParserVersionInfo eInfo)
|
auto QmuParserBase::GetVersion(EParserVersionInfo eInfo) -> QString
|
||||||
{
|
{
|
||||||
QString versionInfo;
|
QString versionInfo;
|
||||||
QTextStream ss(&versionInfo);
|
QTextStream ss(&versionInfo);
|
||||||
|
@ -464,7 +464,7 @@ void QmuParserBase::SetExpr(const QString &a_sExpr)
|
||||||
* @brief Virtual function that defines the characters allowed in name identifiers.
|
* @brief Virtual function that defines the characters allowed in name identifiers.
|
||||||
* @sa #ValidOprtChars, #ValidPrefixOprtChars
|
* @sa #ValidOprtChars, #ValidPrefixOprtChars
|
||||||
*/
|
*/
|
||||||
const QString& QmuParserBase::ValidNameChars() const
|
auto QmuParserBase::ValidNameChars() const -> const QString &
|
||||||
{
|
{
|
||||||
assert(m_sNameChars.size());
|
assert(m_sNameChars.size());
|
||||||
return m_sNameChars;
|
return m_sNameChars;
|
||||||
|
@ -475,7 +475,7 @@ const QString& QmuParserBase::ValidNameChars() const
|
||||||
* @brief Virtual function that defines the characters allowed in operator definitions.
|
* @brief Virtual function that defines the characters allowed in operator definitions.
|
||||||
* @sa #ValidNameChars, #ValidPrefixOprtChars
|
* @sa #ValidNameChars, #ValidPrefixOprtChars
|
||||||
*/
|
*/
|
||||||
const QString &QmuParserBase::ValidOprtChars() const
|
auto QmuParserBase::ValidOprtChars() const -> const QString &
|
||||||
{
|
{
|
||||||
assert(m_sOprtChars.size());
|
assert(m_sOprtChars.size());
|
||||||
return m_sOprtChars;
|
return m_sOprtChars;
|
||||||
|
@ -486,7 +486,7 @@ const QString &QmuParserBase::ValidOprtChars() const
|
||||||
* @brief Virtual function that defines the characters allowed in infix operator definitions.
|
* @brief Virtual function that defines the characters allowed in infix operator definitions.
|
||||||
* @sa #ValidNameChars, #ValidOprtChars
|
* @sa #ValidNameChars, #ValidOprtChars
|
||||||
*/
|
*/
|
||||||
const QString &QmuParserBase::ValidInfixOprtChars() const
|
auto QmuParserBase::ValidInfixOprtChars() const -> const QString &
|
||||||
{
|
{
|
||||||
assert(m_sInfixOprtChars.size());
|
assert(m_sInfixOprtChars.size());
|
||||||
return m_sInfixOprtChars;
|
return m_sInfixOprtChars;
|
||||||
|
@ -630,7 +630,7 @@ void QmuParserBase::DefineConst(const QString &a_sName, qreal a_fVal)
|
||||||
* @brief Get operator priority.
|
* @brief Get operator priority.
|
||||||
* @throw ParserException if a_Oprt is no operator code
|
* @throw ParserException if a_Oprt is no operator code
|
||||||
*/
|
*/
|
||||||
int QmuParserBase::GetOprtPrecedence(const token_type &a_Tok) const
|
auto QmuParserBase::GetOprtPrecedence(const token_type &a_Tok) const -> int
|
||||||
{
|
{
|
||||||
switch (a_Tok.GetCode())
|
switch (a_Tok.GetCode())
|
||||||
{
|
{
|
||||||
|
@ -678,7 +678,7 @@ int QmuParserBase::GetOprtPrecedence(const token_type &a_Tok) const
|
||||||
* @brief Get operator priority.
|
* @brief Get operator priority.
|
||||||
* @throw ParserException if a_Oprt is no operator code
|
* @throw ParserException if a_Oprt is no operator code
|
||||||
*/
|
*/
|
||||||
EOprtAssociativity QmuParserBase::GetOprtAssociativity(const token_type &a_Tok) const
|
auto QmuParserBase::GetOprtAssociativity(const token_type &a_Tok) const -> EOprtAssociativity
|
||||||
{
|
{
|
||||||
switch (a_Tok.GetCode())
|
switch (a_Tok.GetCode())
|
||||||
{
|
{
|
||||||
|
@ -709,7 +709,7 @@ EOprtAssociativity QmuParserBase::GetOprtAssociativity(const token_type &a_Tok)
|
||||||
/**
|
/**
|
||||||
* @brief Return a map containing the used variables only.
|
* @brief Return a map containing the used variables only.
|
||||||
*/
|
*/
|
||||||
const varmap_type& QmuParserBase::GetUsedVar() const
|
auto QmuParserBase::GetUsedVar() const -> const varmap_type &
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -737,8 +737,8 @@ const varmap_type& QmuParserBase::GetUsedVar() const
|
||||||
* @param a_FunTok Function token.
|
* @param a_FunTok Function token.
|
||||||
* @throw QmuParserError If the function token is not a string function
|
* @throw QmuParserError If the function token is not a string function
|
||||||
*/
|
*/
|
||||||
QmuParserBase::token_type QmuParserBase::ApplyStrFunc(const token_type &a_FunTok,
|
auto QmuParserBase::ApplyStrFunc(const token_type &a_FunTok, const QVector<token_type> &a_vArg) const
|
||||||
const QVector<token_type> &a_vArg) const
|
-> QmuParserBase::token_type
|
||||||
{
|
{
|
||||||
if (a_vArg.back().GetCode()!=cmSTRING)
|
if (a_vArg.back().GetCode()!=cmSTRING)
|
||||||
{
|
{
|
||||||
|
@ -1007,7 +1007,7 @@ void QmuParserBase::ApplyRemainingOprt(QStack<token_type> &stOpt, QStack<token_t
|
||||||
* Command code contains precalculated stack positions of the values and the associated operators. The Stack is
|
* Command code contains precalculated stack positions of the values and the associated operators. The Stack is
|
||||||
* filled beginning from index one the value at index zero is not used at all.
|
* filled beginning from index one the value at index zero is not used at all.
|
||||||
*/
|
*/
|
||||||
qreal QmuParserBase::ParseCmdCode() const
|
auto QmuParserBase::ParseCmdCode() const -> qreal
|
||||||
{
|
{
|
||||||
return ParseCmdCodeBulk(0, 0);
|
return ParseCmdCodeBulk(0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1018,7 +1018,7 @@ qreal QmuParserBase::ParseCmdCode() const
|
||||||
* @param nOffset The offset added to variable addresses (for bulk mode)
|
* @param nOffset The offset added to variable addresses (for bulk mode)
|
||||||
* @param nThreadID OpenMP Thread id of the calling thread
|
* @param nThreadID OpenMP Thread id of the calling thread
|
||||||
*/
|
*/
|
||||||
qreal QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
|
auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal
|
||||||
{
|
{
|
||||||
assert(nThreadID<=s_MaxNumOpenMPThreads);
|
assert(nThreadID<=s_MaxNumOpenMPThreads);
|
||||||
|
|
||||||
|
@ -1626,7 +1626,7 @@ void QmuParserBase::CreateRPN() const
|
||||||
* creating the bytecode the function pointer #m_pParseFormula will be changed to the second parse routine the
|
* creating the bytecode the function pointer #m_pParseFormula will be changed to the second parse routine the
|
||||||
* uses bytecode instead of string parsing.
|
* uses bytecode instead of string parsing.
|
||||||
*/
|
*/
|
||||||
qreal QmuParserBase::ParseString() const
|
auto QmuParserBase::ParseString() const -> qreal
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1801,7 +1801,7 @@ void QmuParserBase::EnableBuiltInOprt(bool a_bIsOn)
|
||||||
/**
|
/**
|
||||||
* @brief Get the argument separator character.
|
* @brief Get the argument separator character.
|
||||||
*/
|
*/
|
||||||
QChar QmuParserBase::GetArgSep() const
|
auto QmuParserBase::GetArgSep() const -> QChar
|
||||||
{
|
{
|
||||||
return m_pTokenReader->GetArgSep();
|
return m_pTokenReader->GetArgSep();
|
||||||
}
|
}
|
||||||
|
@ -1913,7 +1913,7 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
|
||||||
* This member function can be used to retriev all results of an expression made up of multiple comma seperated
|
* This member function can be used to retriev all results of an expression made up of multiple comma seperated
|
||||||
* subexpressions (i.e. "x+y,sin(x),cos(y)")
|
* subexpressions (i.e. "x+y,sin(x),cos(y)")
|
||||||
*/
|
*/
|
||||||
qreal* QmuParserBase::Eval(int &nStackSize) const
|
auto QmuParserBase::Eval(int &nStackSize) const -> qreal *
|
||||||
{
|
{
|
||||||
(this->*m_pParseFormula)();
|
(this->*m_pParseFormula)();
|
||||||
nStackSize = m_nFinalResultIdx;
|
nStackSize = m_nFinalResultIdx;
|
||||||
|
|
|
@ -72,20 +72,20 @@ class QMUPARSERSHARED_EXPORT QmuParserBase
|
||||||
public:
|
public:
|
||||||
QmuParserBase();
|
QmuParserBase();
|
||||||
explicit QmuParserBase(const QmuParserBase &a_Parser);
|
explicit QmuParserBase(const QmuParserBase &a_Parser);
|
||||||
QmuParserBase& operator=(const QmuParserBase &a_Parser);
|
auto operator=(const QmuParserBase &a_Parser) -> QmuParserBase &;
|
||||||
virtual ~QmuParserBase();
|
virtual ~QmuParserBase();
|
||||||
|
|
||||||
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
|
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
|
||||||
qreal Eval() const;
|
auto Eval() const -> qreal;
|
||||||
qreal* Eval(int &nStackSize) const;
|
auto Eval(int &nStackSize) const -> qreal *;
|
||||||
void Eval(qreal *results, int nBulkSize) const;
|
void Eval(qreal *results, int nBulkSize) const;
|
||||||
int GetNumResults() const;
|
auto GetNumResults() const -> int;
|
||||||
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);
|
||||||
bool HasBuiltInOprt() const;
|
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);
|
||||||
|
@ -103,23 +103,23 @@ public:
|
||||||
void ClearPostfixOprt();
|
void ClearPostfixOprt();
|
||||||
void ClearOprt();
|
void ClearOprt();
|
||||||
void RemoveVar(const QString &a_strVarName);
|
void RemoveVar(const QString &a_strVarName);
|
||||||
const varmap_type& GetUsedVar() const;
|
auto GetUsedVar() const -> const varmap_type &;
|
||||||
const varmap_type& GetVar() const;
|
auto GetVar() const -> const varmap_type &;
|
||||||
const valmap_type& GetConst() const;
|
auto GetConst() const -> const valmap_type &;
|
||||||
const QString& GetExpr() const;
|
auto GetExpr() const -> const QString &;
|
||||||
const funmap_type& GetFunDef() const;
|
auto GetFunDef() const -> const funmap_type &;
|
||||||
static QString GetVersion(EParserVersionInfo eInfo = pviFULL);
|
static auto GetVersion(EParserVersionInfo eInfo = pviFULL) -> QString;
|
||||||
static const QStringList& GetOprtDef();
|
static auto GetOprtDef() -> const QStringList &;
|
||||||
QMap<qmusizetype, QString> GetTokens() const;
|
auto GetTokens() const -> QMap<qmusizetype, QString>;
|
||||||
QMap<qmusizetype, QString> GetNumbers() const;
|
auto GetNumbers() const -> QMap<qmusizetype, QString>;
|
||||||
void DefineNameChars(const QString &a_szCharset);
|
void DefineNameChars(const QString &a_szCharset);
|
||||||
void DefineOprtChars(const QString &a_szCharset);
|
void DefineOprtChars(const QString &a_szCharset);
|
||||||
void DefineInfixOprtChars(const QString &a_szCharset);
|
void DefineInfixOprtChars(const QString &a_szCharset);
|
||||||
const QString& ValidNameChars() const;
|
auto ValidNameChars() const -> const QString &;
|
||||||
const QString& ValidOprtChars() const;
|
auto ValidOprtChars() const -> const QString &;
|
||||||
const QString& ValidInfixOprtChars() const;
|
auto ValidInfixOprtChars() const -> const QString &;
|
||||||
void SetArgSep(char_type cArgSep);
|
void SetArgSep(char_type cArgSep);
|
||||||
QChar GetArgSep() const;
|
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>
|
||||||
|
@ -127,16 +127,16 @@ public:
|
||||||
|
|
||||||
void setAllowSubexpressions(bool value);
|
void setAllowSubexpressions(bool value);
|
||||||
|
|
||||||
QLocale getLocale() const;
|
auto getLocale() const -> QLocale;
|
||||||
void setLocale(const QLocale &value);
|
void setLocale(const QLocale &value);
|
||||||
|
|
||||||
QChar getDecimalPoint() const;
|
auto getDecimalPoint() const -> QChar;
|
||||||
void setDecimalPoint(const QChar &c);
|
void setDecimalPoint(const QChar &c);
|
||||||
|
|
||||||
QChar getThousandsSeparator() const;
|
auto getThousandsSeparator() const -> QChar;
|
||||||
void setThousandsSeparator(const QChar &c);
|
void setThousandsSeparator(const QChar &c);
|
||||||
|
|
||||||
bool getCNumbers() const;
|
auto getCNumbers() const -> bool;
|
||||||
void setCNumbers(bool cNumbers);
|
void setCNumbers(bool cNumbers);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -173,17 +173,11 @@ protected:
|
||||||
: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 char_type do_decimal_point() const override
|
virtual auto do_decimal_point() const -> char_type override { return m_cDecPoint; }
|
||||||
{
|
|
||||||
return m_cDecPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual char_type do_thousands_sep() const override
|
virtual auto do_thousands_sep() const -> char_type override { return m_cThousandsSep; }
|
||||||
{
|
|
||||||
return m_cThousandsSep;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual std::string do_grouping() const override
|
virtual auto do_grouping() const -> std::string override
|
||||||
{
|
{
|
||||||
// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
|
// fix for issue 4: https://code.google.com/p/muparser/issues/detail?id=4
|
||||||
// courtesy of Jens Bartsch
|
// courtesy of Jens Bartsch
|
||||||
|
@ -267,13 +261,13 @@ private:
|
||||||
void ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal) const;
|
void ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal) const;
|
||||||
void ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal) const;
|
void ApplyIfElse(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal) const;
|
||||||
void ApplyFunc(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal, int iArgCount) const;
|
void ApplyFunc(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal, int iArgCount) const;
|
||||||
token_type ApplyStrFunc(const token_type &a_FunTok, const QVector<token_type> &a_vArg) const;
|
auto ApplyStrFunc(const token_type &a_FunTok, const QVector<token_type> &a_vArg) const -> token_type;
|
||||||
int GetOprtPrecedence(const token_type &a_Tok) const;
|
auto GetOprtPrecedence(const token_type &a_Tok) const -> int;
|
||||||
EOprtAssociativity GetOprtAssociativity(const token_type &a_Tok) const;
|
auto GetOprtAssociativity(const token_type &a_Tok) const -> EOprtAssociativity;
|
||||||
void CreateRPN() const;
|
void CreateRPN() const;
|
||||||
qreal ParseString() const;
|
auto ParseString() const -> qreal;
|
||||||
qreal ParseCmdCode() const;
|
auto ParseCmdCode() const -> qreal;
|
||||||
qreal ParseCmdCodeBulk(int nOffset, int nThreadID) const;
|
auto ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal;
|
||||||
// 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
|
||||||
|
@ -330,19 +324,19 @@ inline void QmuParserBase::AddValIdent(identfun_type a_pCallback)
|
||||||
* @brief Get the default symbols used for the built in operators.
|
* @brief Get the default symbols used for the built in operators.
|
||||||
* @sa c_DefaultOprt
|
* @sa c_DefaultOprt
|
||||||
*/
|
*/
|
||||||
inline const QStringList &QmuParserBase::GetOprtDef()
|
inline auto QmuParserBase::GetOprtDef() -> const QStringList &
|
||||||
{
|
{
|
||||||
return c_DefaultOprt;
|
return c_DefaultOprt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QMap<qmusizetype, QString> QmuParserBase::GetTokens() const
|
inline auto QmuParserBase::GetTokens() const -> QMap<qmusizetype, QString>
|
||||||
{
|
{
|
||||||
return m_Tokens;
|
return m_Tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QMap<qmusizetype, QString> QmuParserBase::GetNumbers() const
|
inline auto QmuParserBase::GetNumbers() const -> QMap<qmusizetype, QString>
|
||||||
{
|
{
|
||||||
return m_Numbers;
|
return m_Numbers;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +372,7 @@ inline void QmuParserBase::DefineInfixOprtChars(const QString &a_szCharset)
|
||||||
/**
|
/**
|
||||||
* @brief Return a map containing the used variables only.
|
* @brief Return a map containing the used variables only.
|
||||||
*/
|
*/
|
||||||
inline const varmap_type &QmuParserBase::GetVar() const
|
inline auto QmuParserBase::GetVar() const -> const varmap_type &
|
||||||
{
|
{
|
||||||
return m_VarDef;
|
return m_VarDef;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +381,7 @@ inline const varmap_type &QmuParserBase::GetVar() const
|
||||||
/**
|
/**
|
||||||
* @brief Return a map containing all parser constants.
|
* @brief Return a map containing all parser constants.
|
||||||
*/
|
*/
|
||||||
inline const valmap_type &QmuParserBase::GetConst() const
|
inline auto QmuParserBase::GetConst() const -> const valmap_type &
|
||||||
{
|
{
|
||||||
return m_ConstDef;
|
return m_ConstDef;
|
||||||
}
|
}
|
||||||
|
@ -403,7 +397,7 @@ inline const valmap_type &QmuParserBase::GetConst() const
|
||||||
* parser functions. String functions are not part of this map. The Prototype definition is encapsulated in objects
|
* parser functions. String functions are not part of this map. The Prototype definition is encapsulated in objects
|
||||||
* of the class FunProt one per parser function each associated with function names via a map construct.
|
* of the class FunProt one per parser function each associated with function names via a map construct.
|
||||||
*/
|
*/
|
||||||
inline const funmap_type &QmuParserBase::GetFunDef() const
|
inline auto QmuParserBase::GetFunDef() const -> const funmap_type &
|
||||||
{
|
{
|
||||||
return m_FunDef;
|
return m_FunDef;
|
||||||
}
|
}
|
||||||
|
@ -412,7 +406,7 @@ inline const funmap_type &QmuParserBase::GetFunDef() const
|
||||||
/**
|
/**
|
||||||
* @brief Retrieve the formula.
|
* @brief Retrieve the formula.
|
||||||
*/
|
*/
|
||||||
inline const QString& QmuParserBase::GetExpr() const
|
inline auto QmuParserBase::GetExpr() const -> const QString &
|
||||||
{
|
{
|
||||||
return m_pTokenReader->GetExpr();
|
return m_pTokenReader->GetExpr();
|
||||||
}
|
}
|
||||||
|
@ -423,7 +417,7 @@ inline const QString& QmuParserBase::GetExpr() const
|
||||||
* @return #m_bBuiltInOp; true if built in operators are enabled.
|
* @return #m_bBuiltInOp; true if built in operators are enabled.
|
||||||
* @throw nothrow
|
* @throw nothrow
|
||||||
*/
|
*/
|
||||||
inline bool QmuParserBase::HasBuiltInOprt() const
|
inline auto QmuParserBase::HasBuiltInOprt() const -> bool
|
||||||
{
|
{
|
||||||
return m_bBuiltInOp;
|
return m_bBuiltInOp;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +430,7 @@ inline bool QmuParserBase::HasBuiltInOprt() const
|
||||||
* value. This function returns the number of available results.
|
* value. This function returns the number of available results.
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
inline int QmuParserBase::GetNumResults() const
|
inline auto QmuParserBase::GetNumResults() const -> int
|
||||||
{
|
{
|
||||||
return m_nFinalResultIdx;
|
return m_nFinalResultIdx;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +452,7 @@ inline int QmuParserBase::GetNumResults() const
|
||||||
* @return The evaluation result
|
* @return The evaluation result
|
||||||
* @throw ParseException if no Formula is set or in case of any other error related to the formula.
|
* @throw ParseException if no Formula is set or in case of any other error related to the formula.
|
||||||
*/
|
*/
|
||||||
inline qreal QmuParserBase::Eval() const
|
inline auto QmuParserBase::Eval() const -> qreal
|
||||||
{
|
{
|
||||||
return (this->*m_pParseFormula)();
|
return (this->*m_pParseFormula)();
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ QmuParserCallback::QmuParserCallback (const QmuParserCallback &a_Fun )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserCallback &QmuParserCallback::operator=(const QmuParserCallback &a_Fun)
|
auto QmuParserCallback::operator=(const QmuParserCallback &a_Fun) -> QmuParserCallback &
|
||||||
{
|
{
|
||||||
if ( &a_Fun == this )
|
if ( &a_Fun == this )
|
||||||
{
|
{
|
||||||
|
@ -215,7 +215,7 @@ QmuParserCallback::QmuParserCallback(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserCallback &QmuParserCallback::operator=(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW
|
auto QmuParserCallback::operator=(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW->QmuParserCallback &
|
||||||
{
|
{
|
||||||
std::swap(d, a_Fun.d);
|
std::swap(d, a_Fun.d);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -230,7 +230,7 @@ QmuParserCallback &QmuParserCallback::operator=(QmuParserCallback &&a_Fun) Q_DEC
|
||||||
* @throw nothrow
|
* @throw nothrow
|
||||||
*/
|
*/
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
bool QmuParserCallback::IsOptimizable() const
|
auto QmuParserCallback::IsOptimizable() const -> bool
|
||||||
{
|
{
|
||||||
return d->m_bAllowOpti;
|
return d->m_bAllowOpti;
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ bool QmuParserCallback::IsOptimizable() const
|
||||||
* @throw nothrow
|
* @throw nothrow
|
||||||
* @return #pFun
|
* @return #pFun
|
||||||
*/
|
*/
|
||||||
void* QmuParserCallback::GetAddr() const
|
auto QmuParserCallback::GetAddr() const -> void *
|
||||||
{
|
{
|
||||||
return d->m_pFun;
|
return d->m_pFun;
|
||||||
}
|
}
|
||||||
|
@ -253,13 +253,13 @@ void* QmuParserCallback::GetAddr() const
|
||||||
/**
|
/**
|
||||||
* @brief Return the callback code.
|
* @brief Return the callback code.
|
||||||
*/
|
*/
|
||||||
ECmdCode QmuParserCallback::GetCode() const
|
auto QmuParserCallback::GetCode() const -> ECmdCode
|
||||||
{
|
{
|
||||||
return d->m_iCode;
|
return d->m_iCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
ETypeCode QmuParserCallback::GetType() const
|
auto QmuParserCallback::GetType() const -> ETypeCode
|
||||||
{
|
{
|
||||||
return d->m_iType;
|
return d->m_iType;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ ETypeCode QmuParserCallback::GetType() const
|
||||||
*
|
*
|
||||||
* Only valid if the callback token is an operator token (binary or infix).
|
* Only valid if the callback token is an operator token (binary or infix).
|
||||||
*/
|
*/
|
||||||
int QmuParserCallback::GetPri() const
|
auto QmuParserCallback::GetPri() const -> int
|
||||||
{
|
{
|
||||||
return d->m_iPri;
|
return d->m_iPri;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ int QmuParserCallback::GetPri() const
|
||||||
*
|
*
|
||||||
* Only valid if the callback token is a binary operator token.
|
* Only valid if the callback token is a binary operator token.
|
||||||
*/
|
*/
|
||||||
EOprtAssociativity QmuParserCallback::GetAssociativity() const
|
auto QmuParserCallback::GetAssociativity() const -> EOprtAssociativity
|
||||||
{
|
{
|
||||||
return d->m_eOprtAsct;
|
return d->m_eOprtAsct;
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ EOprtAssociativity QmuParserCallback::GetAssociativity() const
|
||||||
/**
|
/**
|
||||||
* @brief Returns the number of function Arguments.
|
* @brief Returns the number of function Arguments.
|
||||||
*/
|
*/
|
||||||
int QmuParserCallback::GetArgc() const
|
auto QmuParserCallback::GetArgc() const -> int
|
||||||
{
|
{
|
||||||
return d->m_iArgc;
|
return d->m_iArgc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,22 +84,23 @@ public:
|
||||||
QmuParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
|
QmuParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
|
||||||
QmuParserCallback();
|
QmuParserCallback();
|
||||||
QmuParserCallback(const QmuParserCallback &a_Fun);
|
QmuParserCallback(const QmuParserCallback &a_Fun);
|
||||||
QmuParserCallback &operator=(const QmuParserCallback &a_Fun);
|
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) Q_DECL_NOTHROW;
|
||||||
QmuParserCallback &operator=(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW;
|
auto operator=(QmuParserCallback &&a_Fun) Q_DECL_NOTHROW->QmuParserCallback &;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_REQUIRED_RESULT QmuParserCallback* Clone() const;
|
Q_REQUIRED_RESULT auto Clone() const -> QmuParserCallback *;
|
||||||
|
|
||||||
|
auto IsOptimizable() const -> bool;
|
||||||
|
auto GetAddr() const -> void *;
|
||||||
|
auto GetCode() const -> ECmdCode;
|
||||||
|
auto GetType() const -> ETypeCode;
|
||||||
|
auto GetPri() const -> int;
|
||||||
|
auto GetAssociativity() const -> EOprtAssociativity;
|
||||||
|
auto GetArgc() const -> int;
|
||||||
|
|
||||||
bool IsOptimizable() const;
|
|
||||||
void* GetAddr() const;
|
|
||||||
ECmdCode GetCode() const;
|
|
||||||
ETypeCode GetType() const;
|
|
||||||
int GetPri() const;
|
|
||||||
EOprtAssociativity GetAssociativity() const;
|
|
||||||
int GetArgc() const;
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<QmuParserCallbackData> d;
|
QSharedDataPointer<QmuParserCallbackData> d;
|
||||||
};
|
};
|
||||||
|
@ -114,7 +115,7 @@ typedef std::map<QString, QmuParserCallback> funmap_type;
|
||||||
/**
|
/**
|
||||||
* @brief Clone this instance and return a pointer to the new instance.
|
* @brief Clone this instance and return a pointer to the new instance.
|
||||||
*/
|
*/
|
||||||
inline QmuParserCallback* QmuParserCallback::Clone() const
|
inline auto QmuParserCallback::Clone() const -> QmuParserCallback *
|
||||||
{
|
{
|
||||||
return new QmuParserCallback ( *this );
|
return new QmuParserCallback ( *this );
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ QmuParserError::QmuParserError ( const QmuParserError &a_Obj )
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/** @brief Assignment operator. */
|
/** @brief Assignment operator. */
|
||||||
QmuParserError& QmuParserError::operator= ( const QmuParserError &a_Obj )
|
auto QmuParserError::operator=(const QmuParserError &a_Obj) -> QmuParserError &
|
||||||
{
|
{
|
||||||
if ( this == &a_Obj )
|
if ( this == &a_Obj )
|
||||||
{
|
{
|
||||||
|
@ -296,7 +296,7 @@ Q_NORETURN void QmuParserError::raise() const
|
||||||
* @brief clone clone exception
|
* @brief clone clone exception
|
||||||
* @return new exception
|
* @return new exception
|
||||||
*/
|
*/
|
||||||
QmuParserError *QmuParserError::clone() const
|
auto QmuParserError::clone() const -> QmuParserError *
|
||||||
{
|
{
|
||||||
return new QmuParserError(*this);
|
return new QmuParserError(*this);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ QmuParserWarning::QmuParserWarning(const QmuParserWarning &a_Obj)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserWarning &QmuParserWarning::operator=(const QmuParserWarning &a_Obj)
|
auto QmuParserWarning::operator=(const QmuParserWarning &a_Obj) -> QmuParserWarning &
|
||||||
{
|
{
|
||||||
if ( this == &a_Obj )
|
if ( this == &a_Obj )
|
||||||
{
|
{
|
||||||
|
@ -337,7 +337,7 @@ Q_NORETURN void QmuParserWarning::raise() const
|
||||||
* @brief clone clone exception
|
* @brief clone clone exception
|
||||||
* @return new exception
|
* @return new exception
|
||||||
*/
|
*/
|
||||||
QmuParserWarning *QmuParserWarning::clone() const
|
auto QmuParserWarning::clone() const -> QmuParserWarning *
|
||||||
{
|
{
|
||||||
return new QmuParserWarning(*this);
|
return new QmuParserWarning(*this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,8 +108,8 @@ public:
|
||||||
QmuParserErrorMsg();
|
QmuParserErrorMsg();
|
||||||
~QmuParserErrorMsg();
|
~QmuParserErrorMsg();
|
||||||
|
|
||||||
static const QmuParserErrorMsg& Instance();
|
static auto Instance() -> const QmuParserErrorMsg &;
|
||||||
QString operator[] ( int a_iIdx ) const;
|
auto operator[](int a_iIdx) const -> QString;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
|
@ -120,13 +120,13 @@ private:
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
inline const QmuParserErrorMsg& QmuParserErrorMsg::Instance()
|
inline auto QmuParserErrorMsg::Instance() -> const QmuParserErrorMsg &
|
||||||
{
|
{
|
||||||
return m_Instance;
|
return m_Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString QmuParserErrorMsg::operator[] ( int a_iIdx ) const
|
inline auto QmuParserErrorMsg::operator[](int a_iIdx) const -> QString
|
||||||
{
|
{
|
||||||
return m_vErrMsg.value(a_iIdx).translate(QString());
|
return m_vErrMsg.value(a_iIdx).translate(QString());
|
||||||
}
|
}
|
||||||
|
@ -136,14 +136,15 @@ 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 );
|
||||||
QmuParserWarning& operator= ( const QmuParserWarning &a_Obj );
|
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 {}
|
||||||
|
|
||||||
const QString& GetMsg() const;
|
auto GetMsg() const -> const QString &;
|
||||||
|
|
||||||
Q_NORETURN virtual void raise() const override;
|
Q_NORETURN virtual void raise() const override;
|
||||||
Q_REQUIRED_RESULT virtual QmuParserWarning *clone() const override;
|
Q_REQUIRED_RESULT virtual auto clone() const -> QmuParserWarning * override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_sMsg; ///< The message string
|
QString m_sMsg; ///< The message string
|
||||||
};
|
};
|
||||||
|
@ -152,7 +153,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* @brief Returns the message string for this error.
|
* @brief Returns the message string for this error.
|
||||||
*/
|
*/
|
||||||
inline const QString& QmuParserWarning::GetMsg() const
|
inline auto QmuParserWarning::GetMsg() const -> const QString &
|
||||||
{
|
{
|
||||||
return m_sMsg;
|
return m_sMsg;
|
||||||
}
|
}
|
||||||
|
@ -173,17 +174,18 @@ public:
|
||||||
QmuParserError ( EErrorCodes a_iErrc, int a_iPos, const QString &sTok );
|
QmuParserError ( EErrorCodes a_iErrc, int a_iPos, const QString &sTok );
|
||||||
QmuParserError ( const QString &szMsg, int iPos, const QString &sTok = QString() );
|
QmuParserError ( const QString &szMsg, int iPos, const QString &sTok = QString() );
|
||||||
QmuParserError ( const QmuParserError &a_Obj );
|
QmuParserError ( const QmuParserError &a_Obj );
|
||||||
QmuParserError& operator= ( const QmuParserError &a_Obj );
|
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 );
|
||||||
const QString& GetExpr() const;
|
auto GetExpr() const -> const QString &;
|
||||||
const QString& GetMsg() const;
|
auto GetMsg() const -> const QString &;
|
||||||
qmusizetype GetPos() const;
|
auto GetPos() const -> qmusizetype;
|
||||||
const QString& GetToken() const;
|
auto GetToken() const -> const QString &;
|
||||||
EErrorCodes GetCode() const;
|
auto GetCode() const -> EErrorCodes;
|
||||||
Q_NORETURN virtual void raise() const override;
|
Q_NORETURN virtual void raise() const override;
|
||||||
Q_REQUIRED_RESULT virtual QmuParserError *clone() const override;
|
Q_REQUIRED_RESULT virtual auto clone() const -> QmuParserError * override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_sMsg; ///< The message string
|
QString m_sMsg; ///< The message string
|
||||||
QString m_sExpr; ///< Formula string
|
QString m_sExpr; ///< Formula string
|
||||||
|
@ -207,7 +209,7 @@ inline void QmuParserError::SetFormula ( const QString &a_strFormula )
|
||||||
/**
|
/**
|
||||||
* @brief gets the expression related tp this error.
|
* @brief gets the expression related tp this error.
|
||||||
*/
|
*/
|
||||||
inline const QString& QmuParserError::GetExpr() const
|
inline auto QmuParserError::GetExpr() const -> const QString &
|
||||||
{
|
{
|
||||||
return m_sExpr;
|
return m_sExpr;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +218,7 @@ inline const QString& QmuParserError::GetExpr() const
|
||||||
/**
|
/**
|
||||||
* @brief Returns the message string for this error.
|
* @brief Returns the message string for this error.
|
||||||
*/
|
*/
|
||||||
inline const QString& QmuParserError::GetMsg() const
|
inline auto QmuParserError::GetMsg() const -> const QString &
|
||||||
{
|
{
|
||||||
return m_sMsg;
|
return m_sMsg;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,7 @@ inline const QString& QmuParserError::GetMsg() const
|
||||||
*
|
*
|
||||||
* If the error is not related to a distinct position this will return -1
|
* If the error is not related to a distinct position this will return -1
|
||||||
*/
|
*/
|
||||||
inline qmusizetype QmuParserError::GetPos() const
|
inline auto QmuParserError::GetPos() const -> qmusizetype
|
||||||
{
|
{
|
||||||
return m_iPos;
|
return m_iPos;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +238,7 @@ inline qmusizetype QmuParserError::GetPos() const
|
||||||
/**
|
/**
|
||||||
* @brief Return string related with this token (if available).
|
* @brief Return string related with this token (if available).
|
||||||
*/
|
*/
|
||||||
inline const QString& QmuParserError::GetToken() const
|
inline auto QmuParserError::GetToken() const -> const QString &
|
||||||
{
|
{
|
||||||
return m_sTok;
|
return m_sTok;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +247,7 @@ inline const QString& QmuParserError::GetToken() const
|
||||||
/**
|
/**
|
||||||
* @brief Return the error code.
|
* @brief Return the error code.
|
||||||
*/
|
*/
|
||||||
inline EErrorCodes QmuParserError::GetCode() const
|
inline auto QmuParserError::GetCode() const -> EErrorCodes
|
||||||
{
|
{
|
||||||
return m_iErrc;
|
return m_iErrc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,8 @@ QmuParserTester::QmuParserTester(QObject *parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::IsHexVal ( const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
|
auto QmuParserTester::IsHexVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
|
||||||
bool cNumbers, const QChar &decimal, const QChar &thousand )
|
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int
|
||||||
{
|
{
|
||||||
Q_UNUSED(locale)
|
Q_UNUSED(locale)
|
||||||
Q_UNUSED(decimal)
|
Q_UNUSED(decimal)
|
||||||
|
@ -108,7 +108,7 @@ int QmuParserTester::IsHexVal ( const QString &a_szExpr, qmusizetype *a_iPos, qr
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestInterface()
|
auto QmuParserTester::TestInterface() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing member functions...";
|
qWarning() << "testing member functions...";
|
||||||
|
@ -154,7 +154,7 @@ int QmuParserTester::TestInterface()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestStrArg()
|
auto QmuParserTester::TestStrArg() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing string arguments...";
|
qWarning() << "testing string arguments...";
|
||||||
|
@ -183,7 +183,7 @@ int QmuParserTester::TestStrArg()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestBulkMode()
|
auto QmuParserTester::TestBulkMode() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing bulkmode...";
|
qWarning() << "testing bulkmode...";
|
||||||
|
@ -221,7 +221,7 @@ int QmuParserTester::TestBulkMode()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestBinOprt()
|
auto QmuParserTester::TestBinOprt() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing binary operators...";
|
qWarning() << "testing binary operators...";
|
||||||
|
@ -290,7 +290,7 @@ int QmuParserTester::TestBinOprt()
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/** @brief Check muParser name restriction enforcement. */
|
/** @brief Check muParser name restriction enforcement. */
|
||||||
int QmuParserTester::TestNames()
|
auto QmuParserTester::TestNames() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0,
|
int iStat = 0,
|
||||||
iErr = 0;
|
iErr = 0;
|
||||||
|
@ -402,7 +402,7 @@ int QmuParserTester::TestNames()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestSyntax()
|
auto QmuParserTester::TestSyntax() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing syntax engine...";
|
qWarning() << "testing syntax engine...";
|
||||||
|
@ -455,7 +455,7 @@ int QmuParserTester::TestSyntax()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestVarConst()
|
auto QmuParserTester::TestVarConst() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing variable/constant detection...";
|
qWarning() << "testing variable/constant detection...";
|
||||||
|
@ -588,7 +588,7 @@ int QmuParserTester::TestVarConst()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestMultiArg()
|
auto QmuParserTester::TestMultiArg() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing multiarg functions...";
|
qWarning() << "testing multiarg functions...";
|
||||||
|
@ -687,7 +687,7 @@ int QmuParserTester::TestMultiArg()
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestInfixOprt()
|
auto QmuParserTester::TestInfixOprt() -> int
|
||||||
{
|
{
|
||||||
int iStat ( 0 );
|
int iStat ( 0 );
|
||||||
qWarning() << "testing infix operators...";
|
qWarning() << "testing infix operators...";
|
||||||
|
@ -756,7 +756,7 @@ int QmuParserTester::TestInfixOprt()
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestPostFix()
|
auto QmuParserTester::TestPostFix() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing postfix operators...";
|
qWarning() << "testing postfix operators...";
|
||||||
|
@ -811,7 +811,7 @@ int QmuParserTester::TestPostFix()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestExpression()
|
auto QmuParserTester::TestExpression() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing expression samples...";
|
qWarning() << "testing expression samples...";
|
||||||
|
@ -901,7 +901,7 @@ int QmuParserTester::TestExpression()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestIfThenElse()
|
auto QmuParserTester::TestIfThenElse() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing if-then-else operator...";
|
qWarning() << "testing if-then-else operator...";
|
||||||
|
@ -1011,7 +1011,7 @@ int QmuParserTester::TestIfThenElse()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::TestException()
|
auto QmuParserTester::TestException() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0;
|
int iStat = 0;
|
||||||
qWarning() << "testing error codes...";
|
qWarning() << "testing error codes...";
|
||||||
|
@ -1169,7 +1169,7 @@ void QmuParserTester::Run()
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int QmuParserTester::ThrowTest ( const QString &a_str, int a_iErrc, bool a_bFail )
|
auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail) -> int
|
||||||
{
|
{
|
||||||
QmuParserTester::c_iCount++;
|
QmuParserTester::c_iCount++;
|
||||||
|
|
||||||
|
@ -1221,8 +1221,8 @@ int QmuParserTester::ThrowTest ( const QString &a_str, int a_iErrc, bool a_bFail
|
||||||
*
|
*
|
||||||
* @return 1 in case of a failure, 0 otherwise.
|
* @return 1 in case of a failure, 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int QmuParserTester::EqnTestWithVarChange (const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
|
auto QmuParserTester::EqnTestWithVarChange(const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
|
||||||
double a_fVar2)
|
double a_fVar2) -> int
|
||||||
{
|
{
|
||||||
QmuParserTester::c_iCount++;
|
QmuParserTester::c_iCount++;
|
||||||
qreal fVal[2] = { -999, -999 }; // should be equalinitially
|
qreal fVal[2] = { -999, -999 }; // should be equalinitially
|
||||||
|
@ -1277,7 +1277,7 @@ int QmuParserTester::EqnTestWithVarChange (const QString &a_str, double a_fRes1,
|
||||||
*
|
*
|
||||||
* @return 1 in case of a failure, 0 otherwise.
|
* @return 1 in case of a failure, 0 otherwise.
|
||||||
*/
|
*/
|
||||||
int QmuParserTester::EqnTest ( const QString &a_str, double a_fRes, bool a_fPass )
|
auto QmuParserTester::EqnTest(const QString &a_str, double a_fRes, bool a_fPass) -> int
|
||||||
{
|
{
|
||||||
QmuParserTester::c_iCount++;
|
QmuParserTester::c_iCount++;
|
||||||
int iRet ( 0 );
|
int iRet ( 0 );
|
||||||
|
@ -1467,7 +1467,7 @@ QT_WARNING_POP
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/** \brief Test an expression in Bulk Mode. */
|
/** \brief Test an expression in Bulk Mode. */
|
||||||
int QmuParserTester::EqnTestBulk(const QString &a_str, double a_fRes[4], bool a_fPass)
|
auto QmuParserTester::EqnTestBulk(const QString &a_str, double a_fRes[4], bool a_fPass) -> int
|
||||||
{
|
{
|
||||||
QmuParserTester::c_iCount++;
|
QmuParserTester::c_iCount++;
|
||||||
int iRet(0);
|
int iRet(0);
|
||||||
|
|
|
@ -76,131 +76,62 @@ private:
|
||||||
void AddTest ( testfun_type a_pFun );
|
void AddTest ( testfun_type a_pFun );
|
||||||
|
|
||||||
// Test Double Parser
|
// Test Double Parser
|
||||||
static int EqnTest ( const QString &a_str, double a_fRes, bool a_fPass );
|
static auto EqnTest(const QString &a_str, double a_fRes, bool a_fPass) -> int;
|
||||||
static int EqnTestWithVarChange (const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
|
static auto EqnTestWithVarChange(const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
|
||||||
double a_fVar2);
|
double a_fVar2) -> int;
|
||||||
static int ThrowTest ( const QString &a_str, int a_iErrc, bool a_bFail = true );
|
static auto ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail = true) -> int;
|
||||||
|
|
||||||
// Test Bulkmode
|
// Test Bulkmode
|
||||||
static int EqnTestBulk(const QString &a_str, double a_fRes[4], bool a_fPass);
|
static auto EqnTestBulk(const QString &a_str, double a_fRes[4], bool a_fPass) -> int;
|
||||||
|
|
||||||
// Multiarg callbacks
|
// Multiarg callbacks
|
||||||
static qreal f1of1 ( qreal v )
|
static auto f1of1(qreal v) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f1of2 ( qreal v, qreal )
|
static auto f1of2(qreal v, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f2of2 ( qreal, qreal v )
|
static auto f2of2(qreal, qreal v) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f1of3 ( qreal v, qreal, qreal )
|
static auto f1of3(qreal v, qreal, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f2of3 ( qreal, qreal v, qreal )
|
static auto f2of3(qreal, qreal v, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f3of3 ( qreal, qreal, qreal v )
|
static auto f3of3(qreal, qreal, qreal v) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f1of4 ( qreal v, qreal, qreal, qreal )
|
static auto f1of4(qreal v, qreal, qreal, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f2of4 ( qreal, qreal v, qreal, qreal )
|
static auto f2of4(qreal, qreal v, qreal, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f3of4 ( qreal, qreal, qreal v, qreal )
|
static auto f3of4(qreal, qreal, qreal v, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f4of4 ( qreal, qreal, qreal, qreal v )
|
static auto f4of4(qreal, qreal, qreal, qreal v) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f1of5 ( qreal v, qreal, qreal, qreal, qreal )
|
static auto f1of5(qreal v, qreal, qreal, qreal, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f2of5 ( qreal, qreal v, qreal, qreal, qreal )
|
static auto f2of5(qreal, qreal v, qreal, qreal, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f3of5 ( qreal, qreal, qreal v, qreal, qreal )
|
static auto f3of5(qreal, qreal, qreal v, qreal, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f4of5 ( qreal, qreal, qreal, qreal v, qreal )
|
static auto f4of5(qreal, qreal, qreal, qreal v, qreal) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal f5of5 ( qreal, qreal, qreal, qreal, qreal v )
|
static auto f5of5(qreal, qreal, qreal, qreal, qreal v) -> qreal { return v; }
|
||||||
{
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal Min ( qreal a_fVal1, qreal a_fVal2 )
|
static auto Min(qreal a_fVal1, qreal a_fVal2) -> qreal { return (a_fVal1 < a_fVal2) ? a_fVal1 : a_fVal2; }
|
||||||
{
|
|
||||||
return ( a_fVal1 < a_fVal2 ) ? a_fVal1 : a_fVal2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal Max ( qreal a_fVal1, qreal a_fVal2 )
|
static auto Max(qreal a_fVal1, qreal a_fVal2) -> qreal { return (a_fVal1 > a_fVal2) ? a_fVal1 : a_fVal2; }
|
||||||
{
|
|
||||||
return ( a_fVal1 > a_fVal2 ) ? a_fVal1 : a_fVal2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal plus2 ( qreal v1 )
|
static auto plus2(qreal v1) -> qreal { return v1 + 2; }
|
||||||
{
|
|
||||||
return v1 + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal times3 ( qreal v1 )
|
static auto times3(qreal v1) -> qreal { return v1 * 3; }
|
||||||
{
|
|
||||||
return v1 * 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal sqr ( qreal v1 )
|
static auto sqr(qreal v1) -> qreal { return v1 * v1; }
|
||||||
{
|
|
||||||
return v1 * v1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal sign ( qreal v )
|
static auto sign(qreal v) -> qreal { return -v; }
|
||||||
{
|
|
||||||
return -v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal add ( qreal v1, qreal v2 )
|
static auto add(qreal v1, qreal v2) -> qreal { return v1 + v2; }
|
||||||
{
|
|
||||||
return v1 + v2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal land ( qreal v1, qreal v2 )
|
static auto land(qreal v1, qreal v2) -> qreal { return static_cast<int>(v1) & static_cast<int>(v2); }
|
||||||
{
|
|
||||||
return static_cast<int>( v1 ) & static_cast<int>( v2 );
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal FirstArg ( const qreal* a_afArg, qmusizetype a_iArgc )
|
static auto FirstArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if ( a_iArgc == 0)
|
if ( a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +141,7 @@ private:
|
||||||
return a_afArg[0];
|
return a_afArg[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal LastArg ( const qreal* a_afArg, qmusizetype a_iArgc )
|
static auto LastArg(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if ( a_iArgc == 0)
|
if ( a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -220,7 +151,7 @@ private:
|
||||||
return a_afArg[a_iArgc - 1];
|
return a_afArg[a_iArgc - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal Sum ( const qreal* a_afArg, qmusizetype a_iArgc )
|
static auto Sum(const qreal *a_afArg, qmusizetype a_iArgc) -> qreal
|
||||||
{
|
{
|
||||||
if ( a_iArgc == 0)
|
if ( a_iArgc == 0)
|
||||||
{
|
{
|
||||||
|
@ -235,7 +166,7 @@ private:
|
||||||
return fRes;
|
return fRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal Rnd ( qreal v )
|
static auto Rnd(qreal v) -> qreal
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
|
return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
|
||||||
|
@ -245,7 +176,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal RndWithString ( const char_type* )
|
static auto RndWithString(const char_type *) -> qreal
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
|
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
|
||||||
|
@ -255,73 +186,58 @@ private:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal Ping()
|
static auto Ping() -> qreal { return 10; }
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal ValueOf ( const QString & )
|
static auto ValueOf(const QString &) -> qreal { return 123; }
|
||||||
{
|
|
||||||
return 123;
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal StrFun1 ( const QString & v1 )
|
static auto StrFun1(const QString &v1) -> qreal
|
||||||
{
|
{
|
||||||
int val = v1.toInt();
|
int val = v1.toInt();
|
||||||
return static_cast<qreal>(val);
|
return static_cast<qreal>(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal StrFun2 ( const QString & v1, qreal v2 )
|
static auto StrFun2(const QString &v1, qreal v2) -> qreal
|
||||||
{
|
{
|
||||||
int val = v1.toInt();
|
int val = v1.toInt();
|
||||||
return static_cast<qreal>( val + v2 );
|
return static_cast<qreal>( val + v2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal StrFun3 ( const QString & v1, qreal v2, qreal v3 )
|
static auto StrFun3(const QString &v1, qreal v2, qreal v3) -> qreal
|
||||||
{
|
{
|
||||||
int val = v1.toInt();
|
int val = v1.toInt();
|
||||||
return val + v2 + v3;
|
return val + v2 + v3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal StrToFloat ( const QString & a_szMsg )
|
static auto StrToFloat(const QString &a_szMsg) -> qreal
|
||||||
{
|
{
|
||||||
qreal val = a_szMsg.toDouble();
|
qreal val = a_szMsg.toDouble();
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// postfix operator callback
|
// postfix operator callback
|
||||||
static qreal Mega ( qreal a_fVal )
|
static auto Mega(qreal a_fVal) -> qreal { return a_fVal * static_cast<qreal>(1e6); }
|
||||||
{
|
|
||||||
return a_fVal * static_cast<qreal>( 1e6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal Micro ( qreal a_fVal )
|
static auto Micro(qreal a_fVal) -> qreal { return a_fVal * static_cast<qreal>(1e-6); }
|
||||||
{
|
|
||||||
return a_fVal * static_cast<qreal>( 1e-6 );
|
|
||||||
}
|
|
||||||
|
|
||||||
static qreal Milli ( qreal a_fVal )
|
static auto Milli(qreal a_fVal) -> qreal { return a_fVal / static_cast<qreal>(1e3); }
|
||||||
{
|
|
||||||
return a_fVal / static_cast<qreal>( 1e3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom value recognition
|
// Custom value recognition
|
||||||
static int IsHexVal (const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
|
static auto IsHexVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
|
||||||
bool cNumbers, const QChar &decimal, const QChar &thousand);
|
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int;
|
||||||
|
|
||||||
int TestNames();
|
auto TestNames() -> int;
|
||||||
int TestSyntax();
|
auto TestSyntax() -> int;
|
||||||
int TestMultiArg();
|
auto TestMultiArg() -> int;
|
||||||
int TestPostFix();
|
auto TestPostFix() -> int;
|
||||||
int TestExpression();
|
auto TestExpression() -> int;
|
||||||
int TestInfixOprt();
|
auto TestInfixOprt() -> int;
|
||||||
int TestBinOprt();
|
auto TestBinOprt() -> int;
|
||||||
int TestVarConst();
|
auto TestVarConst() -> int;
|
||||||
int TestInterface();
|
auto TestInterface() -> int;
|
||||||
int TestException();
|
auto TestException() -> int;
|
||||||
int TestStrArg();
|
auto TestStrArg() -> int;
|
||||||
int TestIfThenElse();
|
auto TestIfThenElse() -> int;
|
||||||
int TestBulkMode();
|
auto TestBulkMode() -> int;
|
||||||
|
|
||||||
static void Abort();
|
static void Abort();
|
||||||
};
|
};
|
||||||
|
|
|
@ -670,13 +670,10 @@ auto QmuParserTokenReader::IsOprt ( token_type &a_Tok ) -> bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// nope, no infix operator
|
|
||||||
return false;
|
|
||||||
//Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// nope, no infix operator
|
||||||
|
return false;
|
||||||
|
// Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_iPos += sID.length();
|
m_iPos += sID.length();
|
||||||
|
|
|
@ -90,7 +90,7 @@ QmuTokenParser::QmuTokenParser(const QString &formula, bool osSeparator,
|
||||||
* @param formula expression for test
|
* @param formula expression for test
|
||||||
* @return true if fomula has single number
|
* @return true if fomula has single number
|
||||||
*/
|
*/
|
||||||
bool QmuTokenParser::IsSingle(const QString &formula)
|
auto QmuTokenParser::IsSingle(const QString &formula) -> bool
|
||||||
{
|
{
|
||||||
QLocale c(QLocale::C);
|
QLocale c(QLocale::C);
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -99,7 +99,7 @@ bool QmuTokenParser::IsSingle(const QString &formula)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal QmuTokenParser::Warning(const QString &warningMsg, qreal value)
|
auto QmuTokenParser::Warning(const QString &warningMsg, qreal value) -> qreal
|
||||||
{
|
{
|
||||||
Q_UNUSED(warningMsg);
|
Q_UNUSED(warningMsg);
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ public:
|
||||||
const QMap<QString, QString> &translatedFunctions = QMap<QString, QString>());
|
const QMap<QString, QString> &translatedFunctions = QMap<QString, QString>());
|
||||||
virtual ~QmuTokenParser() = default;
|
virtual ~QmuTokenParser() = default;
|
||||||
|
|
||||||
static bool IsSingle(const QString &formula);
|
static auto IsSingle(const QString &formula) -> bool;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static qreal Warning(const QString &warningMsg, qreal value);
|
static auto Warning(const QString &warningMsg, qreal value) -> qreal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY_MOVE(QmuTokenParser) // NOLINT
|
Q_DISABLE_COPY_MOVE(QmuTokenParser) // NOLINT
|
||||||
|
|
|
@ -30,8 +30,8 @@ namespace qmu
|
||||||
{
|
{
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuTranslation QmuTranslation::translate(const char *context, const char *sourceText,
|
auto QmuTranslation::translate(const char *context, const char *sourceText, const char *disambiguation, int n)
|
||||||
const char *disambiguation, int n)
|
-> QmuTranslation
|
||||||
{
|
{
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ QmuTranslation::QmuTranslation(const QString &context, const QString &sourceText
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuTranslation &QmuTranslation::operator=(const QmuTranslation &tr)
|
auto QmuTranslation::operator=(const QmuTranslation &tr) -> QmuTranslation &
|
||||||
{
|
{
|
||||||
if ( &tr == this )
|
if ( &tr == this )
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ QmuTranslation::QmuTranslation(const QmuTranslation &tr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QString QmuTranslation::translate(const QString &locale) const
|
auto QmuTranslation::translate(const QString &locale) const -> QString
|
||||||
{
|
{
|
||||||
if (cachedTranslation.isEmpty() || locale.isEmpty() || localeName != locale)
|
if (cachedTranslation.isEmpty() || locale.isEmpty() || localeName != locale)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,15 +56,16 @@ public:
|
||||||
~QmuTranslation(){}
|
~QmuTranslation(){}
|
||||||
QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation = QString(),
|
QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation = QString(),
|
||||||
int n = -1);
|
int n = -1);
|
||||||
QmuTranslation &operator=(const QmuTranslation &tr);
|
auto operator=(const QmuTranslation &tr) -> QmuTranslation &;
|
||||||
QmuTranslation(const QmuTranslation &tr);
|
QmuTranslation(const QmuTranslation &tr);
|
||||||
QString translate(const QString &locale) const;
|
auto translate(const QString &locale) const -> QString;
|
||||||
static QmuTranslation translate(const char * context, const char * sourceText,
|
static auto translate(const char *context, const char *sourceText, const char *disambiguation = nullptr, int n = -1)
|
||||||
const char * disambiguation = nullptr, int n = -1);
|
-> QmuTranslation;
|
||||||
QString getMcontext() const;
|
auto getMcontext() const -> QString;
|
||||||
QString getMsourceText() const;
|
auto getMsourceText() const -> QString;
|
||||||
QString getMdisambiguation() const;
|
auto getMdisambiguation() const -> QString;
|
||||||
int getN() const;
|
auto getN() const -> int;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mcontext;
|
QString mcontext;
|
||||||
QString msourceText;
|
QString msourceText;
|
||||||
|
@ -75,25 +76,25 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString QmuTranslation::getMcontext() const
|
inline auto QmuTranslation::getMcontext() const -> QString
|
||||||
{
|
{
|
||||||
return mcontext;
|
return mcontext;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString QmuTranslation::getMsourceText() const
|
inline auto QmuTranslation::getMsourceText() const -> QString
|
||||||
{
|
{
|
||||||
return msourceText;
|
return msourceText;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline QString QmuTranslation::getMdisambiguation() const
|
inline auto QmuTranslation::getMdisambiguation() const -> QString
|
||||||
{
|
{
|
||||||
return mdisambiguation;
|
return mdisambiguation;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
inline int QmuTranslation::getN() const
|
inline auto QmuTranslation::getN() const -> int
|
||||||
{
|
{
|
||||||
return mn;
|
return mn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
const QString endStringPlaceholder = QStringLiteral("%&?_?&%");
|
const QString endStringPlaceholder = QStringLiteral("%&?_?&%");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QMap<QString, QString> LocaleMap()
|
auto LocaleMap() -> QMap<QString, QString>
|
||||||
{
|
{
|
||||||
QMap <QString, QString> locMap
|
QMap <QString, QString> locMap
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,14 +41,14 @@ enum class VarInsunits : quint8 { Inches=1, Millimeters=4, Centimeters=5 };
|
||||||
// Helps mark end of string. See VDxfEngine::drawTextItem for more details
|
// Helps mark end of string. See VDxfEngine::drawTextItem for more details
|
||||||
extern const QString endStringPlaceholder;
|
extern const QString endStringPlaceholder;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT static inline bool DL_FuzzyComparePossibleNulls(double p1, double p2);
|
Q_REQUIRED_RESULT static inline auto DL_FuzzyComparePossibleNulls(double p1, double p2) -> bool;
|
||||||
static inline bool DL_FuzzyComparePossibleNulls(double p1, double p2)
|
static inline auto DL_FuzzyComparePossibleNulls(double p1, double p2) -> bool
|
||||||
{
|
{
|
||||||
if(qFuzzyIsNull(p1))
|
if(qFuzzyIsNull(p1))
|
||||||
{
|
{
|
||||||
return qFuzzyIsNull(p2);
|
return qFuzzyIsNull(p2);
|
||||||
}
|
}
|
||||||
else if(qFuzzyIsNull(p2))
|
if (qFuzzyIsNull(p2))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,6 @@ static inline bool DL_FuzzyComparePossibleNulls(double p1, double p2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap <QString, QString> LocaleMap();
|
auto LocaleMap() -> QMap<QString, QString>;
|
||||||
|
|
||||||
#endif // DXFDEF_H
|
#endif // DXFDEF_H
|
||||||
|
|
|
@ -35,7 +35,7 @@ dx_iface::~dx_iface()
|
||||||
delete dxfW;
|
delete dxfW;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dx_iface::fileExport(bool binary)
|
auto dx_iface::fileExport(bool binary) -> bool
|
||||||
{
|
{
|
||||||
bool success = dxfW->write(this, version, binary);
|
bool success = dxfW->write(this, version, binary);
|
||||||
return success;
|
return success;
|
||||||
|
@ -110,7 +110,7 @@ void dx_iface::writeEntity(DRW_Entity* e){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dx_iface::ErrorString() const
|
auto dx_iface::ErrorString() const -> std::string
|
||||||
{
|
{
|
||||||
return dxfW->ErrorString();
|
return dxfW->ErrorString();
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ void dx_iface::AddEntity(DRW_Entity *e)
|
||||||
cData.mBlock->ent.push_back(e);
|
cData.mBlock->ent.push_back(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
UTF8STRING dx_iface::AddFont(const QFont &f)
|
auto dx_iface::AddFont(const QFont &f) -> UTF8STRING
|
||||||
{
|
{
|
||||||
DRW_Textstyle ts;
|
DRW_Textstyle ts;
|
||||||
ts.name = f.family().toUpper().toStdString();
|
ts.name = f.family().toUpper().toStdString();
|
||||||
|
@ -480,7 +480,7 @@ void dx_iface::AddBlock(dx_ifaceBlock *block)
|
||||||
cData.blocks.push_back(block);
|
cData.blocks.push_back(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string dx_iface::LocaleToISO()
|
auto dx_iface::LocaleToISO() -> std::string
|
||||||
{
|
{
|
||||||
QMap <QString, QString> locMap = LocaleMap();
|
QMap <QString, QString> locMap = LocaleMap();
|
||||||
return locMap.value(QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()).name(),
|
return locMap.value(QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()).name(),
|
||||||
|
|
|
@ -98,15 +98,15 @@ class dx_iface final : public DRW_Interface
|
||||||
public:
|
public:
|
||||||
dx_iface(const std::string& file, DRW::Version v, VarMeasurement varMeasurement, VarInsunits varInsunits);
|
dx_iface(const std::string& file, DRW::Version v, VarMeasurement varMeasurement, VarInsunits varInsunits);
|
||||||
virtual ~dx_iface();
|
virtual ~dx_iface();
|
||||||
bool fileExport(bool binary);
|
auto fileExport(bool binary) -> bool;
|
||||||
void writeEntity(DRW_Entity* e);
|
void writeEntity(DRW_Entity* e);
|
||||||
|
|
||||||
void AddXSpaceBlock(bool add) {dxfW->AddXSpaceBlock(add);}
|
void AddXSpaceBlock(bool add) {dxfW->AddXSpaceBlock(add);}
|
||||||
|
|
||||||
std::string ErrorString() const;
|
auto ErrorString() const -> std::string;
|
||||||
|
|
||||||
//reimplement virtual DRW_Interface functions
|
// reimplement virtual DRW_Interface functions
|
||||||
//writer part, send all in class dx_data to writer
|
// writer part, send all in class dx_data to writer
|
||||||
virtual void writeHeader(DRW_Header& data) override;
|
virtual void writeHeader(DRW_Header& data) override;
|
||||||
virtual void writeBlocks() override;
|
virtual void writeBlocks() override;
|
||||||
//only send the name, needed by the reader to prepare handles of blocks & blockRecords
|
//only send the name, needed by the reader to prepare handles of blocks & blockRecords
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
virtual void writeAppId() override;
|
virtual void writeAppId() override;
|
||||||
|
|
||||||
void AddEntity(DRW_Entity* e);
|
void AddEntity(DRW_Entity* e);
|
||||||
UTF8STRING AddFont(const QFont &f);
|
auto AddFont(const QFont &f) -> UTF8STRING;
|
||||||
void AddBlock(dx_ifaceBlock* block);
|
void AddBlock(dx_ifaceBlock* block);
|
||||||
|
|
||||||
void AddQtLTypes();
|
void AddQtLTypes();
|
||||||
|
@ -143,7 +143,7 @@ private:
|
||||||
void InitVPorts();
|
void InitVPorts();
|
||||||
void InitAppId();
|
void InitAppId();
|
||||||
|
|
||||||
static std::string LocaleToISO();
|
static auto LocaleToISO() -> std::string;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DX_IFACE_H
|
#endif // DX_IFACE_H
|
||||||
|
|
|
@ -264,14 +264,14 @@ enum TransparencyCodes {
|
||||||
|
|
||||||
} // namespace DRW
|
} // namespace DRW
|
||||||
|
|
||||||
Q_REQUIRED_RESULT static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2);
|
Q_REQUIRED_RESULT static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool;
|
||||||
static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2)
|
static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool
|
||||||
{
|
{
|
||||||
if(qFuzzyIsNull(p1))
|
if(qFuzzyIsNull(p1))
|
||||||
{
|
{
|
||||||
return qFuzzyIsNull(p2);
|
return qFuzzyIsNull(p2);
|
||||||
}
|
}
|
||||||
else if(qFuzzyIsNull(p2))
|
if (qFuzzyIsNull(p2))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -283,9 +283,9 @@ static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2)
|
||||||
|
|
||||||
//! Class to handle 3D coordinate point
|
//! Class to handle 3D coordinate point
|
||||||
/*!
|
/*!
|
||||||
* Class to handle 3D coordinate point
|
* Class to handle 3D coordinate point
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
class DRW_Coord {
|
class DRW_Coord {
|
||||||
public:
|
public:
|
||||||
DRW_Coord() = default;
|
DRW_Coord() = default;
|
||||||
|
@ -301,7 +301,7 @@ public:
|
||||||
z(data.z)
|
z(data.z)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
DRW_Coord &operator = (const DRW_Coord& data)
|
auto operator=(const DRW_Coord &data) -> DRW_Coord &
|
||||||
{
|
{
|
||||||
if ( &data == this )
|
if ( &data == this )
|
||||||
{
|
{
|
||||||
|
@ -483,7 +483,7 @@ public:
|
||||||
int code; /*!< dxf code of this value*/
|
int code; /*!< dxf code of this value*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DRW_Variant &operator=(const DRW_Variant &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_Variant &) -> DRW_Variant &Q_DECL_EQ_DELETE;
|
||||||
std::string sdata;
|
std::string sdata;
|
||||||
DRW_Coord vdata;
|
DRW_Coord vdata;
|
||||||
};
|
};
|
||||||
|
@ -527,7 +527,8 @@ public:
|
||||||
widthDefault = 31 /*!< by default (dxf -3) */
|
widthDefault = 31 /*!< by default (dxf -3) */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int lineWidth2dxfInt(lineWidth lw){
|
static auto lineWidth2dxfInt(lineWidth lw) -> int
|
||||||
|
{
|
||||||
switch (lw){
|
switch (lw){
|
||||||
case widthByLayer:
|
case widthByLayer:
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -589,61 +590,110 @@ public:
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lineWidth dxfInt2lineWidth(int i){
|
static auto dxfInt2lineWidth(int i) -> lineWidth
|
||||||
|
{
|
||||||
if (i<0) {
|
if (i<0) {
|
||||||
if (i==-1)
|
if (i==-1)
|
||||||
return widthByLayer;
|
return widthByLayer;
|
||||||
else if (i==-2)
|
if (i == -2)
|
||||||
return widthByBlock;
|
return widthByBlock;
|
||||||
else if (i==-3)
|
else if (i == -3)
|
||||||
return widthDefault;
|
return widthDefault;
|
||||||
} else if (i<3) {
|
}
|
||||||
|
else if (i < 3)
|
||||||
|
{
|
||||||
return width00;
|
return width00;
|
||||||
} else if (i<7) {
|
}
|
||||||
|
else if (i < 7)
|
||||||
|
{
|
||||||
return width01;
|
return width01;
|
||||||
} else if (i<11) {
|
}
|
||||||
|
else if (i < 11)
|
||||||
|
{
|
||||||
return width02;
|
return width02;
|
||||||
} else if (i<14) {
|
}
|
||||||
|
else if (i < 14)
|
||||||
|
{
|
||||||
return width03;
|
return width03;
|
||||||
} else if (i<16) {
|
}
|
||||||
|
else if (i < 16)
|
||||||
|
{
|
||||||
return width04;
|
return width04;
|
||||||
} else if (i<19) {
|
}
|
||||||
|
else if (i < 19)
|
||||||
|
{
|
||||||
return width05;
|
return width05;
|
||||||
} else if (i<22) {
|
}
|
||||||
|
else if (i < 22)
|
||||||
|
{
|
||||||
return width06;
|
return width06;
|
||||||
} else if (i<27) {
|
}
|
||||||
|
else if (i < 27)
|
||||||
|
{
|
||||||
return width07;
|
return width07;
|
||||||
} else if (i<32) {
|
}
|
||||||
|
else if (i < 32)
|
||||||
|
{
|
||||||
return width08;
|
return width08;
|
||||||
} else if (i<37) {
|
}
|
||||||
|
else if (i < 37)
|
||||||
|
{
|
||||||
return width09;
|
return width09;
|
||||||
} else if (i<45) {
|
}
|
||||||
|
else if (i < 45)
|
||||||
|
{
|
||||||
return width10;
|
return width10;
|
||||||
} else if (i<52) {
|
}
|
||||||
|
else if (i < 52)
|
||||||
|
{
|
||||||
return width11;
|
return width11;
|
||||||
} else if (i<57) {
|
}
|
||||||
|
else if (i < 57)
|
||||||
|
{
|
||||||
return width12;
|
return width12;
|
||||||
} else if (i<65) {
|
}
|
||||||
|
else if (i < 65)
|
||||||
|
{
|
||||||
return width13;
|
return width13;
|
||||||
} else if (i<75) {
|
}
|
||||||
|
else if (i < 75)
|
||||||
|
{
|
||||||
return width14;
|
return width14;
|
||||||
} else if (i<85) {
|
}
|
||||||
|
else if (i < 85)
|
||||||
|
{
|
||||||
return width15;
|
return width15;
|
||||||
} else if (i<95) {
|
}
|
||||||
|
else if (i < 95)
|
||||||
|
{
|
||||||
return width16;
|
return width16;
|
||||||
} else if (i<103) {
|
}
|
||||||
|
else if (i < 103)
|
||||||
|
{
|
||||||
return width17;
|
return width17;
|
||||||
} else if (i<112) {
|
}
|
||||||
|
else if (i < 112)
|
||||||
|
{
|
||||||
return width18;
|
return width18;
|
||||||
} else if (i<130) {
|
}
|
||||||
|
else if (i < 130)
|
||||||
|
{
|
||||||
return width19;
|
return width19;
|
||||||
} else if (i<149) {
|
}
|
||||||
|
else if (i < 149)
|
||||||
|
{
|
||||||
return width20;
|
return width20;
|
||||||
} else if (i<180) {
|
}
|
||||||
|
else if (i < 180)
|
||||||
|
{
|
||||||
return width21;
|
return width21;
|
||||||
} else if (i<205) {
|
}
|
||||||
|
else if (i < 205)
|
||||||
|
{
|
||||||
return width22;
|
return width22;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return width23;
|
return width23;
|
||||||
}
|
}
|
||||||
//default by default
|
//default by default
|
||||||
|
|
|
@ -70,7 +70,8 @@ void DRW_Entity::extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const{
|
||||||
point->z = pz;
|
point->z = pz;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Entity::parseCode(int code, dxfReader *reader){
|
auto DRW_Entity::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 5:
|
case 5:
|
||||||
handle = static_cast<quint32>(reader->getHandleString());
|
handle = static_cast<quint32>(reader->getHandleString());
|
||||||
|
@ -157,7 +158,8 @@ bool DRW_Entity::parseCode(int code, dxfReader *reader){
|
||||||
}
|
}
|
||||||
|
|
||||||
//parses dxf 102 groups to read entity
|
//parses dxf 102 groups to read entity
|
||||||
bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){
|
auto DRW_Entity::parseDxfGroups(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
std::list<DRW_Variant> ls;
|
std::list<DRW_Variant> ls;
|
||||||
DRW_Variant c;
|
DRW_Variant c;
|
||||||
int nc;
|
int nc;
|
||||||
|
@ -198,7 +200,8 @@ bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Point::parseCode(int code, dxfReader *reader){
|
auto DRW_Point::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 10:
|
case 10:
|
||||||
basePoint.x = reader->getDouble();
|
basePoint.x = reader->getDouble();
|
||||||
|
@ -229,7 +232,7 @@ bool DRW_Point::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_ASTMNotch::parseCode(int code, dxfReader *reader)
|
auto DRW_ASTMNotch::parseCode(int code, dxfReader *reader) -> bool
|
||||||
{
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 50:
|
case 50:
|
||||||
|
@ -242,7 +245,8 @@ bool DRW_ASTMNotch::parseCode(int code, dxfReader *reader)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Line::parseCode(int code, dxfReader *reader){
|
auto DRW_Line::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 11:
|
case 11:
|
||||||
secPoint.x = reader->getDouble();
|
secPoint.x = reader->getDouble();
|
||||||
|
@ -269,7 +273,8 @@ void DRW_Circle::applyExtrusion(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Circle::parseCode(int code, dxfReader *reader){
|
auto DRW_Circle::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 40:
|
case 40:
|
||||||
radious = reader->getDouble();
|
radious = reader->getDouble();
|
||||||
|
@ -301,7 +306,8 @@ void DRW_Arc::applyExtrusion(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Arc::parseCode(int code, dxfReader *reader){
|
auto DRW_Arc::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 50:
|
case 50:
|
||||||
staangle = reader->getDouble()/ ARAD;
|
staangle = reader->getDouble()/ ARAD;
|
||||||
|
@ -316,7 +322,8 @@ bool DRW_Arc::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Ellipse::parseCode(int code, dxfReader *reader){
|
auto DRW_Ellipse::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 40:
|
case 40:
|
||||||
ratio = reader->getDouble();
|
ratio = reader->getDouble();
|
||||||
|
@ -416,7 +423,8 @@ void DRW_Trace::applyExtrusion(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Trace::parseCode(int code, dxfReader *reader){
|
auto DRW_Trace::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 12:
|
case 12:
|
||||||
thirdPoint.x = reader->getDouble();
|
thirdPoint.x = reader->getDouble();
|
||||||
|
@ -443,7 +451,8 @@ bool DRW_Trace::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_3Dface::parseCode(int code, dxfReader *reader){
|
auto DRW_3Dface::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 70:
|
case 70:
|
||||||
invisibleflag = reader->getInt32();
|
invisibleflag = reader->getInt32();
|
||||||
|
@ -455,7 +464,8 @@ bool DRW_3Dface::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Block::parseCode(int code, dxfReader *reader){
|
auto DRW_Block::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 2:
|
case 2:
|
||||||
name = reader->getUtf8String();
|
name = reader->getUtf8String();
|
||||||
|
@ -470,7 +480,8 @@ bool DRW_Block::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Insert::parseCode(int code, dxfReader *reader){
|
auto DRW_Insert::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 2:
|
case 2:
|
||||||
name = reader->getUtf8String();
|
name = reader->getUtf8String();
|
||||||
|
@ -520,7 +531,8 @@ void DRW_LWPolyline::applyExtrusion(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_LWPolyline::parseCode(int code, dxfReader *reader){
|
auto DRW_LWPolyline::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 10: {
|
case 10: {
|
||||||
vertex = new DRW_Vertex2D();
|
vertex = new DRW_Vertex2D();
|
||||||
|
@ -575,7 +587,8 @@ bool DRW_LWPolyline::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Text::parseCode(int code, dxfReader *reader){
|
auto DRW_Text::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 40:
|
case 40:
|
||||||
height = reader->getDouble();
|
height = reader->getDouble();
|
||||||
|
@ -611,7 +624,8 @@ bool DRW_Text::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_MText::parseCode(int code, dxfReader *reader){
|
auto DRW_MText::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1:
|
case 1:
|
||||||
text += reader->getString();
|
text += reader->getString();
|
||||||
|
@ -697,7 +711,8 @@ void DRW_MText::updateAngle(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Polyline::parseCode(int code, dxfReader *reader){
|
auto DRW_Polyline::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 70:
|
case 70:
|
||||||
flags = reader->getInt32();
|
flags = reader->getInt32();
|
||||||
|
@ -730,7 +745,8 @@ bool DRW_Polyline::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Vertex::parseCode(int code, dxfReader *reader){
|
auto DRW_Vertex::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 70:
|
case 70:
|
||||||
flags = reader->getInt32();
|
flags = reader->getInt32();
|
||||||
|
@ -769,7 +785,8 @@ bool DRW_Vertex::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Hatch::parseCode(int code, dxfReader *reader){
|
auto DRW_Hatch::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 2:
|
case 2:
|
||||||
name = reader->getUtf8String();
|
name = reader->getUtf8String();
|
||||||
|
@ -876,7 +893,8 @@ bool DRW_Hatch::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Spline::parseCode(int code, dxfReader *reader){
|
auto DRW_Spline::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 210:
|
case 210:
|
||||||
normalVec.x = reader->getDouble();
|
normalVec.x = reader->getDouble();
|
||||||
|
@ -968,7 +986,8 @@ bool DRW_Spline::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Image::parseCode(int code, dxfReader *reader){
|
auto DRW_Image::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 12:
|
case 12:
|
||||||
vVector.x = reader->getDouble();
|
vVector.x = reader->getDouble();
|
||||||
|
@ -1007,7 +1026,8 @@ bool DRW_Image::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Dimension::parseCode(int code, dxfReader *reader){
|
auto DRW_Dimension::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1:
|
case 1:
|
||||||
text = reader->getUtf8String();
|
text = reader->getUtf8String();
|
||||||
|
@ -1128,7 +1148,8 @@ bool DRW_Dimension::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Leader::parseCode(int code, dxfReader *reader){
|
auto DRW_Leader::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 3:
|
case 3:
|
||||||
style = reader->getUtf8String();
|
style = reader->getUtf8String();
|
||||||
|
@ -1219,7 +1240,8 @@ bool DRW_Leader::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Viewport::parseCode(int code, dxfReader *reader){
|
auto DRW_Viewport::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 40:
|
case 40:
|
||||||
pswidth = reader->getDouble();
|
pswidth = reader->getDouble();
|
||||||
|
|
|
@ -185,14 +185,14 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//parses dxf pair to read entity
|
//parses dxf pair to read entity
|
||||||
virtual bool parseCode(int code, dxfReader *reader);
|
virtual auto parseCode(int code, dxfReader *reader) -> bool;
|
||||||
//calculates extrusion axis (normal vector)
|
//calculates extrusion axis (normal vector)
|
||||||
void calculateAxis(DRW_Coord extPoint);
|
void calculateAxis(DRW_Coord extPoint);
|
||||||
//apply extrusion to @extPoint and return data in @point
|
//apply extrusion to @extPoint and return data in @point
|
||||||
void extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const;
|
void extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const;
|
||||||
|
|
||||||
//parses dxf 102 groups to read entity
|
//parses dxf 102 groups to read entity
|
||||||
bool parseDxfGroups(int code, dxfReader *reader);
|
auto parseDxfGroups(int code, dxfReader *reader) -> bool;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DRW::ETYPE eType; /*!< enum: entity type, code 0 */
|
DRW::ETYPE eType; /*!< enum: entity type, code 0 */
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
std::vector<DRW_Variant*> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
std::vector<DRW_Variant*> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DRW_Entity &operator=(const DRW_Entity &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_Entity &) -> DRW_Entity &Q_DECL_EQ_DELETE;
|
||||||
DRW_Coord extAxisX;
|
DRW_Coord extAxisX;
|
||||||
DRW_Coord extAxisY;
|
DRW_Coord extAxisY;
|
||||||
DRW_Variant* curr;
|
DRW_Variant* curr;
|
||||||
|
@ -241,7 +241,7 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DRW_Coord basePoint{}; /*!< base point, code 10, 20 & 30 */
|
DRW_Coord basePoint{}; /*!< base point, code 10, 20 & 30 */
|
||||||
|
@ -284,7 +284,7 @@ public:
|
||||||
void applyExtrusion() override{}
|
void applyExtrusion() override{}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
|
DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
|
||||||
|
@ -332,7 +332,7 @@ public:
|
||||||
void applyExtrusion() override;
|
void applyExtrusion() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double radious; /*!< radius, code 40 */
|
double radious; /*!< radius, code 40 */
|
||||||
|
@ -357,21 +357,21 @@ public:
|
||||||
void applyExtrusion() override;
|
void applyExtrusion() override;
|
||||||
|
|
||||||
//! center point in OCS
|
//! center point in OCS
|
||||||
const DRW_Coord & center() const { return basePoint; }
|
auto center() const -> const DRW_Coord & { return basePoint; }
|
||||||
//! the radius of the circle
|
//! the radius of the circle
|
||||||
double radius() const { return radious; }
|
auto radius() const -> double { return radious; }
|
||||||
//! start angle in radians
|
//! start angle in radians
|
||||||
double startAngle() const { return staangle; }
|
auto startAngle() const -> double { return staangle; }
|
||||||
//! end angle in radians
|
//! end angle in radians
|
||||||
double endAngle() const { return endangle; }
|
auto endAngle() const -> double { return endangle; }
|
||||||
//! thickness
|
//! thickness
|
||||||
double thick() const { return thickness; }
|
auto thick() const -> double { return thickness; }
|
||||||
//! extrusion
|
//! extrusion
|
||||||
const DRW_Coord & extrusion() const { return extPoint; }
|
auto extrusion() const -> const DRW_Coord & { return extPoint; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! interpret code in dxf reading process or dispatch to inherited class
|
//! interpret code in dxf reading process or dispatch to inherited class
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double staangle; /*!< start angle, code 50 in radians*/
|
double staangle; /*!< start angle, code 50 in radians*/
|
||||||
|
@ -403,7 +403,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! interpret code in dxf reading process or dispatch to inherited class
|
//! interpret code in dxf reading process or dispatch to inherited class
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void correctAxis();
|
void correctAxis();
|
||||||
|
@ -433,7 +433,7 @@ public:
|
||||||
void applyExtrusion() override;
|
void applyExtrusion() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
|
DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
|
||||||
|
@ -454,20 +454,19 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//! first corner (2D)
|
//! first corner (2D)
|
||||||
const DRW_Coord & firstCorner() const { return basePoint; }
|
auto firstCorner() const -> const DRW_Coord & { return basePoint; }
|
||||||
//! second corner (2D)
|
//! second corner (2D)
|
||||||
const DRW_Coord & secondCorner() const { return secPoint; }
|
auto secondCorner() const -> const DRW_Coord & { return secPoint; }
|
||||||
//! third corner (2D)
|
//! third corner (2D)
|
||||||
const DRW_Coord & thirdCorner() const { return thirdPoint; }
|
auto thirdCorner() const -> const DRW_Coord & { return thirdPoint; }
|
||||||
//! fourth corner (2D)
|
//! fourth corner (2D)
|
||||||
const DRW_Coord & fourthCorner() const { return thirdPoint; }
|
auto fourthCorner() const -> const DRW_Coord & { return thirdPoint; }
|
||||||
//! thickness
|
//! thickness
|
||||||
double thick() const { return thickness; }
|
auto thick() const -> double { return thickness; }
|
||||||
//! elevation
|
//! elevation
|
||||||
double elevation() const { return basePoint.z; }
|
auto elevation() const -> double { return basePoint.z; }
|
||||||
//! extrusion
|
//! extrusion
|
||||||
const DRW_Coord & extrusion() const { return extPoint; }
|
auto extrusion() const -> const DRW_Coord & { return extPoint; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Class to handle 3dface entity
|
//! Class to handle 3dface entity
|
||||||
|
@ -496,19 +495,19 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
//! first corner in WCS
|
//! first corner in WCS
|
||||||
const DRW_Coord & firstCorner() const { return basePoint; }
|
auto firstCorner() const -> const DRW_Coord & { return basePoint; }
|
||||||
//! second corner in WCS
|
//! second corner in WCS
|
||||||
const DRW_Coord & secondCorner() const { return secPoint; }
|
auto secondCorner() const -> const DRW_Coord & { return secPoint; }
|
||||||
//! third corner in WCS
|
//! third corner in WCS
|
||||||
const DRW_Coord & thirdCorner() const { return thirdPoint; }
|
auto thirdCorner() const -> const DRW_Coord & { return thirdPoint; }
|
||||||
//! fourth corner in WCS
|
//! fourth corner in WCS
|
||||||
const DRW_Coord & fourthCorner() const { return fourPoint; }
|
auto fourthCorner() const -> const DRW_Coord & { return fourPoint; }
|
||||||
//! edge visibility flags
|
//! edge visibility flags
|
||||||
InvisibleEdgeFlags edgeFlags() const { return static_cast<InvisibleEdgeFlags>(invisibleflag); }
|
auto edgeFlags() const -> InvisibleEdgeFlags { return static_cast<InvisibleEdgeFlags>(invisibleflag); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! interpret code in dxf reading process or dispatch to inherited class
|
//! interpret code in dxf reading process or dispatch to inherited class
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int invisibleflag; /*!< invisible edge flag, code 70 */
|
int invisibleflag; /*!< invisible edge flag, code 70 */
|
||||||
|
@ -534,7 +533,7 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UTF8STRING name; /*!< block name, code 2 */
|
UTF8STRING name; /*!< block name, code 2 */
|
||||||
|
@ -565,7 +564,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UTF8STRING name; /*!< block name, code 2 */
|
UTF8STRING name; /*!< block name, code 2 */
|
||||||
|
@ -629,7 +628,8 @@ public:
|
||||||
vert->bulge = v.bulge;
|
vert->bulge = v.bulge;
|
||||||
vertlist.push_back(vert);
|
vertlist.push_back(vert);
|
||||||
}
|
}
|
||||||
DRW_Vertex2D *addVertex () {
|
auto addVertex() -> DRW_Vertex2D *
|
||||||
|
{
|
||||||
DRW_Vertex2D *vert = new DRW_Vertex2D();
|
DRW_Vertex2D *vert = new DRW_Vertex2D();
|
||||||
vert->stawidth = 0;
|
vert->stawidth = 0;
|
||||||
vert->endwidth = 0;
|
vert->endwidth = 0;
|
||||||
|
@ -639,7 +639,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int vertexnum; /*!< number of vertex, code 90 */
|
int vertexnum; /*!< number of vertex, code 90 */
|
||||||
|
@ -651,7 +651,7 @@ public:
|
||||||
DRW_Vertex2D *vertex; /*!< current vertex to add data */
|
DRW_Vertex2D *vertex; /*!< current vertex to add data */
|
||||||
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
|
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
|
||||||
private:
|
private:
|
||||||
DRW_LWPolyline &operator=(const DRW_LWPolyline &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_LWPolyline &) -> DRW_LWPolyline &Q_DECL_EQ_DELETE;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Class to handle insert entries
|
//! Class to handle insert entries
|
||||||
|
@ -697,7 +697,7 @@ public:
|
||||||
void applyExtrusion() override {} //RLZ TODO
|
void applyExtrusion() override {} //RLZ TODO
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double height; /*!< height text, code 40 */
|
double height; /*!< height text, code 40 */
|
||||||
|
@ -742,7 +742,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
void updateAngle(); //recalculate angle if 'haveXAxis' is true
|
void updateAngle(); //recalculate angle if 'haveXAxis' is true
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -792,7 +792,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double stawidth; /*!< Start width, code 40 */
|
double stawidth; /*!< Start width, code 40 */
|
||||||
|
@ -871,7 +871,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int flags; /*!< polyline flag, code 70, default 0 */
|
int flags; /*!< polyline flag, code 70, default 0 */
|
||||||
|
@ -886,7 +886,7 @@ public:
|
||||||
std::vector<DRW_Vertex *> vertlist; /*!< vertex list */
|
std::vector<DRW_Vertex *> vertlist; /*!< vertex list */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DRW_Polyline &operator=(const DRW_Polyline &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_Polyline &) -> DRW_Polyline &Q_DECL_EQ_DELETE;
|
||||||
std::list<duint32>handlesList; //list of handles, only in 2004+
|
std::list<duint32>handlesList; //list of handles, only in 2004+
|
||||||
duint32 firstEH; //handle of first entity, only in pre-2004
|
duint32 firstEH; //handle of first entity, only in pre-2004
|
||||||
duint32 lastEH; //handle of last entity, only in pre-2004
|
duint32 lastEH; //handle of last entity, only in pre-2004
|
||||||
|
@ -960,7 +960,7 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// double ex; /*!< normal vector x coordinate, code 210 */
|
// double ex; /*!< normal vector x coordinate, code 210 */
|
||||||
|
@ -990,7 +990,7 @@ public:
|
||||||
std::vector<DRW_Coord *> fitlist; /*!< fit points list, code 11, 21 & 31 */
|
std::vector<DRW_Coord *> fitlist; /*!< fit points list, code 11, 21 & 31 */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DRW_Spline &operator=(const DRW_Spline &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_Spline &) -> DRW_Spline &Q_DECL_EQ_DELETE;
|
||||||
DRW_Coord *controlpoint; /*!< current control point to add data */
|
DRW_Coord *controlpoint; /*!< current control point to add data */
|
||||||
DRW_Coord *fitpoint; /*!< current fit point to add data */
|
DRW_Coord *fitpoint; /*!< current fit point to add data */
|
||||||
};
|
};
|
||||||
|
@ -1072,7 +1072,7 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UTF8STRING name; /*!< hatch pattern name, code 2 */
|
UTF8STRING name; /*!< hatch pattern name, code 2 */
|
||||||
|
@ -1167,7 +1167,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
duint32 ref; /*!< Hard reference to imagedef object, code 340 */
|
duint32 ref; /*!< Hard reference to imagedef object, code 340 */
|
||||||
|
@ -1254,56 +1254,68 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DRW_Coord getDefPoint() const {return defPoint;} /*!< Definition point, code 10, 20 & 30 */
|
auto getDefPoint() const -> DRW_Coord { return defPoint; } /*!< Definition point, code 10, 20 & 30 */
|
||||||
void setDefPoint(const DRW_Coord &p) {defPoint =p;}
|
void setDefPoint(const DRW_Coord &p) {defPoint =p;}
|
||||||
DRW_Coord getTextPoint() const {return textPoint;} /*!< Middle point of text, code 11, 21 & 31 */
|
auto getTextPoint() const -> DRW_Coord { return textPoint; } /*!< Middle point of text, code 11, 21 & 31 */
|
||||||
void setTextPoint(const DRW_Coord &p) {textPoint =p;}
|
void setTextPoint(const DRW_Coord &p) {textPoint =p;}
|
||||||
std::string getStyle() const {return style;} /*!< Dimension style, code 3 */
|
auto getStyle() const -> std::string { return style; } /*!< Dimension style, code 3 */
|
||||||
void setStyle(const std::string &s) {style = s;}
|
void setStyle(const std::string &s) {style = s;}
|
||||||
int getAlign() const { return align;} /*!< attachment point, code 71 */
|
auto getAlign() const -> int { return align; } /*!< attachment point, code 71 */
|
||||||
void setAlign(const int a) { align = a;}
|
void setAlign(const int a) { align = a;}
|
||||||
int getTextLineStyle() const { return linesty;} /*!< Dimension text line spacing style, code 72, default 1 */
|
auto getTextLineStyle() const -> int
|
||||||
|
{
|
||||||
|
return linesty;
|
||||||
|
} /*!< Dimension text line spacing style, code 72, default 1 */
|
||||||
void setTextLineStyle(const int l) { linesty = l;}
|
void setTextLineStyle(const int l) { linesty = l;}
|
||||||
std::string getText() const {return text;} /*!< Dimension text explicitly entered by the user, code 1 */
|
auto getText() const -> std::string { return text; } /*!< Dimension text explicitly entered by the user, code 1 */
|
||||||
void setText(const std::string &t) {text = t;}
|
void setText(const std::string &t) {text = t;}
|
||||||
double getTextLineFactor() const { return linefactor;} /*!< Dimension text line spacing factor, code 41, default 1? */
|
auto getTextLineFactor() const -> double
|
||||||
|
{
|
||||||
|
return linefactor;
|
||||||
|
} /*!< Dimension text line spacing factor, code 41, default 1? */
|
||||||
void setTextLineFactor(const double l) { linefactor = l;}
|
void setTextLineFactor(const double l) { linefactor = l;}
|
||||||
double getDir() const { return rot;} /*!< rotation angle of the dimension text, code 53 (optional) default 0 */
|
auto getDir() const -> double
|
||||||
|
{
|
||||||
|
return rot;
|
||||||
|
} /*!< rotation angle of the dimension text, code 53 (optional) default 0 */
|
||||||
void setDir(const double d) { rot = d;}
|
void setDir(const double d) { rot = d;}
|
||||||
|
|
||||||
DRW_Coord getExtrusion() const {return extPoint;} /*!< extrusion, code 210, 220 & 230 */
|
auto getExtrusion() const -> DRW_Coord { return extPoint; } /*!< extrusion, code 210, 220 & 230 */
|
||||||
void setExtrusion(const DRW_Coord &p) {extPoint = p;}
|
void setExtrusion(const DRW_Coord &p) {extPoint = p;}
|
||||||
std::string getName() const {return name;} /*!< Name of the block that contains the entities, code 2 */
|
auto getName() const -> std::string { return name; } /*!< Name of the block that contains the entities, code 2 */
|
||||||
void setName(const std::string &s) {name = s;}
|
void setName(const std::string &s) {name = s;}
|
||||||
// int getType(){ return type;} /*!< Dimension type, code 70 */
|
// int getType(){ return type;} /*!< Dimension type, code 70 */
|
||||||
bool hasActualMeasurement() const { return hasActual; }
|
auto hasActualMeasurement() const -> bool { return hasActual; }
|
||||||
void setActualMeasurement(double value) { hasActual = true; actual = value; }
|
void setActualMeasurement(double value) { hasActual = true; actual = value; }
|
||||||
double getActualMeasurement() const { return actual; }
|
auto getActualMeasurement() const -> double { return actual; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DRW_Coord getPt2() const {return clonePoint;}
|
auto getPt2() const -> DRW_Coord { return clonePoint; }
|
||||||
void setPt2(const DRW_Coord &p) {clonePoint= p;}
|
void setPt2(const DRW_Coord &p) {clonePoint= p;}
|
||||||
DRW_Coord getPt3() const {return def1;}
|
auto getPt3() const -> DRW_Coord { return def1; }
|
||||||
void setPt3(const DRW_Coord &p) {def1= p;}
|
void setPt3(const DRW_Coord &p) {def1= p;}
|
||||||
DRW_Coord getPt4() const {return def2;}
|
auto getPt4() const -> DRW_Coord { return def2; }
|
||||||
void setPt4(const DRW_Coord &p) {def2= p;}
|
void setPt4(const DRW_Coord &p) {def2= p;}
|
||||||
DRW_Coord getPt5() const {return circlePoint;}
|
auto getPt5() const -> DRW_Coord { return circlePoint; }
|
||||||
void setPt5(const DRW_Coord &p) {circlePoint= p;}
|
void setPt5(const DRW_Coord &p) {circlePoint= p;}
|
||||||
DRW_Coord getPt6() const {return arcPoint;}
|
auto getPt6() const -> DRW_Coord { return arcPoint; }
|
||||||
void setPt6(const DRW_Coord &p) {arcPoint= p;}
|
void setPt6(const DRW_Coord &p) {arcPoint= p;}
|
||||||
double getAn50() const {return angle;} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
auto getAn50() const -> double
|
||||||
|
{
|
||||||
|
return angle;
|
||||||
|
} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
||||||
void setAn50(const double d) {angle = d;}
|
void setAn50(const double d) {angle = d;}
|
||||||
double getOb52() const {return oblique;} /*!< oblique angle, code 52 */
|
auto getOb52() const -> double { return oblique; } /*!< oblique angle, code 52 */
|
||||||
void setOb52(const double d) {oblique = d;}
|
void setOb52(const double d) {oblique = d;}
|
||||||
double getRa40() const {return length;} /*!< Leader length, code 40 */
|
auto getRa40() const -> double { return length; } /*!< Leader length, code 40 */
|
||||||
void setRa40(const double d) {length = d;}
|
void setRa40(const double d) {length = d;}
|
||||||
public:
|
public:
|
||||||
int type; /*!< Dimension type, code 70 */
|
int type; /*!< Dimension type, code 70 */
|
||||||
private:
|
private:
|
||||||
DRW_Dimension &operator=(const DRW_Dimension &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_Dimension &) -> DRW_Dimension &Q_DECL_EQ_DELETE;
|
||||||
std::string name; /*!< Name of the block that contains the entities, code 2 */
|
std::string name; /*!< Name of the block that contains the entities, code 2 */
|
||||||
DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
|
DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
|
||||||
DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
|
DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
|
||||||
|
@ -1348,14 +1360,17 @@ public:
|
||||||
eType = DRW::DIMALIGNED;
|
eType = DRW::DIMALIGNED;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Coord getClonepoint() const {return getPt2();} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
|
auto getClonepoint() const -> DRW_Coord
|
||||||
|
{
|
||||||
|
return getPt2();
|
||||||
|
} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
|
||||||
void setClonePoint(const DRW_Coord &c){setPt2(c);}
|
void setClonePoint(const DRW_Coord &c){setPt2(c);}
|
||||||
|
|
||||||
DRW_Coord getDimPoint() const {return getDefPoint();} /*!< dim line location point, code 10, 20 & 30 */
|
auto getDimPoint() const -> DRW_Coord { return getDefPoint(); } /*!< dim line location point, code 10, 20 & 30 */
|
||||||
void setDimPoint(const DRW_Coord &p){setDefPoint(p);}
|
void setDimPoint(const DRW_Coord &p){setDefPoint(p);}
|
||||||
DRW_Coord getDef1Point() const {return getPt3();} /*!< Definition point 1, code 13, 23 & 33 */
|
auto getDef1Point() const -> DRW_Coord { return getPt3(); } /*!< Definition point 1, code 13, 23 & 33 */
|
||||||
void setDef1Point(const DRW_Coord &p) {setPt3(p);}
|
void setDef1Point(const DRW_Coord &p) {setPt3(p);}
|
||||||
DRW_Coord getDef2Point() const {return getPt4();} /*!< Definition point 2, code 14, 24 & 34 */
|
auto getDef2Point() const -> DRW_Coord { return getPt4(); } /*!< Definition point 2, code 14, 24 & 34 */
|
||||||
void setDef2Point(const DRW_Coord &p) {setPt4(p);}
|
void setDef2Point(const DRW_Coord &p) {setPt4(p);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1377,9 +1392,12 @@ public:
|
||||||
eType = DRW::DIMLINEAR;
|
eType = DRW::DIMLINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
double getAngle() const {return getAn50();} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
auto getAngle() const -> double
|
||||||
|
{
|
||||||
|
return getAn50();
|
||||||
|
} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
|
||||||
void setAngle(const double d) {setAn50(d);}
|
void setAngle(const double d) {setAn50(d);}
|
||||||
double getOblique() const {return getOb52();} /*!< oblique angle, code 52 */
|
auto getOblique() const -> double { return getOb52(); } /*!< oblique angle, code 52 */
|
||||||
void setOblique(const double d) {setOb52(d);}
|
void setOblique(const double d) {setOb52(d);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1401,11 +1419,14 @@ public:
|
||||||
eType = DRW::DIMRADIAL;
|
eType = DRW::DIMRADIAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Coord getCenterPoint() const {return getDefPoint();} /*!< center point, code 10, 20 & 30 */
|
auto getCenterPoint() const -> DRW_Coord { return getDefPoint(); } /*!< center point, code 10, 20 & 30 */
|
||||||
void setCenterPoint(const DRW_Coord &p){setDefPoint(p);}
|
void setCenterPoint(const DRW_Coord &p){setDefPoint(p);}
|
||||||
DRW_Coord getDiameterPoint() const {return getPt5();} /*!< Definition point for radius, code 15, 25 & 35 */
|
auto getDiameterPoint() const -> DRW_Coord
|
||||||
|
{
|
||||||
|
return getPt5();
|
||||||
|
} /*!< Definition point for radius, code 15, 25 & 35 */
|
||||||
void setDiameterPoint(const DRW_Coord &p){setPt5(p);}
|
void setDiameterPoint(const DRW_Coord &p){setPt5(p);}
|
||||||
double getLeaderLength() const {return getRa40();} /*!< Leader length, code 40 */
|
auto getLeaderLength() const -> double { return getRa40(); } /*!< Leader length, code 40 */
|
||||||
void setLeaderLength(const double d) {setRa40(d);}
|
void setLeaderLength(const double d) {setRa40(d);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1428,11 +1449,17 @@ public:
|
||||||
eType = DRW::DIMDIAMETRIC;
|
eType = DRW::DIMDIAMETRIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Coord getDiameter1Point() const {return getPt5();} /*!< First definition point for diameter, code 15, 25 & 35 */
|
auto getDiameter1Point() const -> DRW_Coord
|
||||||
|
{
|
||||||
|
return getPt5();
|
||||||
|
} /*!< First definition point for diameter, code 15, 25 & 35 */
|
||||||
void setDiameter1Point(const DRW_Coord &p){setPt5(p);}
|
void setDiameter1Point(const DRW_Coord &p){setPt5(p);}
|
||||||
DRW_Coord getDiameter2Point() const {return getDefPoint();} /*!< Opposite point for diameter, code 10, 20 & 30 */
|
auto getDiameter2Point() const -> DRW_Coord
|
||||||
|
{
|
||||||
|
return getDefPoint();
|
||||||
|
} /*!< Opposite point for diameter, code 10, 20 & 30 */
|
||||||
void setDiameter2Point(const DRW_Coord &p){setDefPoint(p);}
|
void setDiameter2Point(const DRW_Coord &p){setDefPoint(p);}
|
||||||
double getLeaderLength() const {return getRa40();} /*!< Leader length, code 40 */
|
auto getLeaderLength() const -> double { return getRa40(); } /*!< Leader length, code 40 */
|
||||||
void setLeaderLength(const double d) {setRa40(d);}
|
void setLeaderLength(const double d) {setRa40(d);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1454,15 +1481,18 @@ public:
|
||||||
eType = DRW::DIMANGULAR;
|
eType = DRW::DIMANGULAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Coord getFirstLine1() const {return getPt3();} /*!< Definition point line 1-1, code 13, 23 & 33 */
|
auto getFirstLine1() const -> DRW_Coord { return getPt3(); } /*!< Definition point line 1-1, code 13, 23 & 33 */
|
||||||
void setFirstLine1(const DRW_Coord &p) {setPt3(p);}
|
void setFirstLine1(const DRW_Coord &p) {setPt3(p);}
|
||||||
DRW_Coord getFirstLine2() const {return getPt4();} /*!< Definition point line 1-2, code 14, 24 & 34 */
|
auto getFirstLine2() const -> DRW_Coord { return getPt4(); } /*!< Definition point line 1-2, code 14, 24 & 34 */
|
||||||
void setFirstLine2(const DRW_Coord &p) {setPt4(p);}
|
void setFirstLine2(const DRW_Coord &p) {setPt4(p);}
|
||||||
DRW_Coord getSecondLine1() const {return getPt5();} /*!< Definition point line 2-1, code 15, 25 & 35 */
|
auto getSecondLine1() const -> DRW_Coord { return getPt5(); } /*!< Definition point line 2-1, code 15, 25 & 35 */
|
||||||
void setSecondLine1(const DRW_Coord &p) {setPt5(p);}
|
void setSecondLine1(const DRW_Coord &p) {setPt5(p);}
|
||||||
DRW_Coord getSecondLine2() const {return getDefPoint();} /*!< Definition point line 2-2, code 10, 20 & 30 */
|
auto getSecondLine2() const -> DRW_Coord
|
||||||
|
{
|
||||||
|
return getDefPoint();
|
||||||
|
} /*!< Definition point line 2-2, code 10, 20 & 30 */
|
||||||
void setSecondLine2(const DRW_Coord &p){setDefPoint(p);}
|
void setSecondLine2(const DRW_Coord &p){setDefPoint(p);}
|
||||||
DRW_Coord getDimPoint() const {return getPt6();} /*!< Dimension definition point, code 16, 26 & 36 */
|
auto getDimPoint() const -> DRW_Coord { return getPt6(); } /*!< Dimension definition point, code 16, 26 & 36 */
|
||||||
void setDimPoint(const DRW_Coord &p) {setPt6(p);}
|
void setDimPoint(const DRW_Coord &p) {setPt6(p);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1485,13 +1515,13 @@ public:
|
||||||
eType = DRW::DIMANGULAR3P;
|
eType = DRW::DIMANGULAR3P;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Coord getFirstLine() const {return getPt3();} /*!< Definition point line 1, code 13, 23 & 33 */
|
auto getFirstLine() const -> DRW_Coord { return getPt3(); } /*!< Definition point line 1, code 13, 23 & 33 */
|
||||||
void setFirstLine(const DRW_Coord &p) {setPt3(p);}
|
void setFirstLine(const DRW_Coord &p) {setPt3(p);}
|
||||||
DRW_Coord getSecondLine() const {return getPt4();} /*!< Definition point line 2, code 14, 24 & 34 */
|
auto getSecondLine() const -> DRW_Coord { return getPt4(); } /*!< Definition point line 2, code 14, 24 & 34 */
|
||||||
void setSecondLine(const DRW_Coord &p) {setPt4(p);}
|
void setSecondLine(const DRW_Coord &p) {setPt4(p);}
|
||||||
DRW_Coord getVertexPoint() const {return getPt5();} /*!< Vertex point, code 15, 25 & 35 */
|
auto getVertexPoint() const -> DRW_Coord { return getPt5(); } /*!< Vertex point, code 15, 25 & 35 */
|
||||||
void SetVertexPoint(const DRW_Coord &p) {setPt5(p);}
|
void SetVertexPoint(const DRW_Coord &p) {setPt5(p);}
|
||||||
DRW_Coord getDimPoint() const {return getDefPoint();} /*!< Dimension definition point, code 10, 20 & 30 */
|
auto getDimPoint() const -> DRW_Coord { return getDefPoint(); } /*!< Dimension definition point, code 10, 20 & 30 */
|
||||||
void setDimPoint(const DRW_Coord &p) {setDefPoint(p);}
|
void setDimPoint(const DRW_Coord &p) {setDefPoint(p);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1514,11 +1544,11 @@ public:
|
||||||
eType = DRW::DIMORDINATE;
|
eType = DRW::DIMORDINATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_Coord getOriginPoint() const {return getDefPoint();} /*!< Origin definition point, code 10, 20 & 30 */
|
auto getOriginPoint() const -> DRW_Coord { return getDefPoint(); } /*!< Origin definition point, code 10, 20 & 30 */
|
||||||
void setOriginPoint(const DRW_Coord &p) {setDefPoint(p);}
|
void setOriginPoint(const DRW_Coord &p) {setDefPoint(p);}
|
||||||
DRW_Coord getFirstLine() const {return getPt3();} /*!< Feature location point, code 13, 23 & 33 */
|
auto getFirstLine() const -> DRW_Coord { return getPt3(); } /*!< Feature location point, code 13, 23 & 33 */
|
||||||
void setFirstLine(const DRW_Coord &p) {setPt3(p);}
|
void setFirstLine(const DRW_Coord &p) {setPt3(p);}
|
||||||
DRW_Coord getSecondLine() const {return getPt4();} /*!< Leader end point, code 14, 24 & 34 */
|
auto getSecondLine() const -> DRW_Coord { return getPt4(); } /*!< Leader end point, code 14, 24 & 34 */
|
||||||
void setSecondLine(const DRW_Coord &p) {setPt4(p);}
|
void setSecondLine(const DRW_Coord &p) {setPt4(p);}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1560,7 +1590,7 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UTF8STRING style; /*!< Dimension style name, code 3 */
|
UTF8STRING style; /*!< Dimension style name, code 3 */
|
||||||
|
@ -1621,7 +1651,7 @@ public:
|
||||||
void applyExtrusion() override {}
|
void applyExtrusion() override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double pswidth; /*!< Width in paper space units, code 40 */
|
double pswidth; /*!< Width in paper space units, code 40 */
|
||||||
|
|
|
@ -39,7 +39,8 @@ void DRW_Header::addComment(const std::string &c){
|
||||||
comments += c;
|
comments += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Header::parseCode(int code, dxfReader *reader){
|
auto DRW_Header::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
if (nullptr == curr && 9 != code) {
|
if (nullptr == curr && 9 != code) {
|
||||||
DRW_DBG("invalid header code: ");
|
DRW_DBG("invalid header code: ");
|
||||||
DRW_DBG(code);
|
DRW_DBG(code);
|
||||||
|
@ -1705,7 +1706,7 @@ void DRW_Header::addCoord(std::string key, const DRW_Coord &value, int code){
|
||||||
vars[key] =curr;
|
vars[key] =curr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Header::getDouble(const std::string &key, double *varDouble) const
|
auto DRW_Header::getDouble(const std::string &key, double *varDouble) const -> bool
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
auto it=vars.find( key);
|
auto it=vars.find( key);
|
||||||
|
@ -1721,7 +1722,7 @@ bool DRW_Header::getDouble(const std::string &key, double *varDouble) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Header::getInt(const std::string &key, int *varInt) const
|
auto DRW_Header::getInt(const std::string &key, int *varInt) const -> bool
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
auto it=vars.find( key);
|
auto it=vars.find( key);
|
||||||
|
@ -1737,7 +1738,8 @@ bool DRW_Header::getInt(const std::string &key, int *varInt) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Header::getStr(const std::string &key, std::string *varStr) const{
|
auto DRW_Header::getStr(const std::string &key, std::string *varStr) const -> bool
|
||||||
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
auto it=vars.find( key);
|
auto it=vars.find( key);
|
||||||
if (it != vars.end()) {
|
if (it != vars.end()) {
|
||||||
|
@ -1750,7 +1752,7 @@ bool DRW_Header::getStr(const std::string &key, std::string *varStr) const{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_Header::getCoord(const std::string &key, DRW_Coord *varCoord) const
|
auto DRW_Header::getCoord(const std::string &key, DRW_Coord *varCoord) const -> bool
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result = false;
|
||||||
auto it=vars.find( key);
|
auto it=vars.find( key);
|
||||||
|
@ -1766,7 +1768,8 @@ bool DRW_Header::getCoord(const std::string &key, DRW_Coord *varCoord) const
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DRW_Header::measurement(const int unit) {
|
auto DRW_Header::measurement(const int unit) -> int
|
||||||
|
{
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case Units::Inch:
|
case Units::Inch:
|
||||||
case Units::Foot:
|
case Units::Foot:
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
this->vars[it->first] = new DRW_Variant( *(it->second) );
|
this->vars[it->first] = new DRW_Variant( *(it->second) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DRW_Header& operator=(const DRW_Header &h)
|
auto operator=(const DRW_Header &h) -> DRW_Header &
|
||||||
{
|
{
|
||||||
if(this != &h)
|
if(this != &h)
|
||||||
{
|
{
|
||||||
|
@ -110,17 +110,18 @@ public:
|
||||||
void addInt(std::string key, int value, int code);
|
void addInt(std::string key, int value, int code);
|
||||||
void addStr(std::string key, const std::string &value, int code);
|
void addStr(std::string key, const std::string &value, int code);
|
||||||
void addCoord(std::string key, const DRW_Coord &value, int code);
|
void addCoord(std::string key, const DRW_Coord &value, int code);
|
||||||
std::string getComments() const {return comments;}
|
auto getComments() const -> std::string { return comments; }
|
||||||
void write(dxfWriter *writer, DRW::Version ver);
|
void write(dxfWriter *writer, DRW::Version ver);
|
||||||
void addComment(const std::string &c);
|
void addComment(const std::string &c);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader);
|
auto parseCode(int code, dxfReader *reader) -> bool;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool getDouble(const std::string &key, double *varDouble) const;
|
auto getDouble(const std::string &key, double *varDouble) const -> bool;
|
||||||
bool getInt(const std::string &key, int *varInt) const;
|
auto getInt(const std::string &key, int *varInt) const -> bool;
|
||||||
bool getStr(const std::string &key, std::string *varStr) const;
|
auto getStr(const std::string &key, std::string *varStr) const -> bool;
|
||||||
bool getCoord(const std::string &key, DRW_Coord *varCoord) const;
|
auto getCoord(const std::string &key, DRW_Coord *varCoord) const -> bool;
|
||||||
void clearVars()
|
void clearVars()
|
||||||
{
|
{
|
||||||
for (auto it=vars.begin(); it!=vars.end(); ++it)
|
for (auto it=vars.begin(); it!=vars.end(); ++it)
|
||||||
|
@ -150,7 +151,7 @@ private:
|
||||||
duint32 vportCtrl;
|
duint32 vportCtrl;
|
||||||
duint32 vpEntHeaderCtrl;
|
duint32 vpEntHeaderCtrl;
|
||||||
|
|
||||||
int measurement(const int unit);
|
auto measurement(const int unit) -> int;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
* Base class for tables entries
|
* Base class for tables entries
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
bool DRW_TableEntry::parseCode(int code, dxfReader *reader){
|
auto DRW_TableEntry::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 5:
|
case 5:
|
||||||
handle = static_cast<duint32>(reader->getHandleString());
|
handle = static_cast<duint32>(reader->getHandleString());
|
||||||
|
@ -112,7 +113,8 @@ bool DRW_TableEntry::parseCode(int code, dxfReader *reader){
|
||||||
* Class to handle ldim style symbol table entries
|
* Class to handle ldim style symbol table entries
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
bool DRW_Dimstyle::parseCode(int code, dxfReader *reader){
|
auto DRW_Dimstyle::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 105:
|
case 105:
|
||||||
handle = static_cast<duint32>(reader->getHandleString());
|
handle = static_cast<duint32>(reader->getHandleString());
|
||||||
|
@ -336,7 +338,8 @@ bool DRW_Dimstyle::parseCode(int code, dxfReader *reader){
|
||||||
* Class to handle line type symbol table entries
|
* Class to handle line type symbol table entries
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
bool DRW_LType::parseCode(int code, dxfReader *reader){
|
auto DRW_LType::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 3:
|
case 3:
|
||||||
desc = reader->getUtf8String();
|
desc = reader->getUtf8String();
|
||||||
|
@ -385,7 +388,8 @@ void DRW_LType::update(){
|
||||||
* Class to handle layer symbol table entries
|
* Class to handle layer symbol table entries
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
bool DRW_Layer::parseCode(int code, dxfReader *reader){
|
auto DRW_Layer::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 6:
|
case 6:
|
||||||
lineType = reader->getUtf8String();
|
lineType = reader->getUtf8String();
|
||||||
|
@ -420,7 +424,8 @@ bool DRW_Layer::parseCode(int code, dxfReader *reader){
|
||||||
* Class to handle text style symbol table entries
|
* Class to handle text style symbol table entries
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
bool DRW_Textstyle::parseCode(int code, dxfReader *reader){
|
auto DRW_Textstyle::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 3:
|
case 3:
|
||||||
font = reader->getUtf8String();
|
font = reader->getUtf8String();
|
||||||
|
@ -458,7 +463,8 @@ bool DRW_Textstyle::parseCode(int code, dxfReader *reader){
|
||||||
* Class to handle vport symbol table entries
|
* Class to handle vport symbol table entries
|
||||||
* @author Rallaz
|
* @author Rallaz
|
||||||
*/
|
*/
|
||||||
bool DRW_Vport::parseCode(int code, dxfReader *reader){
|
auto DRW_Vport::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 10:
|
case 10:
|
||||||
lowerLeft.x = reader->getDouble();
|
lowerLeft.x = reader->getDouble();
|
||||||
|
@ -566,7 +572,8 @@ bool DRW_Vport::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_ImageDef::parseCode(int code, dxfReader *reader){
|
auto DRW_ImageDef::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 1:
|
case 1:
|
||||||
fileName = reader->getUtf8String();
|
fileName = reader->getUtf8String();
|
||||||
|
@ -602,7 +609,8 @@ bool DRW_ImageDef::parseCode(int code, dxfReader *reader){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DRW_PlotSettings::parseCode(int code, dxfReader *reader){
|
auto DRW_PlotSettings::parseCode(int code, dxfReader *reader) -> bool
|
||||||
|
{
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 5:
|
case 5:
|
||||||
handle = static_cast<duint32>(reader->getHandleString());
|
handle = static_cast<duint32>(reader->getHandleString());
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool parseCode(int code, dxfReader *reader);
|
virtual auto parseCode(int code, dxfReader *reader) -> bool;
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
std::vector<DRW_Variant*> extData{}; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
std::vector<DRW_Variant*> extData{}; /*!< FIFO list of extended data, codes 1000 to 1071*/
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DRW_TableEntry &operator=(const DRW_TableEntry &) Q_DECL_EQ_DELETE;
|
auto operator=(const DRW_TableEntry &) -> DRW_TableEntry &Q_DECL_EQ_DELETE;
|
||||||
DRW_Variant* curr{nullptr};
|
DRW_Variant* curr{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//V12
|
//V12
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -374,7 +374,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UTF8STRING lineType; /*!< line type, code 6 */
|
UTF8STRING lineType; /*!< line type, code 6 */
|
||||||
|
@ -442,7 +442,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
double height; /*!< Fixed text height (0 not set), code 40 */
|
double height; /*!< Fixed text height (0 not set), code 40 */
|
||||||
|
@ -511,7 +511,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DRW_Coord lowerLeft; /*!< Lower left corner, code 10 & 20 */
|
DRW_Coord lowerLeft; /*!< Lower left corner, code 10 & 20 */
|
||||||
|
@ -576,7 +576,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// std::string handle; /*!< entity identifier, code 5 */
|
// std::string handle; /*!< entity identifier, code 5 */
|
||||||
|
@ -614,7 +614,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override;
|
auto parseCode(int code, dxfReader *reader) -> bool override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UTF8STRING plotViewName {}; /*!< Plot view name, code 6 */
|
UTF8STRING plotViewName {}; /*!< Plot view name, code 6 */
|
||||||
|
@ -641,7 +641,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool parseCode(int code, dxfReader *reader) override {return DRW_TableEntry::parseCode(code, reader);}
|
auto parseCode(int code, dxfReader *reader) -> bool override { return DRW_TableEntry::parseCode(code, reader); }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace DRW {
|
namespace DRW {
|
||||||
|
|
|
@ -35,7 +35,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/********* debug class *************/
|
/********* debug class *************/
|
||||||
DRW_dbg *DRW_dbg::getInstance(){
|
auto DRW_dbg::getInstance() -> DRW_dbg *
|
||||||
|
{
|
||||||
if (instance == nullptr){
|
if (instance == nullptr){
|
||||||
instance = new DRW_dbg;
|
instance = new DRW_dbg;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +69,8 @@ void DRW_dbg::setLevel(Level lvl){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DRW_dbg::Level DRW_dbg::getLevel() const{
|
auto DRW_dbg::getLevel() const -> DRW_dbg::Level
|
||||||
|
{
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,8 @@ public:
|
||||||
* is required.
|
* is required.
|
||||||
*/
|
*/
|
||||||
void setCustomDebugPrinter(std::unique_ptr<DRW::DebugPrinter> printer);
|
void setCustomDebugPrinter(std::unique_ptr<DRW::DebugPrinter> printer);
|
||||||
Level getLevel() const;
|
auto getLevel() const -> Level;
|
||||||
static DRW_dbg *getInstance();
|
static auto getInstance() -> DRW_dbg *;
|
||||||
void print(const std::string &s);
|
void print(const std::string &s);
|
||||||
void print(signed char i);
|
void print(signed char i);
|
||||||
void print(unsigned char i);
|
void print(unsigned char i);
|
||||||
|
|
|
@ -118,7 +118,7 @@ void DRW_TextCodec::setCodePage(const std::string &c, bool dxfFormat){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QStringList> DRW_TextCodec::DXFCodePageMap()
|
auto DRW_TextCodec::DXFCodePageMap() -> QMap<QString, QStringList>
|
||||||
{
|
{
|
||||||
static auto map = QMap<QString, QStringList>
|
static auto map = QMap<QString, QStringList>
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ QMap<QString, QStringList> DRW_TextCodec::DXFCodePageMap()
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
VTextCodec *DRW_TextCodec::CodecForName(const QString &name)
|
auto DRW_TextCodec::CodecForName(const QString &name) -> VTextCodec *
|
||||||
{
|
{
|
||||||
QMap<QString, QStringList> knownCodecs = DXFCodePageMap();
|
QMap<QString, QStringList> knownCodecs = DXFCodePageMap();
|
||||||
if (knownCodecs.contains(name))
|
if (knownCodecs.contains(name))
|
||||||
|
@ -166,7 +166,8 @@ VTextCodec *DRW_TextCodec::CodecForName(const QString &name)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DRW_TextCodec::toUtf8(const std::string &s) {
|
auto DRW_TextCodec::toUtf8(const std::string &s) -> std::string
|
||||||
|
{
|
||||||
if (conv == nullptr)
|
if (conv == nullptr)
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
|
@ -176,7 +177,8 @@ std::string DRW_TextCodec::toUtf8(const std::string &s) {
|
||||||
return encodedString.toStdString();
|
return encodedString.toStdString();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DRW_TextCodec::fromUtf8(const std::string &s) {
|
auto DRW_TextCodec::fromUtf8(const std::string &s) -> std::string
|
||||||
|
{
|
||||||
if (conv == nullptr)
|
if (conv == nullptr)
|
||||||
{
|
{
|
||||||
return s;
|
return s;
|
||||||
|
|
|
@ -21,16 +21,16 @@ class DRW_TextCodec
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DRW_TextCodec();
|
DRW_TextCodec();
|
||||||
std::string fromUtf8(const std::string &s);
|
auto fromUtf8(const std::string &s) -> std::string;
|
||||||
std::string toUtf8(const std::string &s);
|
auto toUtf8(const std::string &s) -> std::string;
|
||||||
int getVersion() const {return version;}
|
auto getVersion() const -> int { return version; }
|
||||||
void setVersion(const std::string &v, bool dxfFormat);
|
void setVersion(const std::string &v, bool dxfFormat);
|
||||||
void setVersion(DRW::Version v, bool dxfFormat);
|
void setVersion(DRW::Version v, bool dxfFormat);
|
||||||
void setCodePage(const std::string &c, bool dxfFormat);
|
void setCodePage(const std::string &c, bool dxfFormat);
|
||||||
std::string getCodePage() const {return cp;}
|
auto getCodePage() const -> std::string { return cp; }
|
||||||
|
|
||||||
static QMap<QString, QStringList> DXFCodePageMap();
|
static auto DXFCodePageMap() -> QMap<QString, QStringList>;
|
||||||
static VTextCodec* CodecForName(const QString &name);
|
static auto CodecForName(const QString &name) -> VTextCodec *;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static auto correctCodePage(const std::string& s) -> std::string;
|
static auto correctCodePage(const std::string& s) -> std::string;
|
||||||
|
|
|
@ -18,8 +18,9 @@
|
||||||
#include "drw_textcodec.h"
|
#include "drw_textcodec.h"
|
||||||
#include "drw_dbg.h"
|
#include "drw_dbg.h"
|
||||||
|
|
||||||
bool dxfReader::readRec(int *codeData) {
|
auto dxfReader::readRec(int *codeData) -> bool
|
||||||
// std::string text;
|
{
|
||||||
|
// std::string text;
|
||||||
int code;
|
int code;
|
||||||
|
|
||||||
if (!readCode(&code))
|
if (!readCode(&code))
|
||||||
|
@ -97,7 +98,8 @@ bool dxfReader::readRec(int *codeData) {
|
||||||
|
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
int dxfReader::getHandleString(){
|
auto dxfReader::getHandleString() -> int
|
||||||
|
{
|
||||||
int res;
|
int res;
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
// cppcheck-suppress invalidScanfArgType_int
|
// cppcheck-suppress invalidScanfArgType_int
|
||||||
|
@ -112,7 +114,8 @@ int dxfReader::getHandleString(){
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readCode(int *code) {
|
auto dxfReaderBinary::readCode(int *code) -> bool
|
||||||
|
{
|
||||||
unsigned short *int16p;
|
unsigned short *int16p;
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
filestr->read(buffer,2);
|
filestr->read(buffer,2);
|
||||||
|
@ -130,21 +133,24 @@ bool dxfReaderBinary::readCode(int *code) {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readString() {
|
auto dxfReaderBinary::readString() -> bool
|
||||||
|
{
|
||||||
type = STRING;
|
type = STRING;
|
||||||
std::getline(*filestr, strData, '\0');
|
std::getline(*filestr, strData, '\0');
|
||||||
DRW_DBG(strData); DRW_DBG("\n");
|
DRW_DBG(strData); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readString(std::string *text) {
|
auto dxfReaderBinary::readString(std::string *text) -> bool
|
||||||
|
{
|
||||||
type = STRING;
|
type = STRING;
|
||||||
std::getline(*filestr, *text, '\0');
|
std::getline(*filestr, *text, '\0');
|
||||||
DRW_DBG(*text); DRW_DBG("\n");
|
DRW_DBG(*text); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readBinary() {
|
auto dxfReaderBinary::readBinary() -> bool
|
||||||
|
{
|
||||||
unsigned char chunklen {0};
|
unsigned char chunklen {0};
|
||||||
|
|
||||||
filestr->read( reinterpret_cast<char *>(&chunklen), 1);
|
filestr->read( reinterpret_cast<char *>(&chunklen), 1);
|
||||||
|
@ -154,7 +160,8 @@ bool dxfReaderBinary::readBinary() {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readInt16() {
|
auto dxfReaderBinary::readInt16() -> bool
|
||||||
|
{
|
||||||
type = INT32;
|
type = INT32;
|
||||||
char buffer[2];
|
char buffer[2];
|
||||||
filestr->read(buffer,2);
|
filestr->read(buffer,2);
|
||||||
|
@ -163,7 +170,8 @@ bool dxfReaderBinary::readInt16() {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readInt32() {
|
auto dxfReaderBinary::readInt32() -> bool
|
||||||
|
{
|
||||||
type = INT32;
|
type = INT32;
|
||||||
unsigned int *int32p;
|
unsigned int *int32p;
|
||||||
char buffer[4];
|
char buffer[4];
|
||||||
|
@ -175,7 +183,8 @@ bool dxfReaderBinary::readInt32() {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readInt64() {
|
auto dxfReaderBinary::readInt64() -> bool
|
||||||
|
{
|
||||||
type = INT64;
|
type = INT64;
|
||||||
unsigned long long int *int64p; //64 bits integer pointer
|
unsigned long long int *int64p; //64 bits integer pointer
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
|
@ -187,7 +196,8 @@ bool dxfReaderBinary::readInt64() {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderBinary::readDouble() {
|
auto dxfReaderBinary::readDouble() -> bool
|
||||||
|
{
|
||||||
type = DOUBLE;
|
type = DOUBLE;
|
||||||
double *result;
|
double *result;
|
||||||
char buffer[8];
|
char buffer[8];
|
||||||
|
@ -201,7 +211,8 @@ bool dxfReaderBinary::readDouble() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//saved as int or add a bool member??
|
//saved as int or add a bool member??
|
||||||
bool dxfReaderBinary::readBool() {
|
auto dxfReaderBinary::readBool() -> bool
|
||||||
|
{
|
||||||
char buffer[1];
|
char buffer[1];
|
||||||
filestr->read(buffer,1);
|
filestr->read(buffer,1);
|
||||||
intData = static_cast<int>(buffer[0]);
|
intData = static_cast<int>(buffer[0]);
|
||||||
|
@ -209,14 +220,16 @@ bool dxfReaderBinary::readBool() {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readCode(int *code) {
|
auto dxfReaderAscii::readCode(int *code) -> bool
|
||||||
|
{
|
||||||
std::string text;
|
std::string text;
|
||||||
std::getline(*filestr, text);
|
std::getline(*filestr, text);
|
||||||
*code = atoi(text.c_str());
|
*code = atoi(text.c_str());
|
||||||
DRW_DBG(*code); DRW_DBG("\n");
|
DRW_DBG(*code); DRW_DBG("\n");
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
bool dxfReaderAscii::readString(std::string *text) {
|
auto dxfReaderAscii::readString(std::string *text) -> bool
|
||||||
|
{
|
||||||
type = STRING;
|
type = STRING;
|
||||||
std::getline(*filestr, *text);
|
std::getline(*filestr, *text);
|
||||||
if (!text->empty() && text->at(text->size()-1) == '\r')
|
if (!text->empty() && text->at(text->size()-1) == '\r')
|
||||||
|
@ -224,7 +237,8 @@ bool dxfReaderAscii::readString(std::string *text) {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readString() {
|
auto dxfReaderAscii::readString() -> bool
|
||||||
|
{
|
||||||
type = STRING;
|
type = STRING;
|
||||||
std::getline(*filestr, strData);
|
std::getline(*filestr, strData);
|
||||||
if (!strData.empty() && strData.at(strData.size()-1) == '\r')
|
if (!strData.empty() && strData.at(strData.size()-1) == '\r')
|
||||||
|
@ -233,11 +247,13 @@ bool dxfReaderAscii::readString() {
|
||||||
return (filestr->good());
|
return (filestr->good());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readBinary() {
|
auto dxfReaderAscii::readBinary() -> bool
|
||||||
|
{
|
||||||
return readString();
|
return readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readInt16() {
|
auto dxfReaderAscii::readInt16() -> bool
|
||||||
|
{
|
||||||
type = INT32;
|
type = INT32;
|
||||||
std::string text;
|
std::string text;
|
||||||
if (readString(&text)){
|
if (readString(&text)){
|
||||||
|
@ -248,17 +264,20 @@ bool dxfReaderAscii::readInt16() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readInt32() {
|
auto dxfReaderAscii::readInt32() -> bool
|
||||||
|
{
|
||||||
type = INT32;
|
type = INT32;
|
||||||
return readInt16();
|
return readInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readInt64() {
|
auto dxfReaderAscii::readInt64() -> bool
|
||||||
|
{
|
||||||
type = INT64;
|
type = INT64;
|
||||||
return readInt16();
|
return readInt16();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dxfReaderAscii::readDouble() {
|
auto dxfReaderAscii::readDouble() -> bool
|
||||||
|
{
|
||||||
type = DOUBLE;
|
type = DOUBLE;
|
||||||
std::string text;
|
std::string text;
|
||||||
if (readString(&text)){
|
if (readString(&text)){
|
||||||
|
@ -280,7 +299,8 @@ bool dxfReaderAscii::readDouble() {
|
||||||
}
|
}
|
||||||
|
|
||||||
//saved as int or add a bool member??
|
//saved as int or add a bool member??
|
||||||
bool dxfReaderAscii::readBool() {
|
auto dxfReaderAscii::readBool() -> bool
|
||||||
|
{
|
||||||
type = BOOL;
|
type = BOOL;
|
||||||
std::string text;
|
std::string text;
|
||||||
if (readString(&text)){
|
if (readString(&text)){
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user