Refactoring.

This commit is contained in:
Roman Telezhynskyi 2023-05-03 14:07:02 +03:00
parent 30f2897732
commit 03630fb273
587 changed files with 7857 additions and 8554 deletions

View File

@ -280,7 +280,7 @@ void DialogSaveManualLayout::SetShowGrainline(bool show)
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogSaveManualLayout::IsShowGrainline() const
auto DialogSaveManualLayout::IsShowGrainline() const -> bool
{
switch(Format())
{

View File

@ -75,8 +75,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QKeySequence, restoreOriginShortcut, // NOLINT
#endif
QT_WARNING_POP
}
} // namespace
//---------------------------------------------------------------------------------------------------------------------
VPMainGraphicsView::VPMainGraphicsView(const VPLayoutPtr &layout, QWidget *parent) :

View File

@ -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, settingLayoutShowGrainline, (QLatin1String("layout/showGrainline"))) // NOLINT
int cachedLineWidth = -1;
int cachedLineWidth = -1; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
} // namespace
#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);
}
@ -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));
}
@ -343,7 +343,7 @@ void VPSettings::SetLayoutLineWidth(int width)
}
//---------------------------------------------------------------------------------------------------------------------
bool VPSettings::GetShowGrainline() const
auto VPSettings::GetShowGrainline() const -> bool
{
return value(*settingLayoutShowGrainline, true).toBool();
}

View File

@ -39,6 +39,7 @@ public:
VPSettings(Format format, Scope scope, const QString &organization, const QString &application = QString(),
QObject *parent = nullptr);
VPSettings(const QString &fileName, Format format, QObject *parent = nullptr);
~VPSettings() override = default;
auto IsDockWidgetPropertiesActive() const -> bool;
static auto GetDefDockWidgetPropertiesActive() -> bool;
@ -103,7 +104,7 @@ public:
auto GetLayoutLineWidth() const -> int;
void SetLayoutLineWidth(int width);
bool GetShowGrainline() const;
auto GetShowGrainline() const -> bool;
void SetShowGrainline(bool value);
private:

View File

@ -558,7 +558,7 @@ void VPLayoutFileReader::ReadPiece(const VPPiecePtr &piece)
}
//---------------------------------------------------------------------------------------------------------------------
VLayoutPoint VPLayoutFileReader::ReadLayoutPoint()
auto VPLayoutFileReader::ReadLayoutPoint() -> VLayoutPoint
{
AssertRootTag(ML::TagPoint);

View File

@ -721,60 +721,46 @@ void DialogRestrictDimension::EnableRestrictionControls(bool enable)
//---------------------------------------------------------------------------------------------------------------------
void DialogRestrictDimension::FillBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension,
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)
const DimesionLabels labels = dimension->Labels();
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)
{
for(auto base : bases)
{
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);
}
}
QString item = useLabel ? label : QStringLiteral("%1 %2").arg(base).arg(units);
control->addItem(item, base);
}
else if (dimension->Type() == MeasurementDimension::Y)
{
for(auto base : bases)
if (useLabel)
{
if (VFuzzyContains(labels, base) && not VFuzzyValue(labels, base).isEmpty())
{
control->addItem(VFuzzyValue(labels, base), base);
control->addItem(label, base);
}
else
{
if (dimension->IsBodyMeasurement())
{
control->addItem(QStringLiteral("%1 %2").arg(m_fullCircumference ? base*2 : base).arg(units), base);
}
else
{
control->addItem(QString::number(base), base);
}
}
QString item = dimension->IsBodyMeasurement()
? QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units)
: QString::number(base);
control->addItem(item, base);
}
}
else if (dimension->Type() == MeasurementDimension::W || dimension->Type() == MeasurementDimension::Z)
{
for(auto base : bases)
{
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);
}
}
QString item = useLabel ? label : QStringLiteral("%1 %2").arg(m_fullCircumference ? base * 2 : base).arg(units);
control->addItem(item, base);
}
}

View File

@ -93,6 +93,7 @@ private:
void EnableRestrictionControls(bool enable);
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,
const MeasurementDimension_p &dimension) -> QStringList;
auto FillDimensionYBases(const QVector<qreal> &bases, const MeasurementDimension_p &dimension) const -> QStringList;

View File

@ -27,29 +27,30 @@
*************************************************************************/
#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/xml/vpatternconverter.h"
#include "../ifc/xml/vvitconverter.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/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)
#include "../vmisc/backport/qoverload.h"
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
@ -110,6 +111,16 @@ namespace
{
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
{
@ -191,6 +202,38 @@ auto ConverToDouble(QString text, const QString &error) -> qreal
}
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
// 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;
}
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;
QSet<QString> importedNames;
@ -3991,28 +4024,11 @@ void TMainWindow::ImportIndividualMeasurements(const QxtCsvModel &csv, const QVe
measurement.name = mName;
const int valueColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Value));
measurement.value =
VTranslateVars::TryFormulaFromUser(csv.text(i, valueColumn),
VAbstractApplication::VApp()->Settings()->GetOsSeparator());
measurement.value = VTranslateVars::TryFormulaFromUser(
csv.text(i, valueColumn), VAbstractApplication::VApp()->Settings()->GetOsSeparator());
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();
}
}
if (columns > 3 && custom)
{
const int descriptionColumn = map.at(static_cast<int>(IndividualMeasurementsColumns::Description));
if (descriptionColumn >= 0)
{
measurement.description = csv.text(i, descriptionColumn).simplified();
}
}
SetIndividualMeasurementFullName(i, name, csv, map, measurement);
SetIndividualMeasurementDescription(i, name, csv, map, measurement);
measurements.append(measurement);
}

View File

@ -72,6 +72,7 @@ public:
auto IsPedantic() const -> bool override;
static auto VApp() -> VApplication *;
static auto CommandLine() -> VCommandLinePtr;
protected:
void InitTrVars() override;
@ -94,10 +95,6 @@ private:
static auto CreateLogDir() -> bool;
void BeginLogging();
static void ClearOldLogs();
public:
//moved to the end of class so merge should go
static auto CommandLine() -> VCommandLinePtr;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -45,6 +45,15 @@
#include <QtConcurrent>
#include <functional>
namespace
{
//---------------------------------------------------------------------------------------------------------------------
auto AttrUInt(const QDomElement &domElement, const QString &name) -> quint32
{
return VDomDocument::GetParametrUInt(domElement, name, QChar('0'));
}
} // namespace
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief DialogHistory create dialog
@ -531,12 +540,6 @@ auto DialogHistory::PointName(quint32 pointId) const -> QString
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

View File

@ -103,7 +103,6 @@ private:
void InitialTable();
void ShowPoint();
auto PointName(quint32 pointId) const -> QString;
auto AttrUInt(const QDomElement &domElement, const QString &name) const -> quint32;
void RetranslateUi();
auto CursorRow() const -> int;

View File

@ -654,14 +654,19 @@ auto DialogIncrements::IncrementUsed(const QString &name) const -> bool
{
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)
{
return false;
}
// Eval formula
try
{
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(field.expression, false, false));
QScopedPointer<qmu::QmuTokenParser> cal(
new qmu::QmuTokenParser(field.expression, false, false));
// Tokens (variables, measurements)
if (cal->GetTokens().values().contains(name))
@ -673,9 +678,8 @@ auto DialogIncrements::IncrementUsed(const QString &name) const -> bool
{
// 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)
{
// Skip DialogTool implementation
QDialog::showEvent(event);
QDialog::showEvent(event); // NOLINT(bugprone-parent-virtual-call)
if ( event->spontaneous() )
{
return;

View File

@ -6350,30 +6350,37 @@ void MainWindow::ExportDetailsAs()
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
{
const QStringList files = GetUnlokedRestoreFileList();
if (not files.empty())
if (files.empty())
{
return;
}
qCDebug(vMainWindow, "Reopen files after crash.");
QStringList restoreFiles;
restoreFiles.reserve(files.size());
for (int i = 0; i < files.size(); ++i)
for (const auto &file : files)
{
QFile file(files.at(i) + *autosavePrefix);
if (file.exists())
if (QFile::exists(file + *autosavePrefix))
{
restoreFiles.append(files.at(i));
restoreFiles.append(file);
}
}
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)
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)
@ -6388,15 +6395,11 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args)
}
else
{
qCDebug(vMainWindow, "Could not copy %s%s to %s %s",
qUtf8Printable(file), qUtf8Printable(*autosavePrefix),
qCDebug(vMainWindow, "Could not copy %s%s to %s %s", qUtf8Printable(file), qUtf8Printable(*autosavePrefix),
qUtf8Printable(file), qUtf8Printable(error));
}
}
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
auto MainWindow::CheckPathToMeasurements(const QString &patternPath, const QString &path) -> QString
@ -7368,12 +7371,12 @@ void MainWindow::PrintPatternMessage(QEvent *event)
//---------------------------------------------------------------------------------------------------------------------
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()
&& (*i)->CurrentFile() == AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), path))
if (not watermarkEditor.isNull() && not watermarkEditor->CurrentFile().isEmpty() &&
watermarkEditor->CurrentFile() == AbsoluteMPath(VAbstractValApplication::VApp()->GetPatternPath(), path))
{
(*i)->show();
watermarkEditor->show();
return;
}
}

View File

@ -86,7 +86,7 @@ QT_WARNING_POP
namespace
{
//---------------------------------------------------------------------------------------------------------------------
bool CreateLayoutPath(const QString &path)
auto CreateLayoutPath(const QString &path) -> bool
{
bool usedNotExistedDir = true;
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);
@ -422,8 +422,7 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
{
return true;
}
else
{
ShowLayoutError(nestingState);
if (not VApplication::IsGUIMode())
{
@ -431,7 +430,6 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
}
return false;
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::ShowLayoutError(const LayoutErrors &state)
@ -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())
{
@ -964,13 +962,13 @@ void MainWindowsNoGUI::InitTempLayoutScene()
}
//---------------------------------------------------------------------------------------------------------------------
QStringList MainWindowsNoGUI::RecentFileList() const
auto MainWindowsNoGUI::RecentFileList() const -> QStringList
{
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;
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;
for (auto paper : papers)
for (auto *paper : papers)
{
qreal x1=0, y1=0, x2=0, y2=0;
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,
const QList<QGraphicsItem *> &shadows,
const QList<QList<QGraphicsItem *> > &details)
auto MainWindowsNoGUI::CreateScenes(const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
const QList<QList<QGraphicsItem *>> &details) -> QList<QGraphicsScene *>
{
QList<QGraphicsScene *> scenes;
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;
VAbstractValApplication::VApp()->GetPatternPath().isEmpty()
@ -1252,8 +1249,8 @@ QString MainWindowsNoGUI::FileName() const
}
//---------------------------------------------------------------------------------------------------------------------
bool MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib,
const QChar &separator) const
auto MainWindowsNoGUI::ExportFMeasurementsToCSVData(const QString &fileName, bool withHeader, int mib,
const QChar &separator) const -> bool
{
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;
if (path.isEmpty())

View File

@ -39,7 +39,6 @@
#include "dialogs/dialogsavelayout.h"
#include "../vlayout/vlayoutgenerator.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../vlayout/vtextmanager.h"
#include "../vlayout/vprintlayout.h"
class QGraphicsScene;
@ -55,15 +54,16 @@ class QWinTaskbarProgress;
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Weffc++")
struct DetailForLayout {
struct DetailForLayout
{
DetailForLayout() = default;
DetailForLayout(quint32 id, const VPiece &piece)
: id(id), piece(piece)
{}
quint32 id{NULL_ID};
VPiece piece;
quint32 id{NULL_ID}; // NOLINT(misc-non-private-member-variables-in-classes)
VPiece piece{}; // NOLINT(misc-non-private-member-variables-in-classes)
};
QT_WARNING_POP
@ -75,7 +75,7 @@ class MainWindowsNoGUI : public VAbstractMainWindow
Q_OBJECT // NOLINT
public:
explicit MainWindowsNoGUI(QWidget *parent = nullptr);
virtual ~MainWindowsNoGUI() override;
~MainWindowsNoGUI() override;
public slots:
void ToolLayoutSettings(bool checked);
@ -86,70 +86,69 @@ public slots:
protected slots:
void ExportFMeasurementsToCSV();
protected:
QVector<VLayoutPiece> listDetails{};
QVector<VLayoutPiece> listDetails{}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @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) */
VContainer *pattern;
VContainer *pattern; // NOLINT(misc-non-private-member-variables-in-classes)
/** @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 *redoAction{nullptr};
QAction *actionDockWidgetToolOptions{nullptr};
QAction *actionDockWidgetGroups{nullptr};
QAction *actionDockWidgetBackgroundImages{nullptr};
QAction *undoAction{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
QAction *redoAction{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
QAction *actionDockWidgetToolOptions{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
QAction *actionDockWidgetGroups{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
QAction *actionDockWidgetBackgroundImages{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
bool isNoScaling{false};
bool isNeedAutosave{false};
VPrintLayout *m_layoutSettings{new VPrintLayout(this)};
bool isNoScaling{false}; // NOLINT(misc-non-private-member-variables-in-classes)
bool isNeedAutosave{false}; // NOLINT(misc-non-private-member-variables-in-classes)
VPrintLayout *m_layoutSettings{new VPrintLayout(this)}; // NOLINT(misc-non-private-member-variables-in-classes)
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
QPointer<QLabel> m_mouseCoordinate{nullptr};
QPointer<QLabel> m_unreadPatternMessage{nullptr};
QPointer<QLabel> m_mouseCoordinate{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
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)
QWinTaskbarButton *m_taskbarButton;
QWinTaskbarProgress *m_taskbarProgress{nullptr};
QWinTaskbarButton *m_taskbarButton; // NOLINT(misc-non-private-member-variables-in-classes)
QWinTaskbarProgress *m_taskbarProgress{nullptr}; // NOLINT(misc-non-private-member-variables-in-classes)
#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 InitTempLayoutScene();
virtual void CleanLayout()=0;
virtual void PrepareSceneList(PreviewQuatilty quality)=0;
virtual QStringList RecentFileList() const override;
QIcon ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const;
bool GenerateLayout(VLayoutGenerator& lGenerator);
QString FileName() const;
auto RecentFileList() const -> QStringList override;
auto ScenePreview(int i, QSize iconSize, PreviewQuatilty quality) const -> QIcon;
auto GenerateLayout(VLayoutGenerator &lGenerator) -> bool;
auto FileName() const -> QString;
bool ExportFMeasurementsToCSVData(const QString &fileName,
bool withHeader, int mib, const QChar &separator) const;
auto ExportFMeasurementsToCSVData(const QString &fileName, 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;
private:
Q_DISABLE_COPY_MOVE(MainWindowsNoGUI) // NOLINT
static QList<QGraphicsItem *> CreateShadows(const QList<QGraphicsItem *> &papers);
static QList<QGraphicsScene *> CreateScenes(const QList<QGraphicsItem *> &papers,
const QList<QGraphicsItem *> &shadows,
const QList<QList<QGraphicsItem *> > &details);
static auto CreateShadows(const QList<QGraphicsItem *> &papers) -> QList<QGraphicsItem *>;
static auto CreateScenes(const QList<QGraphicsItem *> &papers, const QList<QGraphicsItem *> &shadows,
const QList<QList<QGraphicsItem *>> &details) -> QList<QGraphicsScene *>;
void PdfTiledFile(const QString &name);

View File

@ -132,13 +132,13 @@ using namespace bpstd::literals::chrono_literals;
#endif // __cplusplus >= 201402L
#endif //(defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly");
const QString VPattern::AttrLabelPrefix = QStringLiteral("labelPrefix");
const QString VPattern::AttrReadOnly = QStringLiteral("readOnly"); // NOLINT(cert-err58-cpp)
const QString VPattern::AttrLabelPrefix = QStringLiteral("labelPrefix"); // NOLINT(cert-err58-cpp)
namespace
{
//---------------------------------------------------------------------------------------------------------------------
QString FileComment()
auto FileComment() -> QString
{
return QStringLiteral("Pattern created with Valentina v%1 (https://smart-pattern.com.ua/).")
.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();
if (not ConvertToSet<QString>(VApplication::LabelLanguages()).contains(def))
@ -231,66 +231,20 @@ void VPattern::Parse(const Document &parse)
m_parsing = true;
SCASSERT(sceneDraw != nullptr)
SCASSERT(sceneDetail != nullptr)
static const QStringList tags({TagDraw, TagIncrements, TagPreviewCalculations});
PrepareForParse(parse);
QDomNode domNode = documentElement().firstChild();
while (domNode.isNull() == false)
while (not domNode.isNull())
{
if (domNode.isElement())
{
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;
}
}
}
ParseRootElement(parse, domNode);
domNode = domNode.nextSibling();
}
if (VApplication::IsGUIMode())
{
QTimer::singleShot(V_SECONDS(1), Qt::VeryCoarseTimer, this, &VPattern::RefreshPieceGeometry);
}
else if (VApplication::VApp()->CommandLine()->IsTestModeEnabled())
else if (VApplication::CommandLine()->IsTestModeEnabled())
{
RefreshPieceGeometry();
}
@ -306,18 +260,20 @@ void VPattern::Parse(const Document &parse)
* on).
*/
void VPattern::setCurrentData()
{
if (VAbstractValApplication::VApp()->GetDrawMode() == Draw::Calculation)
{
const int countPP = CountPP();
if (countPP > 1)//don't need upadate data if we have only one pattern piece
// don't need upadate data if we have only one pattern piece
if (VAbstractValApplication::VApp()->GetDrawMode() != Draw::Calculation || countPP <= 1)
{
return;
}
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)
if (localHistory.isEmpty())
{
qCDebug(vXML, "History is empty!");
return;
@ -326,8 +282,12 @@ void VPattern::setCurrentData()
const quint32 id = ConstLast(localHistory).getId();
qCDebug(vXML, "Resoring data from tool with id %u", id);
if (tools.size() > 0)
if (not tools.isEmpty())
{
qCDebug(vXML, "List of tools is empty!");
return;
}
try
{
ToolExists(id);
@ -346,13 +306,6 @@ void VPattern::setCurrentData()
data->RemoveVariable(currentSeamAllowance);
qCDebug(vXML, "Data successfully updated.");
}
else
{
qCDebug(vXML, "List of tools is empty!");
}
}
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
@ -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();
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();
if (countPP <= 0 || history.isEmpty() || tools.isEmpty())
@ -446,18 +399,19 @@ VContainer VPattern::GetCompletePPData(const QString &name) const
* @return id base point.
*/
// cppcheck-suppress unusedFunction
quint32 VPattern::SPointActiveDraw()
auto VPattern::SPointActiveDraw() -> quint32
{
QDomElement calcElement;
if (GetActivNodeElement(TagCalculation, calcElement))
{
const QDomNode domNode = calcElement.firstChild();
if (domNode.isNull() == false && domNode.isElement())
if (not domNode.isNull() && domNode.isElement())
{
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);
}
@ -468,7 +422,7 @@ quint32 VPattern::SPointActiveDraw()
}
//---------------------------------------------------------------------------------------------------------------------
QVector<quint32> VPattern::GetActivePPPieces() const
auto VPattern::GetActivePPPieces() const -> QVector<quint32>
{
QVector<quint32> pieces;
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
{
@ -608,7 +562,7 @@ void VPattern::LiteParseIncrements()
}
//---------------------------------------------------------------------------------------------------------------------
int VPattern::ElementsToParse() const
auto VPattern::ElementsToParse() const -> int
{
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 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"));
Tool tool;
QStringList types = QStringList() << VAbstractPattern::NodePoint
<< VAbstractPattern::NodeArc
<< VAbstractPattern::NodeSpline
<< VAbstractPattern::NodeSplinePath
<< VAbstractPattern::NodeElArc;
QStringList types{VAbstractPattern::NodePoint, VAbstractPattern::NodeArc, VAbstractPattern::NodeSpline,
VAbstractPattern::NodeSplinePath, VAbstractPattern::NodeElArc};
switch (types.indexOf(t))
{
case 0: // NodePoint
@ -789,10 +740,67 @@ VNodeDetail VPattern::ParseDetailNode(const QDomElement &domElement) const
tool = Tool::NodeElArc;
break;
default:
VException e(tr("Wrong tag name '%1'.").arg(t));
throw e;
throw VException(tr("Wrong tag name '%1'.").arg(t));
}
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,11 +815,19 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
QDomNode domNode = node.firstChild();
while (not domNode.isNull())
{
if (domNode.isElement())
if (not domNode.isElement())
{
domNode = domNode.nextSibling();
continue;
}
const QDomElement domElement = domNode.toElement();
if (not domElement.isNull())
if (domElement.isNull())
{
domNode = domNode.nextSibling();
continue;
}
switch (tags.indexOf(domElement.tagName()))
{
case 0: // TagCalculation
@ -834,8 +850,6 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
default:
throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
}
}
}
domNode = domNode.nextSibling();
}
}
@ -851,22 +865,31 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
{
SCASSERT(sceneDraw != 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 qint32 num = nodeList.size();
for (qint32 i = 0; i < num; ++i)
for (qint32 i = 0; i < nodeList.size(); ++i)
{
QDomElement domElement = nodeList.at(i).toElement();
if (domElement.isNull() == false)
ParseDrawModeElement(domElement, parse, mode);
}
if (parse == Document::FullParse)
{
emit MadeProgress();
}
}
//---------------------------------------------------------------------------------------------------------------------
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
@ -902,15 +925,7 @@ void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const
ParsePathElement(scene, domElement, parse);
break;
default:
VException e(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
throw e;
}
}
}
if (parse == Document::FullParse)
{
emit MadeProgress();
throw VException(tr("Wrong tag name '%1'.").arg(domElement.tagName()));
}
}
@ -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;
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.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.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.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
@ -1315,8 +1331,8 @@ void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32
* @param parse parser file mode.
* @param type type of point.
*/
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse, const QString &type)
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
const QString &type)
{
SCASSERT(scene != nullptr)
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;
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())
{
@ -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);
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);
@ -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);
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();
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);
@ -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.
* @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)
{
@ -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 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();
@ -4422,7 +4438,7 @@ void VPattern::SetReadOnly(bool rOnly)
}
//---------------------------------------------------------------------------------------------------------------------
QString VPattern::GetLabelPrefix() const
auto VPattern::GetLabelPrefix() const -> QString
{
const QDomElement pattern = documentElement();
@ -4511,7 +4527,7 @@ void VPattern::DrawToolsCommonAttributes(const QDomElement &domElement, quint32
QT_WARNING_PUSH
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
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
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
QRectF VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const
template <typename T> auto VPattern::ToolBoundingRect(const QRectF &rec, quint32 id) const -> QRectF
{
QRectF recTool = rec;
if (tools.contains(id))

View File

@ -49,29 +49,30 @@ class VPattern : public VAbstractPattern
public:
VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
QObject *parent = nullptr);
~VPattern() override = default;
virtual void CreateEmptyFile() override;
void CreateEmptyFile() override;
void Parse(const Document &parse);
void GarbageCollector(bool commit = false);
void setCurrentData();
virtual void UpdateToolData(const quint32 &id, VContainer *data) override;
void UpdateToolData(const quint32 &id, VContainer *data) override;
virtual VContainer GetCompleteData() const override;
virtual VContainer GetCompletePPData(const QString &name) const override;
auto GetCompleteData() const -> VContainer override;
auto GetCompletePPData(const QString &name) const -> VContainer override;
virtual void IncrementReferens(quint32 id) const override;
virtual void DecrementReferens(quint32 id) const override;
void IncrementReferens(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 AddEmptyPreviewCalculation(const QString &name, IncrementType type = IncrementType::Increment);
@ -97,14 +98,14 @@ public:
void ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName);
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const override;
virtual QString GenerateSuffix() const override;
virtual void Clear() override;
auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString override;
auto GenerateSuffix() const -> QString override;
void Clear() override;
bool IsReadOnly() const;
auto IsReadOnly() const -> bool;
void SetReadOnly(bool rOnly);
QString GetLabelPrefix() const;
auto GetLabelPrefix() const -> QString;
void SetLabelPrefix(const QString &prefix);
void LiteParseIncrements();
@ -112,18 +113,18 @@ public:
static const QString AttrReadOnly;
static const QString AttrLabelPrefix;
int ElementsToParse() const;
auto ElementsToParse() const -> int;
signals:
void PreParseState();
public slots:
virtual void LiteParseTree(const Document &parse) override;
void LiteParseTree(const Document &parse) override;
void RefreshPieceGeometry();
protected:
virtual void customEvent(QEvent * event) override;
void customEvent(QEvent *event) override;
private:
// cppcheck-suppress unknownMacro
@ -141,50 +142,46 @@ private:
* finish */
bool m_parsing{false};
VNodeDetail ParseDetailNode(const QDomElement &domElement) const;
static auto ParseDetailNode(const QDomElement &domElement) -> VNodeDetail;
void ParseRootElement(const Document &parse, const QDomNode &node);
void ParseDrawElement(const QDomNode& node, const Document &parse);
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
void ParseDrawModeElement(QDomElement &domElement, const Document &parse, const Draw &mode);
void ParseDetailElement(QDomElement &domElement, const Document &parse);
void ParseDetailInternals(const QDomElement &domElement, VPiece &detail) const;
QVector<VPieceNode> ParseDetailNodes(const QDomElement &domElement, qreal width, bool closed) const;
VPieceLabelData ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData ppData) const;
VPatternLabelData ParsePiecePatternInfo(const QDomElement &domElement, VPatternLabelData patternInfo) const;
VGrainlineData ParsePieceGrainline(const QDomElement &domElement, VGrainlineData gGeometry) const;
auto ParseDetailNodes(const QDomElement &domElement, qreal width, bool closed) const -> QVector<VPieceNode>;
auto ParsePieceDataTag(const QDomElement &domElement, VPieceLabelData ppData) const -> VPieceLabelData;
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 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 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 PrepareForParse(const Document &parse);
void ToolsCommonAttributes(const QDomElement &domElement, quint32 &id);
void DrawToolsCommonAttributes(const QDomElement &domElement, quint32 &id, QString &notes);
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 &notes);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject,
quint32 &idTool);
template <typename T>
QRectF ToolBoundingRect(const QRectF &rec, quint32 id) const;
void DrawPointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my, QString &notes);
void SplinesCommonAttributes(const QDomElement &domElement, quint32 &id, quint32 &idObject, quint32 &idTool);
template <typename T> auto ToolBoundingRect(const QRectF &rec, quint32 id) const -> QRectF;
void ParseCurrentPP();
QString GetLabelBase(quint32 index)const;
auto GetLabelBase(quint32 index) const -> QString;
void ParseToolBasePoint(VMainGraphicsScene *scene, const 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 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);
QDomElement FindIncrement(const QString &name) const;
auto MakeEmptyIncrement(const QString &name, IncrementType type) -> QDomElement;
auto FindIncrement(const QString &name) const -> QDomElement;
void NewEmptyIncrement(const QString &type, 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);
QString LastDrawName() const;
quint32 LastToolId() const;
quint32 PPLastToolId(const QString &name) const;
auto LastDrawName() const -> QString;
auto LastToolId() const -> quint32;
auto PPLastToolId(const QString &name) const -> quint32;
};
#endif // VPATTERN_H

View File

@ -32,7 +32,7 @@ FvAvailableUpdate::FvAvailableUpdate(QObject *parent)
}
//---------------------------------------------------------------------------------------------------------------------
QUrl FvAvailableUpdate::GetEnclosureUrl() const
auto FvAvailableUpdate::GetEnclosureUrl() const -> QUrl
{
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;
}
@ -62,7 +62,7 @@ void FvAvailableUpdate::SetEnclosureVersion(const QString &enclosureVersion)
}
//---------------------------------------------------------------------------------------------------------------------
QString FvAvailableUpdate::GetEnclosurePlatform() const
auto FvAvailableUpdate::GetEnclosurePlatform() const -> QString
{
return m_enclosurePlatform;
}

View File

@ -36,14 +36,14 @@ class FvAvailableUpdate final : public QObject
public:
explicit FvAvailableUpdate(QObject *parent = nullptr);
QUrl GetEnclosureUrl() const;
auto GetEnclosureUrl() const -> QUrl;
void SetEnclosureUrl(const QUrl &enclosureUrl);
void SetEnclosureUrl(const QString &enclosureUrl);
QString GetEnclosureVersion() const;
auto GetEnclosureVersion() const -> QString;
void SetEnclosureVersion(const QString &enclosureVersion);
QString GetEnclosurePlatform() const;
auto GetEnclosurePlatform() const -> QString;
void SetEnclosurePlatform(const QString &enclosurePlatform);
private:

View File

@ -60,7 +60,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, testFeedURL, // NOLINT
QPointer<FvUpdater> FvUpdater::m_Instance;
//---------------------------------------------------------------------------------------------------------------------
FvUpdater* FvUpdater::sharedUpdater()
auto FvUpdater::sharedUpdater() -> FvUpdater *
{
static QMutex mutex;
if (m_Instance.isNull())
@ -83,13 +83,13 @@ void FvUpdater::drop()
}
//---------------------------------------------------------------------------------------------------------------------
QString FvUpdater::CurrentFeedURL()
auto FvUpdater::CurrentFeedURL() -> QString
{
return FvUpdater::IsTestBuild() ? *testFeedURL : *defaultFeedURL;
}
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::IsTestBuild()
auto FvUpdater::IsTestBuild() -> bool
{
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();
}
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::IsDropOnFinnish() const
auto FvUpdater::IsDropOnFinnish() const -> bool
{
return m_dropOnFinnish;
}
@ -172,7 +172,7 @@ void FvUpdater::SetDropOnFinnish(bool value)
}
//---------------------------------------------------------------------------------------------------------------------
QPointer<FvAvailableUpdate> FvUpdater::GetProposedUpdate()
auto FvUpdater::GetProposedUpdate() -> QPointer<FvAvailableUpdate>
{
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())
{
@ -396,7 +396,7 @@ void FvUpdater::httpFeedDownloadFinished()
}
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::xmlParseFeed()
auto FvUpdater::xmlParseFeed() -> bool
{
QString xmlEnclosureUrl, xmlEnclosureVersion, xmlEnclosurePlatform;
@ -478,9 +478,8 @@ bool FvUpdater::xmlParseFeed()
}
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdater::searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl,
const QString &xmlEnclosureVersion,
const QString &xmlEnclosurePlatform)
auto FvUpdater::searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl, const QString &xmlEnclosureVersion,
const QString &xmlEnclosurePlatform) -> bool
{
qDebug() << "Enclosure URL:" << xmlEnclosureUrl;
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:
// 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"
<< "Q_OS_MAC"

View File

@ -43,30 +43,30 @@ class FvUpdater final : public QObject
public:
// Singleton
static FvUpdater* sharedUpdater();
static auto sharedUpdater() -> FvUpdater *;
static void drop();
static QString CurrentFeedURL();
static bool IsTestBuild();
static auto CurrentFeedURL() -> QString;
static auto IsTestBuild() -> bool;
// Set / get feed URL
void SetFeedURL(const QUrl &feedURL);
void SetFeedURL(const QString &feedURL);
QString GetFeedURL() const;
auto GetFeedURL() const -> QString;
bool IsDropOnFinnish() const;
auto IsDropOnFinnish() const -> bool;
void SetDropOnFinnish(bool value);
public slots:
// Check for updates
bool CheckForUpdates(bool silentAsMuchAsItCouldGet = true);
auto CheckForUpdates(bool silentAsMuchAsItCouldGet = true) -> bool;
// Aliases
bool CheckForUpdatesSilent();
bool CheckForUpdatesNotSilent();
auto CheckForUpdatesSilent() -> bool;
auto CheckForUpdatesNotSilent() -> bool;
protected:
friend class FvUpdateWindow; // Uses GetProposedUpdate() and others
QPointer<FvAvailableUpdate> GetProposedUpdate();
auto GetProposedUpdate() -> QPointer<FvAvailableUpdate>;
protected slots:
// Update window button slots
@ -123,15 +123,13 @@ private:
// Show an informational message
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
bool searchDownloadedFeedForUpdates(const QString &xmlEnclosureUrl,
const QString &xmlEnclosureVersion,
const QString &xmlEnclosurePlatform);
static bool VersionIsIgnored(const QString &version);
static auto VersionIsIgnored(const QString &version) -> bool;
static void IgnoreVersion(const QString &version);
static bool CurrentlyRunningOnPlatform(const QString &platform);
static auto CurrentlyRunningOnPlatform(const QString &platform) -> bool;
};
#endif // FVUPDATER_H

View File

@ -59,7 +59,7 @@ FvUpdateWindow::~FvUpdateWindow()
}
//---------------------------------------------------------------------------------------------------------------------
bool FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate()
auto FvUpdateWindow::UpdateWindowWithCurrentProposedUpdate() -> bool
{
QPointer<FvAvailableUpdate> proposedUpdate = FvUpdater::sharedUpdater()->GetProposedUpdate();
if (proposedUpdate.isNull())

View File

@ -46,7 +46,7 @@ public:
virtual ~FvUpdateWindow();
// Update the current update proposal from FvUpdater
bool UpdateWindowWithCurrentProposedUpdate();
auto UpdateWindowWithCurrentProposedUpdate() -> bool;
private:
// cppcheck-suppress unknownMacro

View File

@ -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 )
{
@ -78,7 +78,7 @@ VException &VException::operator=(const VException &e) V_NOEXCEPT_EXPR (true)
* @brief ErrorMessage return main error message
* @return error message
*/
QString VException::ErrorMessage() const
auto VException::ErrorMessage() const -> QString
{
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())
{
@ -114,7 +114,7 @@ QString VException::MoreInfo(const QString &detInfo) const
* @brief DetailedInformation return detailed information about error
* @return detailed information
*/
QString VException::DetailedInformation() const
auto VException::DetailedInformation() const -> QString
{
return moreInfo;
}
@ -125,7 +125,7 @@ QString VException::DetailedInformation() const
* @return new exception
*/
// cppcheck-suppress unusedFunction
VException *VException::clone() const
auto VException::clone() const -> VException *
{
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 )
{
@ -174,7 +175,7 @@ Q_NORETURN void VExceptionToolWasDeleted::raise() const
}
//---------------------------------------------------------------------------------------------------------------------
VExceptionToolWasDeleted *VExceptionToolWasDeleted::clone() const
auto VExceptionToolWasDeleted::clone() const -> VExceptionToolWasDeleted *
{
return new VExceptionToolWasDeleted(*this);
}

View File

@ -49,19 +49,19 @@ class VException : public QException
public:
explicit VException(const QString &error) 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;
Q_NORETURN virtual void raise() const override;
// 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 QString DetailedInformation() const;
QString WhatUtf8() const V_NOEXCEPT_EXPR (true);
virtual auto ErrorMessage() const -> QString;
virtual auto DetailedInformation() const -> QString;
auto WhatUtf8() const V_NOEXCEPT_EXPR(true) -> QString;
void AddMoreInformation(const QString &info);
QString MoreInformation() const;
auto MoreInformation() const -> QString;
protected:
/** @brief error string with error */
@ -70,7 +70,7 @@ protected:
/** @brief moreInfo more information about error */
QString moreInfo {};
QString MoreInfo(const QString &detInfo) const;
auto MoreInfo(const QString &detInfo) const -> QString;
};
QT_WARNING_POP
@ -80,7 +80,7 @@ QT_WARNING_POP
* @brief What 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;
}
@ -90,7 +90,7 @@ inline QString VException::WhatUtf8() const V_NOEXCEPT_EXPR (true)
* @brief MoreInformation return more information for error
* @return information
*/
inline QString VException::MoreInformation() const
inline auto VException::MoreInformation() const -> QString
{
return moreInfo;
}
@ -102,12 +102,12 @@ class VExceptionToolWasDeleted : public VException
public:
explicit VExceptionToolWasDeleted(const QString &error) 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;
Q_NORETURN virtual void raise() const override;
// cppcheck-suppress unusedFunction
virtual VExceptionToolWasDeleted *clone() const override;
virtual auto clone() const -> VExceptionToolWasDeleted * override;
};
#endif // VEXCEPTION_H

View File

@ -57,7 +57,7 @@ VExceptionBadId::VExceptionBadId(const VExceptionBadId &e) V_NOEXCEPT_EXPR (true
: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 )
{
@ -74,7 +74,7 @@ VExceptionBadId &VExceptionBadId::operator=(const VExceptionBadId &e) V_NOEXCEPT
* @brief ErrorMessage return main error message
* @return main error message
*/
QString VExceptionBadId::ErrorMessage() const
auto VExceptionBadId::ErrorMessage() const -> QString
{
QString error;
if (key.isEmpty())

View File

@ -45,16 +45,17 @@ public:
VExceptionBadId(const QString &error, const quint32 &id) V_NOEXCEPT_EXPR (true);
VExceptionBadId(const QString &error, const QString &key) 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;
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:
/** @brief id id */
quint32 id;
@ -68,7 +69,7 @@ protected:
* @brief BadId return bad id
* @return id
*/
inline quint32 VExceptionBadId::BadId() const
inline auto VExceptionBadId::BadId() const -> quint32
{
return id;
}
@ -78,7 +79,7 @@ inline quint32 VExceptionBadId::BadId() const
* @brief BadKey return bad key
* @return key
*/
inline QString VExceptionBadId::BadKey() const
inline auto VExceptionBadId::BadKey() const -> QString
{
return key;
}

View File

@ -54,8 +54,8 @@ VExceptionConversionError::VExceptionConversionError(const VExceptionConversionE
{}
//---------------------------------------------------------------------------------------------------------------------
VExceptionConversionError &
VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR (true)
auto VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXCEPT_EXPR(true)
-> VExceptionConversionError &
{
if ( &e == this )
{
@ -71,7 +71,7 @@ VExceptionConversionError::operator=(const VExceptionConversionError &e) V_NOEXC
* @brief ErrorMessage 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);
}

View File

@ -43,16 +43,17 @@ class VExceptionConversionError final : public VException
public:
VExceptionConversionError(const QString &error, const QString &str) 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;
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); }
virtual QString ErrorMessage() const override;
QString String() const;
virtual auto ErrorMessage() const -> QString override;
auto String() const -> QString;
protected:
/** @brief str string, where happend error */
QString str;
@ -63,7 +64,7 @@ protected:
* @brief String return string, where happend error
* @return string
*/
inline QString VExceptionConversionError::String() const
inline auto VExceptionConversionError::String() const -> QString
{
return str;
}

View File

@ -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 )
{
@ -81,7 +82,7 @@ VExceptionEmptyParameter &VExceptionEmptyParameter::operator=(const VExceptionEm
* @brief ErrorMessage 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);
}
@ -91,7 +92,7 @@ QString VExceptionEmptyParameter::ErrorMessage() const
* @brief DetailedInformation return detailed information about error
* @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));
}

View File

@ -47,20 +47,21 @@ public:
VExceptionEmptyParameter(const QString &what, const QString &name,
const QDomElement &domElement) 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;
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); }
virtual QString ErrorMessage() const override;
virtual QString DetailedInformation() const override;
QString Name() const;
QString TagText() const;
QString TagName() const;
qint32 LineNumber() const;
virtual auto ErrorMessage() const -> QString override;
virtual auto DetailedInformation() const -> QString override;
auto Name() const -> QString;
auto TagText() const -> QString;
auto TagName() const -> QString;
auto LineNumber() const -> qint32;
protected:
/** @brief name name attribute */
QString name;
@ -80,7 +81,7 @@ protected:
* @brief Name return name of attribute where error
* @return name
*/
inline QString VExceptionEmptyParameter::Name() const
inline auto VExceptionEmptyParameter::Name() const -> QString
{
return name;
}
@ -90,7 +91,7 @@ inline QString VExceptionEmptyParameter::Name() const
* @brief TagText return tag text
* @return tag text
*/
inline QString VExceptionEmptyParameter::TagText() const
inline auto VExceptionEmptyParameter::TagText() const -> QString
{
return tagText;
}
@ -100,7 +101,7 @@ inline QString VExceptionEmptyParameter::TagText() const
* @brief TagName return tag name
* @return tag name
*/
inline QString VExceptionEmptyParameter::TagName() const
inline auto VExceptionEmptyParameter::TagName() const -> QString
{
return tagName;
}
@ -110,7 +111,7 @@ inline QString VExceptionEmptyParameter::TagName() const
* @brief LineNumber return line number of tag
* @return line number
*/
inline qint32 VExceptionEmptyParameter::LineNumber() const
inline auto VExceptionEmptyParameter::LineNumber() const -> qint32
{
return lineNumber;
}

View File

@ -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 )
{

View File

@ -35,12 +35,12 @@ class VExceptionInvalidHistory : public VException
public:
explicit VExceptionInvalidHistory(const QString &error) 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;
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); }
};

View File

@ -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 )
{

View File

@ -35,12 +35,12 @@ class VExceptionInvalidNotch : public VException
public:
explicit VExceptionInvalidNotch(const QString &error) 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;
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); }
};

View File

@ -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 )
{
@ -82,7 +82,7 @@ VExceptionObjectError &VExceptionObjectError::operator=(const VExceptionObjectEr
* @brief ErrorMessage return main error message
* @return main error message
*/
QString VExceptionObjectError::ErrorMessage() const
auto VExceptionObjectError::ErrorMessage() const -> QString
{
return QString("ExceptionObjectError: %1").arg(error);
}
@ -92,7 +92,7 @@ QString VExceptionObjectError::ErrorMessage() const
* @brief DetailedInformation return detailed information about error
* @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));
}

View File

@ -47,18 +47,22 @@ public:
VExceptionObjectError(const QString &what, const QDomElement &domElement) V_NOEXCEPT_EXPR (true);
explicit VExceptionObjectError(const QString &what) 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;
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:
/** @brief tagText tag text */
QString tagText;
@ -75,7 +79,7 @@ protected:
* @brief TagText return tag text
* @return tag text
*/
inline QString VExceptionObjectError::TagText() const
inline auto VExceptionObjectError::TagText() const -> QString
{
return tagText;
}
@ -85,7 +89,7 @@ inline QString VExceptionObjectError::TagText() const
* @brief TagName return tag name
* @return tag name
*/
inline QString VExceptionObjectError::TagName() const
inline auto VExceptionObjectError::TagName() const -> QString
{
return tagName;
}
@ -95,7 +99,7 @@ inline QString VExceptionObjectError::TagName() const
* @brief LineNumber return line number in file
* @return line number
*/
inline qint32 VExceptionObjectError::LineNumber() const
inline auto VExceptionObjectError::LineNumber() const -> qint32
{
return lineNumber;
}

View File

@ -40,8 +40,8 @@ V_NOEXCEPT_EXPR (true)
{}
//---------------------------------------------------------------------------------------------------------------------
VExceptionTerminatedPosition &VExceptionTerminatedPosition::operator=(const VExceptionTerminatedPosition &e)
V_NOEXCEPT_EXPR (true)
auto VExceptionTerminatedPosition::operator=(const VExceptionTerminatedPosition &e) V_NOEXCEPT_EXPR(true)
-> VExceptionTerminatedPosition &
{
if ( &e == this )
{
@ -62,7 +62,7 @@ void VExceptionTerminatedPosition::raise() const
}
//---------------------------------------------------------------------------------------------------------------------
VExceptionTerminatedPosition *VExceptionTerminatedPosition::clone() const
auto VExceptionTerminatedPosition::clone() const -> VExceptionTerminatedPosition *
{
return new VExceptionTerminatedPosition(*this);
}

View File

@ -35,13 +35,13 @@ class VExceptionTerminatedPosition : public VException
public:
explicit VExceptionTerminatedPosition(const QString &error) 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);
Q_NORETURN virtual void raise() const override;
// cppcheck-suppress unusedFunction
Q_REQUIRED_RESULT virtual VExceptionTerminatedPosition *clone() const override;
Q_REQUIRED_RESULT virtual auto clone() const -> VExceptionTerminatedPosition * override;
};
#endif // VEXCEPTIONTERMINATEDPOSITION_H

View File

@ -44,7 +44,7 @@ public:
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

View File

@ -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 )
{
@ -77,7 +77,7 @@ VExceptionWrongId &VExceptionWrongId::operator=(const VExceptionWrongId &e) V_NO
* @brief ErrorMessage return main error message
* @return main error message
*/
QString VExceptionWrongId::ErrorMessage() const
auto VExceptionWrongId::ErrorMessage() const -> QString
{
return QString("ExceptionWrongId: %1").arg(error);
}
@ -87,7 +87,7 @@ QString VExceptionWrongId::ErrorMessage() const
* @brief DetailedInformation return detailed information about error
* @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));
}

View File

@ -46,18 +46,22 @@ class VExceptionWrongId : public VException
public:
VExceptionWrongId(const QString &what, const QDomElement &domElement) 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;
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:
/** @brief tagText tag text */
QString tagText;
@ -74,7 +78,7 @@ protected:
* @brief TagText return tag text
* @return tag text
*/
inline QString VExceptionWrongId::TagText() const
inline auto VExceptionWrongId::TagText() const -> QString
{
return tagText;
}
@ -84,7 +88,7 @@ inline QString VExceptionWrongId::TagText() const
* @brief TagName return tag name
* @return tag name
*/
inline QString VExceptionWrongId::TagName() const
inline auto VExceptionWrongId::TagName() const -> QString
{
return tagName;
}
@ -94,7 +98,7 @@ inline QString VExceptionWrongId::TagName() const
* @brief LineNumber return line number in file
* @return line number
*/
inline qint32 VExceptionWrongId::LineNumber() const
inline auto VExceptionWrongId::LineNumber() const -> qint32
{
return lineNumber;
}

View File

@ -159,7 +159,7 @@ const QString TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
* @brief Styles return list of all line styles.
* @return list of all line styles.
*/
QStringList StylesList()
auto StylesList() -> QStringList
{
return QStringList{
TypeLineNone,
@ -176,7 +176,7 @@ QStringList StylesList()
* @brief LineStyle return pen style for current line style.
* @return pen style.
*/
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine)
auto LineStyleToPenStyle(const QString &typeLine) -> Qt::PenStyle
{
const QStringList styles = StylesList();
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_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);
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;
const QStringList styles = StylesList();
for (auto &s : styles)
for (const auto &s : styles)
{
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();
map.remove(TypeLineNone);

View File

@ -176,12 +176,12 @@ extern const QString TypeLineDotLine;
extern const QString TypeLineDashDotLine;
extern const QString TypeLineDashDotDotLine;
QStringList StylesList();
Qt::PenStyle LineStyleToPenStyle(const QString &typeLine);
QString PenStyleToLineStyle(Qt::PenStyle penStyle);
QIcon PenStylePic(Qt::PenStyle style);
QMap<QString, QIcon> LineStylesPics();
QMap<QString, QIcon> CurvePenStylesPics();
auto StylesList() -> QStringList;
auto LineStyleToPenStyle(const QString &typeLine) -> Qt::PenStyle;
auto PenStyleToLineStyle(Qt::PenStyle penStyle) -> QString;
auto PenStylePic(Qt::PenStyle style) -> QIcon;
auto LineStylesPics() -> QMap<QString, QIcon>;
auto CurvePenStylesPics() -> QMap<QString, QIcon>;
extern const QString ColorDefault;
extern const QString ColorBlack;

View File

@ -44,9 +44,9 @@ auto IsMimeTypeImage(const QMimeType &mime) -> bool
QStringList aliases = mime.aliases();
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(); });
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -64,7 +64,7 @@ VAbstractConverter::VAbstractConverter(const QString &fileName)
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractConverter::Convert()
auto VAbstractConverter::Convert() -> QString
{
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();
if (schemas.contains(ver))

View File

@ -48,9 +48,9 @@ public:
explicit VAbstractConverter(const QString &fileName);
virtual ~VAbstractConverter() = default;
QString Convert();
auto Convert() -> QString;
unsigned GetCurrentFormatVersion() const;
auto GetCurrentFormatVersion() const -> unsigned;
protected:
unsigned m_ver;
@ -62,17 +62,17 @@ protected:
virtual void Save();
virtual void SetVersion(const QString &version);
virtual unsigned MinVer() const =0;
virtual unsigned MaxVer() const =0;
virtual auto MinVer() const -> unsigned = 0;
virtual auto MaxVer() const -> unsigned = 0;
virtual QString MinVerStr() const =0;
virtual QString MaxVerStr() const =0;
virtual auto MinVerStr() const -> QString = 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 DowngradeToCurrentMaxVersion() =0;
virtual bool IsReadOnly() const =0;
virtual auto IsReadOnly() const -> bool = 0;
virtual auto Schemas() const -> QHash <unsigned, QString> =0;

View File

@ -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
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
QMap<QString, QString> names;

View File

@ -47,8 +47,8 @@ public:
protected:
void AddRootComment();
static QMultiMap<QString, QString> OldNamesToNewNames_InV0_3_0();
static QMap<QString, QString> OldNamesToNewNames_InV0_3_3();
static auto OldNamesToNewNames_InV0_3_0() -> QMultiMap<QString, QString>;
static auto OldNamesToNewNames_InV0_3_3() -> QMap<QString, QString>;
private:
Q_DISABLE_COPY_MOVE(VAbstractMConverter) // NOLINT

View File

@ -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
{
@ -220,7 +220,7 @@ void GatherTokens(QSet<QString> &tokens, const QList<QString> &tokenList)
* @param materials materials from pattern
* @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();
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)
{
@ -316,13 +316,13 @@ VAbstractPattern::~VAbstractPattern()
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPattern::RequiresMeasurements() const
auto VAbstractPattern::RequiresMeasurements() const -> bool
{
return not ListMeasurements().isEmpty();
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VAbstractPattern::ListMeasurements() const
auto VAbstractPattern::ListMeasurements() const -> QStringList
{
const QFuture<QStringList> futureIncrements = QtConcurrent::run([this](){return ListIncrements();});
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.
* @return true if found.
*/
bool VAbstractPattern::GetActivDrawElement(QDomElement &element) const
auto VAbstractPattern::GetActivDrawElement(QDomElement &element) const -> bool
{
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;
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.
* @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");
const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw );
@ -445,7 +445,7 @@ bool VAbstractPattern::CheckExistNamePP(const QString &name) const
* @param element element.
* @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");
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();
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())
{
@ -566,7 +566,7 @@ QDomElement VAbstractPattern::GetPPElement(const QString &name)
* @param newName new pattern piece name.
* @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 oldName.isEmpty(), Q_FUNC_INFO, "old name pattern piece is empty");
@ -595,12 +595,10 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa
emit ChangedNameDraw(oldName, newName);
return true;
}
else
{
qDebug() << "Can't find pattern piece node with name" << oldName << Q_FUNC_INFO;
return false;
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
@ -611,7 +609,7 @@ bool VAbstractPattern::ChangeNamePP(const QString &oldName, const QString &newNa
* @param name pattern peace name.
* @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");
if (name.isEmpty())
@ -627,7 +625,7 @@ bool VAbstractPattern::appendPP(const QString &name)
}
//---------------------------------------------------------------------------------------------------------------------
quint32 VAbstractPattern::getCursor() const
auto VAbstractPattern::getCursor() const -> quint32
{
return cursor;
}
@ -676,7 +674,7 @@ void VAbstractPattern::Clear()
* @param id tool id.
* @return tool.
*/
VDataTool *VAbstractPattern::getTool(quint32 id)
auto VAbstractPattern::getTool(quint32 id) -> VDataTool *
{
ToolExists(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;
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;
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;
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;
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 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.
* @return list of history records.
*/
QVector<VToolRecord> *VAbstractPattern::getHistory()
auto VAbstractPattern::getHistory() -> QVector<VToolRecord> *
{
return &history;
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VToolRecord> VAbstractPattern::getLocalHistory() const
auto VAbstractPattern::getLocalHistory() const -> QVector<VToolRecord>
{
return getLocalHistory(GetNameActivPP());
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::MPath() const
auto VAbstractPattern::MPath() const -> QString
{
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
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;
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetDescription() const
auto VAbstractPattern::GetDescription() const -> QString
{
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);
}
@ -1011,7 +1009,7 @@ void VAbstractPattern::SetNotes(const QString &text)
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetPatternName() const
auto VAbstractPattern::GetPatternName() const -> QString
{
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;
}
@ -1045,7 +1043,7 @@ void VAbstractPattern::SetCompanyName(const QString& qsName)
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetPatternNumber() const
auto VAbstractPattern::GetPatternNumber() const -> QString
{
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);
}
@ -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");
}
@ -1094,7 +1092,7 @@ void VAbstractPattern::SetCustomerBirthDate(const QDate &date)
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetCustomerEmail() const
auto VAbstractPattern::GetCustomerEmail() const -> QString
{
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;
}
@ -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();
@ -1164,7 +1162,7 @@ void VAbstractPattern::SetPatternLabelTemplate(const QVector<VLabelTemplateLine>
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VLabelTemplateLine> VAbstractPattern::GetPatternLabelTemplate() const
auto VAbstractPattern::GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>
{
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);
@ -1196,8 +1194,7 @@ bool VAbstractPattern::SetWatermarkPath(const QString &path)
modified = true;
return true;
}
else
{
if (setTagText(tag, path))
{
emit patternChanged(false);
@ -1212,10 +1209,9 @@ bool VAbstractPattern::SetWatermarkPath(const QString &path)
return false;
}
}
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetWatermarkPath() const
auto VAbstractPattern::GetWatermarkPath() const -> QString
{
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())
{
@ -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);
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);
}
@ -1293,13 +1289,13 @@ void VAbstractPattern::SetPatternWasChanged(bool changed)
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPattern::GetPatternWasChanged() const
auto VAbstractPattern::GetPatternWasChanged() const -> bool
{
return patternLabelWasChanged;
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::GetPassmarkLengthVariable() const
auto VAbstractPattern::GetPassmarkLengthVariable() const -> QString
{
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);
}
@ -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;
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);
@ -1698,7 +1694,7 @@ int VAbstractPattern::GetIndexActivPP() const
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VAbstractPattern::ListIncrements() const
auto VAbstractPattern::ListIncrements() const -> QStringList
{
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.
// 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.
// 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.
// 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.
// 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;
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.
// 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;
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.
// 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.
// 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.
// 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;
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.
// 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;
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)
{
@ -2017,12 +2013,10 @@ bool VAbstractPattern::IsVariable(const QString &token) const
{
return token == var;
}
else
{
return true;
}
}
}
if (token.startsWith('#'))
{
@ -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)
{
@ -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");
@ -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;
@ -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;
@ -2163,7 +2157,7 @@ void VAbstractPattern::SetFMeasurements(QDomElement &element, const QVector<VFin
{
if (not element.isNull())
{
for (auto &m : measurements)
for (const auto &m : measurements)
{
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.
* @return true if the document was modified without using QUndoStack.
*/
bool VAbstractPattern::IsModified() const
auto VAbstractPattern::IsModified() const -> bool
{
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);
for (int i=0; i < draws.size(); ++i)
@ -2374,7 +2368,7 @@ auto VAbstractPattern::CreateGroup(quint32 id, const QString &name, const QStrin
return group;
}
//---------------------------------------------------------------------------------------------------------------------
vidtype VAbstractPattern::GroupLinkedToTool(vidtype toolId) const
auto VAbstractPattern::GroupLinkedToTool(vidtype toolId) const -> vidtype
{
const QDomNodeList groups = elementsByTagName(TagGroup);
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");
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;
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;
@ -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
* @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;
@ -2679,7 +2674,7 @@ QMap<quint32, QString> VAbstractPattern::GetGroupsContainingItem(quint32 toolId,
* @param objectId object id
* @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;
@ -2720,13 +2715,13 @@ auto VAbstractPattern::ReadUnits() const -> Unit
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::ReadPatternNumber() const
auto VAbstractPattern::ReadPatternNumber() const -> QString
{
return UniqueTagText(TagPatternNum);
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::ReadLabelDateFormat() const
auto VAbstractPattern::ReadLabelDateFormat() const -> QString
{
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);
}
@ -2768,13 +2763,13 @@ auto VAbstractPattern::ReadMPath() const -> QString
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::ReadWatermarkPath() const
auto VAbstractPattern::ReadWatermarkPath() const -> QString
{
return UniqueTagText(TagWatermark);
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractPattern::ReadCompanyName() const
auto VAbstractPattern::ReadCompanyName() const -> QString
{
return UniqueTagText(TagCompanyName);
}
@ -2787,7 +2782,7 @@ QString VAbstractPattern::ReadCompanyName() const
* @param groupId group id
* @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);
@ -2833,7 +2828,7 @@ QDomElement VAbstractPattern::AddItemToGroup(quint32 toolId, quint32 objectId, q
* @param groupId group id
* @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);
@ -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);
if (group.isElement())
{
return GetParametrBool(group, AttrVisible, trueStr);
}
else
{
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);
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());
}
//---------------------------------------------------------------------------------------------------------------------
VContainer VAbstractPattern::GetCompletePPData(const QString &name) const
auto VAbstractPattern::GetCompletePPData(const QString &name) const -> VContainer
{
Q_UNUSED(name)
return VContainer(nullptr, nullptr, VContainer::UniqueNamespace());
}
//---------------------------------------------------------------------------------------------------------------------
Unit VAbstractPattern::Units() const
auto VAbstractPattern::Units() const -> Unit
{
return m_units;
}
//---------------------------------------------------------------------------------------------------------------------
QStringList VAbstractPattern::FilterGroupTags(const QString &tags)
auto VAbstractPattern::FilterGroupTags(const QString &tags) -> QStringList
{
if (tags.isEmpty())
{

View File

@ -101,24 +101,24 @@ public:
explicit VAbstractPattern(QObject *parent = nullptr);
virtual ~VAbstractPattern();
bool RequiresMeasurements() const;
QStringList ListMeasurements() const;
QVector<VFormulaField> ListExpressions() const;
QVector<VFormulaField> ListIncrementExpressions() const;
auto RequiresMeasurements() const -> bool;
auto ListMeasurements() const -> QStringList;
auto ListExpressions() const -> QVector<VFormulaField>;
auto ListIncrementExpressions() const -> QVector<VFormulaField>;
virtual void CreateEmptyFile()=0;
void ChangeActivPP(const QString& name, const Document &parse = Document::FullParse);
QString GetNameActivPP() const;
bool CheckExistNamePP(const QString& name) const;
int CountPP() const;
QDomElement GetPPElement(const QString &name);
bool ChangeNamePP(const QString& oldName, const QString &newName);
bool appendPP(const QString& name);
auto GetNameActivPP() const -> QString;
auto CheckExistNamePP(const QString &name) const -> bool;
auto CountPP() const -> int;
auto GetPPElement(const QString &name) -> QDomElement;
auto ChangeNamePP(const QString &oldName, const QString &newName) -> bool;
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);
virtual void setXMLContent(const QString &fileName) override;
@ -126,87 +126,87 @@ public:
virtual void IncrementReferens(quint32 id) const=0;
virtual void DecrementReferens(quint32 id) const=0;
virtual QString GenerateLabel(const LabelType &type, const QString &reservedName = QString())const=0;
virtual QString GenerateSuffix() const=0;
virtual auto GenerateLabel(const LabelType &type, const QString &reservedName = QString()) const -> QString = 0;
virtual auto GenerateSuffix() const -> QString = 0;
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0;
virtual void Clear();
static VDataTool* getTool(quint32 id);
static auto getTool(quint32 id) -> VDataTool *;
static void AddTool(quint32 id, VDataTool *tool);
static void RemoveTool(quint32 id);
static VPiecePath ParsePieceNodes(const QDomElement &domElement);
static QVector<CustomSARecord> ParsePieceCSARecords(const QDomElement &domElement);
static QVector<quint32> ParsePieceInternalPaths(const QDomElement &domElement);
static QVector<quint32> ParsePiecePointRecords(const QDomElement &domElement);
static auto ParsePieceNodes(const QDomElement &domElement) -> VPiecePath;
static auto ParsePieceCSARecords(const QDomElement &domElement) -> QVector<CustomSARecord>;
static auto ParsePieceInternalPaths(const QDomElement &domElement) -> QVector<quint32>;
static auto ParsePiecePointRecords(const QDomElement &domElement) -> QVector<quint32>;
void AddToolOnRemove(VDataTool *tool);
QVector<VToolRecord> *getHistory();
QVector<VToolRecord> getLocalHistory() const;
auto getHistory() -> QVector<VToolRecord> *;
auto getLocalHistory() const -> QVector<VToolRecord>;
QString MPath() const;
auto MPath() const -> QString;
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);
QString GetNotes() const;
auto GetNotes() const -> QString;
void SetNotes(const QString &text);
QString GetPatternName() const;
auto GetPatternName() const -> QString;
void SetPatternName(const QString& qsName);
QString GetCompanyName() const;
auto GetCompanyName() const -> QString;
void SetCompanyName(const QString& qsName);
QString GetPatternNumber() const;
auto GetPatternNumber() const -> QString;
void SetPatternNumber(const QString &qsNum);
QString GetCustomerName() const;
auto GetCustomerName() const -> QString;
void SetCustomerName(const QString& qsName);
QDate GetCustomerBirthDate() const;
auto GetCustomerBirthDate() const -> QDate;
void SetCustomerBirthDate(const QDate& date);
QString GetCustomerEmail() const;
auto GetCustomerEmail() const -> QString;
void SetCustomerEmail(const QString& email);
QString GetLabelDateFormat() const;
auto GetLabelDateFormat() const -> QString;
void SetLabelDateFormat(const QString &format);
QString GetLabelTimeFormat() const;
auto GetLabelTimeFormat() const -> QString;
void SetLabelTimeFormat(const QString &format);
void SetPatternLabelTemplate(const QVector<VLabelTemplateLine> &lines);
QVector<VLabelTemplateLine> GetPatternLabelTemplate() const;
auto GetPatternLabelTemplate() const -> QVector<VLabelTemplateLine>;
bool SetWatermarkPath(const QString &path);
QString GetWatermarkPath() const;
auto SetWatermarkPath(const QString &path) -> bool;
auto GetWatermarkPath() const -> QString;
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);
QString GetDefaultPieceLabelPath() const;
auto GetDefaultPieceLabelPath() const -> QString;
void SetDefaultPieceLabelPath(const QString &path);
void SetPatternWasChanged(bool changed);
bool GetPatternWasChanged() const;
auto GetPatternWasChanged() const -> bool;
QString GetPassmarkLengthVariable() const;
auto GetPassmarkLengthVariable() const -> QString;
void SetPassmarkLengthVariable(const QString &name);
VPatternImage GetImage() const;
bool SetImage(const VPatternImage &image);
auto GetImage() const -> VPatternImage;
auto SetImage(const VPatternImage &image) -> bool;
void DeleteImage();
auto GetBackgroundImages() const -> QVector<VBackgroundPatternImage>;
@ -215,24 +215,24 @@ public:
void SaveBackgroundImage(const VBackgroundPatternImage &image);
void DeleteBackgroundImage(const QUuid &id);
QString GetVersion() const;
auto GetVersion() const -> QString;
void SetVersion();
bool IsModified() const;
auto IsModified() const -> bool;
void SetModified(bool modified);
QDomElement GetDraw(const QString &name) const;
auto GetDraw(const QString &name) const -> QDomElement;
void ParseGroups(const QDomElement &domElement);
QDomElement CreateGroups(const QString &patternPieceName = QString());
QDomElement CreateGroup(quint32 id, const QString &name, const QStringList &tags,
const QMap<quint32, quint32> &groupData, vidtype tool=null_id);
vidtype GroupLinkedToTool(vidtype toolId) const;
auto CreateGroups(const QString &patternPieceName = QString()) -> QDomElement;
auto CreateGroup(quint32 id, const QString &name, const QStringList &tags, const QMap<quint32, quint32> &groupData,
vidtype tool = null_id) -> QDomElement;
auto GroupLinkedToTool(vidtype toolId) const -> vidtype;
QString GetGroupName(quint32 id);
auto GetGroupName(quint32 id) -> QString;
void SetGroupName(quint32 id, const QString &name);
QStringList GetGroupTags(vidtype id);
auto GetGroupTags(vidtype id) -> QStringList;
void SetGroupTags(quint32 id, const QStringList &tags);
auto GetDimensionAValue() -> double;
@ -244,20 +244,20 @@ public:
auto GetDimensionCValue() -> double;
void SetDimensionCValue(double value);
QStringList GetGroupCategories() const;
auto GetGroupCategories() const -> QStringList;
QMap<quint32, VGroupData> GetGroups(const QString &patternPieceName = QString());
QMap<quint32, QString> GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem);
QDomElement AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId);
QDomElement RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId);
bool GetGroupVisibility(quint32 id);
auto GetGroups(const QString &patternPieceName = QString()) -> QMap<quint32, VGroupData>;
auto GetGroupsContainingItem(quint32 toolId, quint32 objectId, bool containItem) -> QMap<quint32, QString>;
auto AddItemToGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement;
auto RemoveItemFromGroup(quint32 toolId, quint32 objectId, quint32 groupId) -> QDomElement;
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 VContainer GetCompletePPData(const QString &name) const;
virtual auto GetCompleteData() const -> VContainer;
virtual auto GetCompletePPData(const QString &name) const -> VContainer;
auto Units() const -> Unit;
@ -463,22 +463,22 @@ protected:
static bool patternLabelWasChanged;
static void ToolExists(const quint32 &id);
static VPiecePath ParsePathNodes(const QDomElement &domElement);
static VPieceNode ParseSANode(const QDomElement &domElement);
static auto ParsePathNodes(const QDomElement &domElement) -> VPiecePath;
static auto ParseSANode(const QDomElement &domElement) -> VPieceNode;
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 SetChildTag(const QString& qsParent, const QString& qsChild, const QString& qsValue);
int GetIndexActivPP() const;
bool GetActivDrawElement(QDomElement &element) const;
auto GetIndexActivPP() const -> int;
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 ReadPatternNumber() const ->QString;
@ -491,28 +491,28 @@ protected:
private:
Q_DISABLE_COPY_MOVE(VAbstractPattern) // NOLINT
QStringList ListIncrements() const;
QVector<VFormulaField> ListPointExpressions() const;
QVector<VFormulaField> ListArcExpressions() const;
QVector<VFormulaField> ListElArcExpressions() const;
QVector<VFormulaField> ListSplineExpressions() const;
QVector<VFormulaField> ListPathPointExpressions() const;
QVector<VFormulaField> ListOperationExpressions() const;
QVector<VFormulaField> ListNodesExpressions(const QDomElement &nodes) const;
QVector<VFormulaField> ListPathExpressions() const;
QVector<VFormulaField> ListGrainlineExpressions(const QDomElement &element) const;
QVector<VFormulaField> ListPieceExpressions() const;
QVector<VFormulaField> ListFinalMeasurementsExpressions() const;
auto ListIncrements() const -> QStringList;
auto ListPointExpressions() const -> QVector<VFormulaField>;
auto ListArcExpressions() const -> QVector<VFormulaField>;
auto ListElArcExpressions() const -> QVector<VFormulaField>;
auto ListSplineExpressions() const -> QVector<VFormulaField>;
auto ListPathPointExpressions() const -> QVector<VFormulaField>;
auto ListOperationExpressions() const -> QVector<VFormulaField>;
auto ListNodesExpressions(const QDomElement &nodes) const -> QVector<VFormulaField>;
auto ListPathExpressions() const -> QVector<VFormulaField>;
auto ListGrainlineExpressions(const QDomElement &element) const -> QVector<VFormulaField>;
auto ListPieceExpressions() const -> QVector<VFormulaField>;
auto ListFinalMeasurementsExpressions() const -> QVector<VFormulaField>;
bool IsVariable(const QString& token) const;
bool IsFunction(const QString& token) const;
auto IsVariable(const QString &token) const -> bool;
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);
QVector<VFinalMeasurement> GetFMeasurements(const QDomElement &element) const;
auto GetFMeasurements(const QDomElement &element) const -> QVector<VFinalMeasurement>;
void SetFMeasurements(QDomElement &element, const QVector<VFinalMeasurement> &measurements);
auto GetBackgroundPatternImage(const QDomElement &element) const -> VBackgroundPatternImage;
@ -527,7 +527,7 @@ QT_WARNING_POP
* @brief GetNameActivPP return current pattern piece name.
* @return pattern piece name.
*/
inline QString VAbstractPattern::GetNameActivPP() const
inline auto VAbstractPattern::GetNameActivPP() const -> QString
{
return nameActivPP;
}

View File

@ -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();
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();
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())
{
@ -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)
{
@ -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;
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)
@ -428,7 +428,8 @@ bool VDomDocument::SaveCanonicalXML(QIODevice *file, int indent, QString &error)
* @param name attribute name
* @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 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 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 domElement.isNull(), Q_FUNC_INFO, "domElement is null");
@ -525,18 +526,15 @@ 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);
if (value)
{
return NodeUsage::InUse;
}
else
{
return NodeUsage::NotInUse;
}
}
//---------------------------------------------------------------------------------------------------------------------
void VDomDocument::SetParametrUsage(QDomElement &domElement, const QString &name, const NodeUsage &value)
@ -559,8 +557,8 @@ void VDomDocument::SetParametrUsage(QDomElement &domElement, const QString &name
* @return attribute value
* @throw VExceptionEmptyParameter when attribute is empty
*/
QString VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name,
const QString &defValue)
auto VDomDocument::GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue)
-> QString
{
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");
@ -571,16 +569,13 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt
{
throw VExceptionEmptyParameter(QObject::tr("Got empty parameter"), name, domElement);
}
else
{
return defValue;
}
}
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 domElement.isNull(), Q_FUNC_INFO, "domElement is null");
@ -594,7 +589,8 @@ QString VDomDocument::GetParametrEmptyString(const QDomElement &domElement, cons
* @param name attribute name
* @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 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.
* @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");
@ -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);
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;
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);
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())
{
@ -809,7 +805,7 @@ bool VDomDocument::SaveDocument(const QString &fileName, QString &error)
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
QString VDomDocument::Major() const
auto VDomDocument::Major() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split(QChar('.'));
@ -818,7 +814,7 @@ QString VDomDocument::Major() const
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
QString VDomDocument::Minor() const
auto VDomDocument::Minor() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0");
QStringList v = version.split(QChar('.'));
@ -827,7 +823,7 @@ QString VDomDocument::Minor() const
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
QString VDomDocument::Patch() const
auto VDomDocument::Patch() const -> QString
{
QString version = UniqueTagText(TagVersion, "0.0.0");
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);
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);
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);
return domElement.parentNode();
}
//---------------------------------------------------------------------------------------------------------------------
QDomElement VDomDocument::CloneNodeById(const quint32 &nodeId)
auto VDomDocument::CloneNodeById(const quint32 &nodeId) -> QDomElement
{
QDomElement domElement = NodeById(nodeId);
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);
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;
@ -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.
Q_STATIC_ASSERT(Qt::AlignLeft == 1);
@ -1108,7 +1104,7 @@ void VDomDocument::SetLabelTemplate(QDomElement &element, const QVector<VLabelTe
{
if (not element.isNull())
{
for (auto &line : lines)
for (const auto &line : lines)
{
QDomElement tagLine = createElement(TagLine);

View File

@ -98,7 +98,7 @@ public:
explicit VDomDocument(QObject *parent = nullptr);
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>
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,
const std::function<bool(const T&)> &removeCondition) const;
static quint32 GetParametrUInt(const QDomElement& domElement, const QString &name, const QString &defValue);
static int GetParametrInt(const QDomElement& domElement, const QString &name, const QString &defValue);
static bool GetParametrBool(const QDomElement& domElement, const QString &name, const QString &defValue);
static auto GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) -> quint32;
static auto GetParametrInt(const QDomElement &domElement, const QString &name, const QString &defValue) -> int;
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 QString GetParametrString(const QDomElement& domElement, const QString &name,
const QString &defValue = QString());
static QString GetParametrEmptyString(const QDomElement& domElement, const QString &name);
static qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue);
static quint32 GetParametrId(const QDomElement& domElement);
static auto GetParametrString(const QDomElement &domElement, const QString &name,
const QString &defValue = QString()) -> QString;
static auto GetParametrEmptyString(const QDomElement &domElement, const QString &name) -> QString;
static auto GetParametrDouble(const QDomElement &domElement, const QString &name, const QString &defValue) -> qreal;
static auto GetParametrId(const QDomElement &domElement) -> quint32;
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);
QString Major() const;
QString Minor() const;
QString Patch() const;
virtual QString GetFormatVersionStr() const;
static unsigned GetFormatVersion(const QString &version);
virtual auto SaveDocument(const QString &fileName, QString &error) -> bool;
auto Major() const -> QString;
auto Minor() const -> QString;
auto Patch() const -> QString;
virtual auto GetFormatVersionStr() const -> QString;
static auto GetFormatVersion(const QString &version) -> unsigned;
static void RemoveAllChildren(QDomElement &domElement);
QDomNode ParentNodeById(const quint32 &nodeId);
QDomElement CloneNodeById(const quint32 &nodeId);
QDomElement NodeById(const quint32 &nodeId, const QString &tagName = QString());
auto ParentNodeById(const quint32 &nodeId) -> QDomNode;
auto CloneNodeById(const quint32 &nodeId) -> QDomElement;
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 TestUniqueId() const;
void RefreshElementIdCache();
static bool Compare(const QDomElement &element1, const QDomElement &element2);
static auto Compare(const QDomElement &element1, const QDomElement &element2) -> bool;
protected:
bool setTagText(const QString &tag, const QString &text);
bool setTagText(QDomElement &domElement, const QString &text);
QDomElement UniqueTag(const QString &tagName) const;
QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const;
auto setTagText(const QString &tag, const QString &text) -> bool;
auto setTagText(QDomElement &domElement, const QString &text) -> bool;
auto UniqueTag(const QString &tagName) const -> QDomElement;
auto UniqueTagText(const QString &tagName, const QString &defVal = QString()) const -> QString;
void CollectId(const QDomElement &node, QVector<quint32> &vector)const;
static void ValidateVersion(const QString &version);
@ -167,10 +167,10 @@ private:
QHash<quint32, QDomElement> m_elementIdCache;
QFutureWatcher<QHash<quint32, QDomElement>> *m_watcher;
static bool find(QHash<quint32, QDomElement> &cache, const QDomElement &node, quint32 id);
QHash<quint32, QDomElement> RefreshCache(const QDomElement &root) const;
static auto find(QHash<quint32, QDomElement> &cache, const QDomElement &node, quint32 id) -> bool;
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;
};
//---------------------------------------------------------------------------------------------------------------------

View File

@ -63,25 +63,25 @@ auto VLabelTemplateConverter::XSDSchemas() -> QHash<unsigned int, QString>
}
//---------------------------------------------------------------------------------------------------------------------
unsigned VLabelTemplateConverter::MinVer() const
auto VLabelTemplateConverter::MinVer() const -> unsigned
{
return LabelTemplateMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
unsigned VLabelTemplateConverter::MaxVer() const
auto VLabelTemplateConverter::MaxVer() const -> unsigned
{
return LabelTemplateMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
QString VLabelTemplateConverter::MinVerStr() const
auto VLabelTemplateConverter::MinVerStr() const -> QString
{
return LabelTemplateMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VLabelTemplateConverter::MaxVerStr() const
auto VLabelTemplateConverter::MaxVerStr() const -> QString
{
return LabelTemplateMaxVerStr;
}

View File

@ -46,16 +46,16 @@ public:
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected:
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual auto MinVer() const -> unsigned override;
virtual auto MaxVer() const -> unsigned override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual auto MinVerStr() const -> QString override;
virtual auto MaxVerStr() const -> QString override;
virtual void ApplyPatches() 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;

View File

@ -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
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
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
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
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
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
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
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
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
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);
@ -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);
@ -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
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 6, 0),

View File

@ -61,16 +61,16 @@ public:
protected:
void Save() override;
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual auto MinVer() const -> unsigned override;
virtual auto MaxVer() const -> unsigned override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual auto MinVerStr() const -> QString override;
virtual auto MaxVerStr() const -> QString override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override;
virtual auto IsReadOnly() const -> bool override;
auto Schemas() const -> QHash <unsigned, QString> override;
@ -101,8 +101,8 @@ private:
void RemoveColorToolCutV0_3_1();
QSet<QString> FixIncrementsToV0_2_0();
QString FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names);
auto FixIncrementsToV0_2_0() -> QSet<QString>;
auto FixIncrementInFormulaToV0_2_0(const QString &formula, const QSet<QString> &names) -> QString;
void FixPointExpressionsToV0_2_0(const QSet<QString> &names);
void FixArcExpressionsToV0_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 ConvertArcExpressionsToV0_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;
QDomElement TagMeasurementsV0_1_4() const;
QDomElement TagIncrementsV0_1_4() const;
auto MUnitV0_1_4() const -> QString;
auto TagMeasurementsV0_1_4() const -> QDomElement;
auto TagIncrementsV0_1_4() const -> QDomElement;
void FixToolUnionToV0_2_4();
void ParseModelingToV0_2_4(const QDomElement &modeling);
void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector<quint32> &children);
static QMap<QString, QString> OldNamesToNewNames_InV0_2_0();
static QMap<QString, QString> OldNamesToNewNames_InV0_2_1();
static auto OldNamesToNewNames_InV0_2_0() -> QMap<QString, QString>;
static auto OldNamesToNewNames_InV0_2_1() -> QMap<QString, QString>;
void FixCutPoint();
void FixSubPaths(int i, quint32 id, quint32 baseCurve);
@ -129,12 +129,12 @@ private:
void TagRemoveAttributeTypeObjectInV0_4_0();
void TagDetailToV0_4_0();
void TagUnionDetailsToV0_4_0();
QDomElement GetUnionDetailNodesV0_4_0(const QDomElement &detail);
QDomElement GetUnionChildrenNodesV0_4_0(const QDomElement &detail);
auto GetUnionDetailNodesV0_4_0(const QDomElement &detail) -> QDomElement;
auto GetUnionChildrenNodesV0_4_0(const QDomElement &detail) -> QDomElement;
void LabelTagToV0_4_4(const QString &tagName);
QDomElement AddTagPatternLabelV0_5_1();
auto AddTagPatternLabelV0_5_1() -> QDomElement;
void PortPatternLabeltoV0_6_0(QDomElement &label);
void AddLabelTemplateLineV0_6_0(QDomElement &label, const QString &text, bool bold, bool italic, int alignment,
int fontSizeIncrement);
@ -155,25 +155,25 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline unsigned VPatternConverter::MinVer() const
inline auto VPatternConverter::MinVer() const -> unsigned
{
return PatternMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline unsigned VPatternConverter::MaxVer() const
inline auto VPatternConverter::MaxVer() const -> unsigned
{
return PatternMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VPatternConverter::MinVerStr() const
inline auto VPatternConverter::MinVerStr() const -> QString
{
return PatternMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VPatternConverter::MaxVerStr() const
inline auto VPatternConverter::MaxVerStr() const -> QString
{
return PatternMaxVerStr;
}

View File

@ -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 )
{
@ -68,7 +68,7 @@ VToolRecord::VToolRecord(const VToolRecord &record)
{}
//---------------------------------------------------------------------------------------------------------------------
bool VToolRecord::IsMandatory() const
auto VToolRecord::IsMandatory() const -> bool
{
return typeTool != Tool::Pin
&& typeTool != Tool::NodePoint

View File

@ -42,21 +42,21 @@ class VToolRecord
public:
VToolRecord();
VToolRecord(const quint32 &id, const Tool &typeTool, const QString &nameDraw);
bool operator==(const VToolRecord &record) const;
VToolRecord &operator=(const VToolRecord &record);
auto operator==(const VToolRecord &record) const -> bool;
auto operator=(const VToolRecord &record) -> VToolRecord &;
VToolRecord(const VToolRecord &record);
~VToolRecord() = default;
quint32 getId() const;
auto getId() const -> quint32;
void setId(const quint32 &value);
Tool getTypeTool() const;
auto getTypeTool() const -> Tool;
void setTypeTool(const Tool &value);
QString getNameDraw() const;
auto getNameDraw() const -> QString;
void setNameDraw(const QString &value);
bool IsMandatory() const;
auto IsMandatory() const -> bool;
private:
/** @brief id tool id. */
@ -74,7 +74,7 @@ private:
* @brief getId return tool id.
* @return id.
*/
inline quint32 VToolRecord::getId() const
inline auto VToolRecord::getId() const -> quint32
{
return id;
}
@ -94,7 +94,7 @@ inline void VToolRecord::setId(const quint32 &value)
* @brief getTypeTool return tool type.
* @return tool type.
*/
inline Tool VToolRecord::getTypeTool() const
inline auto VToolRecord::getTypeTool() const -> Tool
{
return typeTool;
}
@ -114,7 +114,7 @@ inline void VToolRecord::setTypeTool(const Tool &value)
* @brief getNameDraw return pattern peace name.
* @return pattern peace name.
*/
inline QString VToolRecord::getNameDraw() const
inline auto VToolRecord::getNameDraw() const -> QString
{
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
return id == record.getId()/* && typeTool == record.getTypeTool() && nameDraw == record.getNameDraw()*/;

View File

@ -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
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
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 QList<QString> keys = names.uniqueKeys();
for (auto &key : keys)
for (const auto &key : keys)
{
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
Q_STATIC_ASSERT_X(VVITConverter::MeasurementMinVer < FormatVersion(0, 3, 0),

View File

@ -54,15 +54,15 @@ public:
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected:
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual auto MinVer() const -> unsigned override;
virtual auto MaxVer() const -> unsigned override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual auto MinVerStr() const -> QString override;
virtual auto MaxVerStr() const -> QString override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override;
virtual auto IsReadOnly() const -> bool override;
auto Schemas() const -> QHash <unsigned, QString> override;
@ -71,9 +71,9 @@ private:
static const QString MeasurementMinVerStr;
void AddNewTagsForV0_3_0();
QString MUnitV0_2_0();
auto MUnitV0_2_0() -> QString;
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 PM_SystemV0_3_2();
void ConvertMeasurementsToV0_3_3();
@ -88,25 +88,25 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline unsigned VVITConverter::MinVer() const
inline auto VVITConverter::MinVer() const -> unsigned
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline unsigned VVITConverter::MaxVer() const
inline auto VVITConverter::MaxVer() const -> unsigned
{
return MeasurementMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVITConverter::MinVerStr() const
inline auto VVITConverter::MinVerStr() const -> QString
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVITConverter::MaxVerStr() const
inline auto VVITConverter::MaxVerStr() const -> QString
{
return MeasurementMaxVerStr;
}

View File

@ -209,7 +209,7 @@ void VVSTConverter::ConvertMeasurementsToV0_4_0()
const QMultiMap<QString, QString> names = OldNamesToNewNames_InV0_3_0();
const QList<QString> keys = names.uniqueKeys();
for (auto &key : keys)
for (const auto &key : keys)
{
qreal resValue = 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
Q_STATIC_ASSERT_X(VVSTConverter::MeasurementMinVer < FormatVersion(0, 4, 0),

View File

@ -54,15 +54,15 @@ public:
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected:
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual auto MinVer() const -> unsigned override;
virtual auto MaxVer() const -> unsigned override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual auto MinVerStr() const -> QString override;
virtual auto MaxVerStr() const -> QString override;
virtual void ApplyPatches() override;
virtual void DowngradeToCurrentMaxVersion() override;
virtual bool IsReadOnly() const override;
virtual auto IsReadOnly() const -> bool override;
auto Schemas() const -> QHash <unsigned, QString> override;
@ -73,7 +73,7 @@ private:
void AddNewTagsForV0_4_0();
void RemoveTagsForV0_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 ConvertMeasurementsToV0_4_2();
@ -91,25 +91,25 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline unsigned VVSTConverter::MinVer() const
inline auto VVSTConverter::MinVer() const -> unsigned
{
return MeasurementMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline unsigned VVSTConverter::MaxVer() const
inline auto VVSTConverter::MaxVer() const -> unsigned
{
return MeasurementMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVSTConverter::MinVerStr() const
inline auto VVSTConverter::MinVerStr() const -> QString
{
return MeasurementMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString VVSTConverter::MaxVerStr() const
inline auto VVSTConverter::MaxVerStr() const -> QString
{
return MeasurementMaxVerStr;
}

View File

@ -65,25 +65,25 @@ auto VWatermarkConverter::XSDSchemas() -> QHash<unsigned int, QString>
}
//---------------------------------------------------------------------------------------------------------------------
unsigned VWatermarkConverter::MinVer() const
auto VWatermarkConverter::MinVer() const -> unsigned
{
return WatermarkMinVer;
}
//---------------------------------------------------------------------------------------------------------------------
unsigned VWatermarkConverter::MaxVer() const
auto VWatermarkConverter::MaxVer() const -> unsigned
{
return WatermarkMaxVer;
}
//---------------------------------------------------------------------------------------------------------------------
QString VWatermarkConverter::MinVerStr() const
auto VWatermarkConverter::MinVerStr() const -> QString
{
return WatermarkMinVerStr;
}
//---------------------------------------------------------------------------------------------------------------------
QString VWatermarkConverter::MaxVerStr() const
auto VWatermarkConverter::MaxVerStr() const -> QString
{
return WatermarkMaxVerStr;
}

View File

@ -45,16 +45,16 @@ public:
static auto XSDSchemas() -> QHash <unsigned, QString>;
protected:
virtual unsigned MinVer() const override;
virtual unsigned MaxVer() const override;
virtual auto MinVer() const -> unsigned override;
virtual auto MaxVer() const -> unsigned override;
virtual QString MinVerStr() const override;
virtual QString MaxVerStr() const override;
virtual auto MinVerStr() const -> QString override;
virtual auto MaxVerStr() const -> QString override;
virtual void ApplyPatches() 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;

View File

@ -50,7 +50,7 @@ enum InputToken
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())
{
@ -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;
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);
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,
const QChar &thousand)
auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal, const QChar &thousand)
-> qmusizetype
{
// Must not be equal
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;
@ -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;
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)
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)
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)
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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)
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)
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)
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)
const QString sign = locale.groupSeparator();

View File

@ -143,12 +143,12 @@ const QChar expLower = LocaleExpLower((locale)); \
const QChar decimalPoint = LocaleDecimalPoint((locale)); \
const QChar groupSeparator = LocaleGroupSeparator((locale));
QMUPARSERSHARED_EXPORT QString NameRegExp();
QMUPARSERSHARED_EXPORT auto NameRegExp() -> QString;
QT_WARNING_POP
Q_REQUIRED_RESULT static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2);
static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
Q_REQUIRED_RESULT static inline auto QmuFuzzyComparePossibleNulls(double p1, double p2) -> bool;
static inline auto QmuFuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if(qFuzzyIsNull(p1))
{
@ -163,9 +163,10 @@ static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
return qFuzzyCompare(p1, p2);
}
QMUPARSERSHARED_EXPORT qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale,
const QChar &decimal, const QChar &thousand);
QMUPARSERSHARED_EXPORT auto ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal,
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

View File

@ -123,7 +123,7 @@ void QmuFormulaBase::InitCharSets()
//---------------------------------------------------------------------------------------------------------------------
// Factory function for creating new parser variables
// 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_pUserData)

View File

@ -47,7 +47,7 @@ public:
static void RemoveAll(QMap<vsizetype, QString> &map, const QString &val);
protected:
static qreal* AddVariable(const QString &a_szName, void *a_pUserData);
static auto AddVariable(const QString &a_szName, void *a_pUserData) -> qreal *;
void SetSepForEval();
private:
Q_DISABLE_COPY_MOVE(QmuFormulaBase) // NOLINT

View File

@ -50,7 +50,7 @@ namespace
* @param arcLength length of arc that create two pieces after rotation
* @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);
arcLength = qAbs(arcLength);
@ -130,85 +130,85 @@ namespace qmu
{
//---------------------------------------------------------------------------------------------------------------------
// Trigonometric function
qreal QmuParser::DegreeToRadian(qreal deg)
auto QmuParser::DegreeToRadian(qreal deg) -> qreal
{
return qDegreesToRadians(deg);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::RadianToDegree(qreal rad)
auto QmuParser::RadianToDegree(qreal rad) -> qreal
{
return qRadiansToDegrees(rad);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::Sinh(qreal v)
auto QmuParser::Sinh(qreal v) -> qreal
{
return sinh(v);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::ASinh(qreal v)
auto QmuParser::ASinh(qreal v) -> qreal
{
return log(v + qSqrt(v * v + 1));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::Cosh(qreal v)
auto QmuParser::Cosh(qreal v) -> qreal
{
return cosh(v);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::ACosh(qreal v)
auto QmuParser::ACosh(qreal v) -> qreal
{
return log(v + qSqrt(v * v - 1));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::Tanh(qreal v)
auto QmuParser::Tanh(qreal v) -> qreal
{
return tanh(v);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::ATanh(qreal v)
auto QmuParser::ATanh(qreal v) -> qreal
{
return (0.5 * log((1 + v) / (1 - v)));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::SinD(qreal v)
auto QmuParser::SinD(qreal v) -> qreal
{
return qSin(qDegreesToRadians(v));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::ASinD(qreal v)
auto QmuParser::ASinD(qreal v) -> qreal
{
return qRadiansToDegrees(qAsin(v));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::CosD(qreal v)
auto QmuParser::CosD(qreal v) -> qreal
{
return qCos(qDegreesToRadians(v));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::ACosD(qreal v)
auto QmuParser::ACosD(qreal v) -> qreal
{
return qRadiansToDegrees(qAcos(v));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::TanD(qreal v)
auto QmuParser::TanD(qreal v) -> qreal
{
return qTan(qDegreesToRadians(v));
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::ATanD(qreal v)
auto QmuParser::ATanD(qreal v) -> qreal
{
return qRadiansToDegrees(qAtan(v));
}
@ -218,7 +218,7 @@ qreal QmuParser::ATanD(qreal v)
//---------------------------------------------------------------------------------------------------------------------
// Logarithm base 2
qreal QmuParser::Log2(qreal v)
auto QmuParser::Log2(qreal v) -> qreal
{
#ifdef MUP_MATH_EXCEPTIONS
if (v<=0)
@ -231,7 +231,7 @@ qreal QmuParser::Log2(qreal v)
//---------------------------------------------------------------------------------------------------------------------
// Logarithm base 10
qreal QmuParser::Log10(qreal v)
auto QmuParser::Log10(qreal v) -> qreal
{
#ifdef MUP_MATH_EXCEPTIONS
if (v<=0)
@ -244,25 +244,25 @@ qreal QmuParser::Log10(qreal v)
//---------------------------------------------------------------------------------------------------------------------
// misc
qreal QmuParser::Abs(qreal v)
auto QmuParser::Abs(qreal v) -> qreal
{
return qAbs(v);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::Rint(qreal v)
auto QmuParser::Rint(qreal v) -> qreal
{
return qFloor(v + 0.5);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::R2CM(qreal v)
auto QmuParser::R2CM(qreal v) -> qreal
{
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;
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;
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);
}
//---------------------------------------------------------------------------------------------------------------------
qreal QmuParser::FMod(qreal number, qreal denom)
auto QmuParser::FMod(qreal number, qreal denom) -> qreal
{
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_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)
{
@ -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_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)
{
@ -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_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)
{
@ -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_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)
{
@ -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.
* @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,
const QChar &decimal, const QChar &thousand)
auto QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand) -> int
{
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
*/
// 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),
fBuf(*a_Var),

View File

@ -59,47 +59,48 @@ namespace qmu
virtual void InitConst() override;
virtual void InitOprt() 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:
static int IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand);
static auto IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int;
// hyperbolic functions
static qreal Sinh(qreal);
static qreal Cosh(qreal);
static qreal Tanh(qreal);
static auto Sinh(qreal) -> qreal;
static auto Cosh(qreal) -> qreal;
static auto Tanh(qreal) -> qreal;
// arcus hyperbolic functions
static qreal ASinh(qreal);
static qreal ACosh(qreal);
static qreal ATanh(qreal);
static auto ASinh(qreal) -> qreal;
static auto ACosh(qreal) -> qreal;
static auto ATanh(qreal) -> qreal;
// functions working with degrees
static qreal DegreeToRadian(qreal);
static qreal RadianToDegree(qreal);
static qreal SinD(qreal);
static qreal CosD(qreal);
static qreal TanD(qreal);
static qreal ASinD(qreal);
static qreal ACosD(qreal);
static qreal ATanD(qreal);
static auto DegreeToRadian(qreal) -> qreal;
static auto RadianToDegree(qreal) -> qreal;
static auto SinD(qreal) -> qreal;
static auto CosD(qreal) -> qreal;
static auto TanD(qreal) -> qreal;
static auto ASinD(qreal) -> qreal;
static auto ACosD(qreal) -> qreal;
static auto ATanD(qreal) -> qreal;
// Logarithm functions
static qreal Log2(qreal); // Logarithm Base 2
static qreal Log10(qreal); // Logarithm Base 10
static auto Log2(qreal) -> qreal; // Logarithm Base 2
static auto Log10(qreal) -> qreal; // Logarithm Base 10
// misc
static qreal Abs(qreal);
static qreal Rint(qreal);
static qreal R2CM(qreal);
static qreal CSRCm(qreal length, qreal split, qreal arcLength);
static qreal CSRInch(qreal length, qreal split, qreal arcLength);
static qreal Sign(qreal);
static qreal FMod(qreal, qreal);
static auto Abs(qreal) -> qreal;
static auto Rint(qreal) -> qreal;
static auto R2CM(qreal) -> qreal;
static auto CSRCm(qreal length, qreal split, qreal arcLength) -> qreal;
static auto CSRInch(qreal length, qreal split, qreal arcLength) -> qreal;
static auto Sign(qreal) -> qreal;
static auto FMod(qreal, qreal) -> qreal;
// Prefix operators
// !!! 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
static qreal Sum(const qreal*, qmusizetype); // sum
static qreal Avg(const qreal*, qmusizetype); // mean value
static qreal Min(const qreal*, qmusizetype); // minimum
static qreal Max(const qreal*, qmusizetype); // maximum
static auto Sum(const qreal *, qmusizetype) -> qreal; // sum
static auto Avg(const qreal *, qmusizetype) -> qreal; // mean value
static auto Min(const qreal *, qmusizetype) -> qreal; // minimum
static auto Max(const qreal *, qmusizetype) -> qreal; // maximum
};
QT_WARNING_POP
@ -110,7 +111,7 @@ namespace qmu
* @param v The value to negate
* @return -v
*/
inline qreal QmuParser::UnaryMinus(qreal v)
inline auto QmuParser::UnaryMinus(qreal v) -> qreal
{
return -v;
}

View File

@ -146,7 +146,7 @@ QmuParserBase::~QmuParserBase()
* @return *this
* @throw nothrow
*/
QmuParserBase& QmuParserBase::operator=(const QmuParserBase &a_Parser)
auto QmuParserBase::operator=(const QmuParserBase &a_Parser) -> QmuParserBase &
{
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;
}
@ -261,7 +261,7 @@ void QmuParserBase::setLocale(const QLocale &value)
}
//---------------------------------------------------------------------------------------------------------------------
QChar QmuParserBase::getDecimalPoint() const
auto QmuParserBase::getDecimalPoint() const -> QChar
{
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;
}
@ -285,7 +285,7 @@ void QmuParserBase::setThousandsSeparator(const QChar &c)
}
//---------------------------------------------------------------------------------------------------------------------
bool QmuParserBase::getCNumbers() const
auto QmuParserBase::getCNumbers() const -> bool
{
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.
*/
// cppcheck-suppress unusedFunction
QString QmuParserBase::GetVersion(EParserVersionInfo eInfo)
auto QmuParserBase::GetVersion(EParserVersionInfo eInfo) -> QString
{
QString 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.
* @sa #ValidOprtChars, #ValidPrefixOprtChars
*/
const QString& QmuParserBase::ValidNameChars() const
auto QmuParserBase::ValidNameChars() const -> const QString &
{
assert(m_sNameChars.size());
return m_sNameChars;
@ -475,7 +475,7 @@ const QString& QmuParserBase::ValidNameChars() const
* @brief Virtual function that defines the characters allowed in operator definitions.
* @sa #ValidNameChars, #ValidPrefixOprtChars
*/
const QString &QmuParserBase::ValidOprtChars() const
auto QmuParserBase::ValidOprtChars() const -> const QString &
{
assert(m_sOprtChars.size());
return m_sOprtChars;
@ -486,7 +486,7 @@ const QString &QmuParserBase::ValidOprtChars() const
* @brief Virtual function that defines the characters allowed in infix operator definitions.
* @sa #ValidNameChars, #ValidOprtChars
*/
const QString &QmuParserBase::ValidInfixOprtChars() const
auto QmuParserBase::ValidInfixOprtChars() const -> const QString &
{
assert(m_sInfixOprtChars.size());
return m_sInfixOprtChars;
@ -630,7 +630,7 @@ void QmuParserBase::DefineConst(const QString &a_sName, qreal a_fVal)
* @brief Get operator priority.
* @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())
{
@ -678,7 +678,7 @@ int QmuParserBase::GetOprtPrecedence(const token_type &a_Tok) const
* @brief Get operator priority.
* @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())
{
@ -709,7 +709,7 @@ EOprtAssociativity QmuParserBase::GetOprtAssociativity(const token_type &a_Tok)
/**
* @brief Return a map containing the used variables only.
*/
const varmap_type& QmuParserBase::GetUsedVar() const
auto QmuParserBase::GetUsedVar() const -> const varmap_type &
{
try
{
@ -737,8 +737,8 @@ const varmap_type& QmuParserBase::GetUsedVar() const
* @param a_FunTok Function token.
* @throw QmuParserError If the function token is not a string function
*/
QmuParserBase::token_type QmuParserBase::ApplyStrFunc(const token_type &a_FunTok,
const QVector<token_type> &a_vArg) const
auto QmuParserBase::ApplyStrFunc(const token_type &a_FunTok, const QVector<token_type> &a_vArg) const
-> QmuParserBase::token_type
{
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
* 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);
}
@ -1018,7 +1018,7 @@ qreal QmuParserBase::ParseCmdCode() const
* @param nOffset The offset added to variable addresses (for bulk mode)
* @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);
@ -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
* uses bytecode instead of string parsing.
*/
qreal QmuParserBase::ParseString() const
auto QmuParserBase::ParseString() const -> qreal
{
try
{
@ -1801,7 +1801,7 @@ void QmuParserBase::EnableBuiltInOprt(bool a_bIsOn)
/**
* @brief Get the argument separator character.
*/
QChar QmuParserBase::GetArgSep() const
auto QmuParserBase::GetArgSep() const -> QChar
{
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
* 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)();
nStackSize = m_nFinalResultIdx;

View File

@ -72,20 +72,20 @@ class QMUPARSERSHARED_EXPORT QmuParserBase
public:
QmuParserBase();
explicit QmuParserBase(const QmuParserBase &a_Parser);
QmuParserBase& operator=(const QmuParserBase &a_Parser);
auto operator=(const QmuParserBase &a_Parser) -> QmuParserBase &;
virtual ~QmuParserBase();
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
qreal Eval() const;
qreal* Eval(int &nStackSize) const;
auto Eval() const -> qreal;
auto Eval(int &nStackSize) const -> qreal *;
void Eval(qreal *results, int nBulkSize) const;
int GetNumResults() const;
auto GetNumResults() const -> int;
void SetExpr(const QString &a_sExpr);
void SetVarFactory(facfun_type a_pFactory, void *pUserData = nullptr);
void ResetLocale();
void EnableOptimizer(bool a_bIsOn=true);
void EnableBuiltInOprt(bool a_bIsOn=true);
bool HasBuiltInOprt() const;
auto HasBuiltInOprt() const -> bool;
void AddValIdent(identfun_type a_pCallback);
void DefineOprt(const QString &a_sName, fun_type2 a_pFun, unsigned a_iPrec=0,
EOprtAssociativity a_eAssociativity = oaLEFT, bool a_bAllowOpt = false);
@ -103,23 +103,23 @@ public:
void ClearPostfixOprt();
void ClearOprt();
void RemoveVar(const QString &a_strVarName);
const varmap_type& GetUsedVar() const;
const varmap_type& GetVar() const;
const valmap_type& GetConst() const;
const QString& GetExpr() const;
const funmap_type& GetFunDef() const;
static QString GetVersion(EParserVersionInfo eInfo = pviFULL);
static const QStringList& GetOprtDef();
QMap<qmusizetype, QString> GetTokens() const;
QMap<qmusizetype, QString> GetNumbers() const;
auto GetUsedVar() const -> const varmap_type &;
auto GetVar() const -> const varmap_type &;
auto GetConst() const -> const valmap_type &;
auto GetExpr() const -> const QString &;
auto GetFunDef() const -> const funmap_type &;
static auto GetVersion(EParserVersionInfo eInfo = pviFULL) -> QString;
static auto GetOprtDef() -> const QStringList &;
auto GetTokens() const -> QMap<qmusizetype, QString>;
auto GetNumbers() const -> QMap<qmusizetype, QString>;
void DefineNameChars(const QString &a_szCharset);
void DefineOprtChars(const QString &a_szCharset);
void DefineInfixOprtChars(const QString &a_szCharset);
const QString& ValidNameChars() const;
const QString& ValidOprtChars() const;
const QString& ValidInfixOprtChars() const;
auto ValidNameChars() const -> const QString &;
auto ValidOprtChars() const -> const QString &;
auto ValidInfixOprtChars() const -> const QString &;
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;
template<typename T>
@ -127,16 +127,16 @@ public:
void setAllowSubexpressions(bool value);
QLocale getLocale() const;
auto getLocale() const -> QLocale;
void setLocale(const QLocale &value);
QChar getDecimalPoint() const;
auto getDecimalPoint() const -> QChar;
void setDecimalPoint(const QChar &c);
QChar getThousandsSeparator() const;
auto getThousandsSeparator() const -> QChar;
void setThousandsSeparator(const QChar &c);
bool getCNumbers() const;
auto getCNumbers() const -> bool;
void setCNumbers(bool cNumbers);
protected:
@ -173,17 +173,11 @@ protected:
:std::numpunct<TChar>(), m_nGroup(nGroup), m_cDecPoint(cDecSep), m_cThousandsSep(cThousandsSep)
{}
protected:
virtual char_type do_decimal_point() const override
{
return m_cDecPoint;
}
virtual auto do_decimal_point() const -> char_type override { return m_cDecPoint; }
virtual char_type do_thousands_sep() const override
{
return m_cThousandsSep;
}
virtual auto do_thousands_sep() const -> char_type override { 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
// courtesy of Jens Bartsch
@ -267,13 +261,13 @@ private:
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 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;
int GetOprtPrecedence(const token_type &a_Tok) const;
EOprtAssociativity GetOprtAssociativity(const token_type &a_Tok) const;
auto ApplyStrFunc(const token_type &a_FunTok, const QVector<token_type> &a_vArg) const -> token_type;
auto GetOprtPrecedence(const token_type &a_Tok) const -> int;
auto GetOprtAssociativity(const token_type &a_Tok) const -> EOprtAssociativity;
void CreateRPN() const;
qreal ParseString() const;
qreal ParseCmdCode() const;
qreal ParseCmdCodeBulk(int nOffset, int nThreadID) const;
auto ParseString() const -> qreal;
auto ParseCmdCode() const -> qreal;
auto ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal;
// cppcheck-suppress functionStatic
void CheckName(const QString &a_sName, const QString &a_szCharSet) const;
// 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.
* @sa c_DefaultOprt
*/
inline const QStringList &QmuParserBase::GetOprtDef()
inline auto QmuParserBase::GetOprtDef() -> const QStringList &
{
return c_DefaultOprt;
}
//---------------------------------------------------------------------------------------------------------------------
inline QMap<qmusizetype, QString> QmuParserBase::GetTokens() const
inline auto QmuParserBase::GetTokens() const -> QMap<qmusizetype, QString>
{
return m_Tokens;
}
//---------------------------------------------------------------------------------------------------------------------
inline QMap<qmusizetype, QString> QmuParserBase::GetNumbers() const
inline auto QmuParserBase::GetNumbers() const -> QMap<qmusizetype, QString>
{
return m_Numbers;
}
@ -378,7 +372,7 @@ inline void QmuParserBase::DefineInfixOprtChars(const QString &a_szCharset)
/**
* @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;
}
@ -387,7 +381,7 @@ inline const varmap_type &QmuParserBase::GetVar() const
/**
* @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;
}
@ -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
* 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;
}
@ -412,7 +406,7 @@ inline const funmap_type &QmuParserBase::GetFunDef() const
/**
* @brief Retrieve the formula.
*/
inline const QString& QmuParserBase::GetExpr() const
inline auto QmuParserBase::GetExpr() const -> const QString &
{
return m_pTokenReader->GetExpr();
}
@ -423,7 +417,7 @@ inline const QString& QmuParserBase::GetExpr() const
* @return #m_bBuiltInOp; true if built in operators are enabled.
* @throw nothrow
*/
inline bool QmuParserBase::HasBuiltInOprt() const
inline auto QmuParserBase::HasBuiltInOprt() const -> bool
{
return m_bBuiltInOp;
}
@ -436,7 +430,7 @@ inline bool QmuParserBase::HasBuiltInOprt() const
* value. This function returns the number of available results.
*/
// cppcheck-suppress unusedFunction
inline int QmuParserBase::GetNumResults() const
inline auto QmuParserBase::GetNumResults() const -> int
{
return m_nFinalResultIdx;
}
@ -458,7 +452,7 @@ inline int QmuParserBase::GetNumResults() const
* @return The evaluation result
* @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)();
}

View File

@ -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 )
{
@ -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);
return *this;
@ -230,7 +230,7 @@ QmuParserCallback &QmuParserCallback::operator=(QmuParserCallback &&a_Fun) Q_DEC
* @throw nothrow
*/
// cppcheck-suppress unusedFunction
bool QmuParserCallback::IsOptimizable() const
auto QmuParserCallback::IsOptimizable() const -> bool
{
return d->m_bAllowOpti;
}
@ -244,7 +244,7 @@ bool QmuParserCallback::IsOptimizable() const
* @throw nothrow
* @return #pFun
*/
void* QmuParserCallback::GetAddr() const
auto QmuParserCallback::GetAddr() const -> void *
{
return d->m_pFun;
}
@ -253,13 +253,13 @@ void* QmuParserCallback::GetAddr() const
/**
* @brief Return the callback code.
*/
ECmdCode QmuParserCallback::GetCode() const
auto QmuParserCallback::GetCode() const -> ECmdCode
{
return d->m_iCode;
}
//---------------------------------------------------------------------------------------------------------------------
ETypeCode QmuParserCallback::GetType() const
auto QmuParserCallback::GetType() const -> ETypeCode
{
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).
*/
int QmuParserCallback::GetPri() const
auto QmuParserCallback::GetPri() const -> int
{
return d->m_iPri;
}
@ -283,7 +283,7 @@ int QmuParserCallback::GetPri() const
*
* Only valid if the callback token is a binary operator token.
*/
EOprtAssociativity QmuParserCallback::GetAssociativity() const
auto QmuParserCallback::GetAssociativity() const -> EOprtAssociativity
{
return d->m_eOprtAsct;
}
@ -292,7 +292,7 @@ EOprtAssociativity QmuParserCallback::GetAssociativity() const
/**
* @brief Returns the number of function Arguments.
*/
int QmuParserCallback::GetArgc() const
auto QmuParserCallback::GetArgc() const -> int
{
return d->m_iArgc;
}

View File

@ -84,22 +84,23 @@ public:
QmuParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
QmuParserCallback();
QmuParserCallback(const QmuParserCallback &a_Fun);
QmuParserCallback &operator=(const QmuParserCallback &a_Fun);
auto operator=(const QmuParserCallback &a_Fun) -> QmuParserCallback &;
#ifdef Q_COMPILER_RVALUE_REFS
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
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:
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.
*/
inline QmuParserCallback* QmuParserCallback::Clone() const
inline auto QmuParserCallback::Clone() const -> QmuParserCallback *
{
return new QmuParserCallback ( *this );
}

View File

@ -253,7 +253,7 @@ QmuParserError::QmuParserError ( const QmuParserError &a_Obj )
//---------------------------------------------------------------------------------------------------------------------
/** @brief Assignment operator. */
QmuParserError& QmuParserError::operator= ( const QmuParserError &a_Obj )
auto QmuParserError::operator=(const QmuParserError &a_Obj) -> QmuParserError &
{
if ( this == &a_Obj )
{
@ -296,7 +296,7 @@ Q_NORETURN void QmuParserError::raise() const
* @brief clone clone exception
* @return new exception
*/
QmuParserError *QmuParserError::clone() const
auto QmuParserError::clone() const -> QmuParserError *
{
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 )
{
@ -337,7 +337,7 @@ Q_NORETURN void QmuParserWarning::raise() const
* @brief clone clone exception
* @return new exception
*/
QmuParserWarning *QmuParserWarning::clone() const
auto QmuParserWarning::clone() const -> QmuParserWarning *
{
return new QmuParserWarning(*this);
}

View File

@ -108,8 +108,8 @@ public:
QmuParserErrorMsg();
~QmuParserErrorMsg();
static const QmuParserErrorMsg& Instance();
QString operator[] ( int a_iIdx ) const;
static auto Instance() -> const QmuParserErrorMsg &;
auto operator[](int a_iIdx) const -> QString;
private:
// cppcheck-suppress unknownMacro
@ -120,13 +120,13 @@ private:
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
inline const QmuParserErrorMsg& QmuParserErrorMsg::Instance()
inline auto QmuParserErrorMsg::Instance() -> const QmuParserErrorMsg &
{
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());
}
@ -136,14 +136,15 @@ class QMUPARSERSHARED_EXPORT QmuParserWarning : public QException
public:
explicit QmuParserWarning ( const QString &sMsg );
QmuParserWarning ( const QmuParserWarning &a_Obj );
QmuParserWarning& operator= ( const QmuParserWarning &a_Obj );
auto operator=(const QmuParserWarning &a_Obj) -> QmuParserWarning &;
// cppcheck-suppress unknownMacro
virtual ~QmuParserWarning() QMUP_NOEXCEPT_EXPR (true) override {}
const QString& GetMsg() const;
auto GetMsg() const -> const QString &;
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:
QString m_sMsg; ///< The message string
};
@ -152,7 +153,7 @@ private:
/**
* @brief Returns the message string for this error.
*/
inline const QString& QmuParserWarning::GetMsg() const
inline auto QmuParserWarning::GetMsg() const -> const QString &
{
return m_sMsg;
}
@ -173,17 +174,18 @@ public:
QmuParserError ( EErrorCodes a_iErrc, int a_iPos, const QString &sTok );
QmuParserError ( const QString &szMsg, int iPos, const QString &sTok = QString() );
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 {}
void SetFormula ( const QString &a_strFormula );
const QString& GetExpr() const;
const QString& GetMsg() const;
qmusizetype GetPos() const;
const QString& GetToken() const;
EErrorCodes GetCode() const;
auto GetExpr() const -> const QString &;
auto GetMsg() const -> const QString &;
auto GetPos() const -> qmusizetype;
auto GetToken() const -> const QString &;
auto GetCode() const -> EErrorCodes;
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:
QString m_sMsg; ///< The message 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.
*/
inline const QString& QmuParserError::GetExpr() const
inline auto QmuParserError::GetExpr() const -> const QString &
{
return m_sExpr;
}
@ -216,7 +218,7 @@ inline const QString& QmuParserError::GetExpr() const
/**
* @brief Returns the message string for this error.
*/
inline const QString& QmuParserError::GetMsg() const
inline auto QmuParserError::GetMsg() const -> const QString &
{
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
*/
inline qmusizetype QmuParserError::GetPos() const
inline auto QmuParserError::GetPos() const -> qmusizetype
{
return m_iPos;
}
@ -236,7 +238,7 @@ inline qmusizetype QmuParserError::GetPos() const
/**
* @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;
}
@ -245,7 +247,7 @@ inline const QString& QmuParserError::GetToken() const
/**
* @brief Return the error code.
*/
inline EErrorCodes QmuParserError::GetCode() const
inline auto QmuParserError::GetCode() const -> EErrorCodes
{
return m_iErrc;
}

View File

@ -74,8 +74,8 @@ QmuParserTester::QmuParserTester(QObject *parent)
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::IsHexVal ( const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand )
auto QmuParserTester::IsHexVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int
{
Q_UNUSED(locale)
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;
qWarning() << "testing member functions...";
@ -154,7 +154,7 @@ int QmuParserTester::TestInterface()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestStrArg()
auto QmuParserTester::TestStrArg() -> int
{
int iStat = 0;
qWarning() << "testing string arguments...";
@ -183,7 +183,7 @@ int QmuParserTester::TestStrArg()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestBulkMode()
auto QmuParserTester::TestBulkMode() -> int
{
int iStat = 0;
qWarning() << "testing bulkmode...";
@ -221,7 +221,7 @@ int QmuParserTester::TestBulkMode()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestBinOprt()
auto QmuParserTester::TestBinOprt() -> int
{
int iStat = 0;
qWarning() << "testing binary operators...";
@ -290,7 +290,7 @@ int QmuParserTester::TestBinOprt()
//---------------------------------------------------------------------------------------------------------------------
/** @brief Check muParser name restriction enforcement. */
int QmuParserTester::TestNames()
auto QmuParserTester::TestNames() -> int
{
int iStat = 0,
iErr = 0;
@ -402,7 +402,7 @@ int QmuParserTester::TestNames()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestSyntax()
auto QmuParserTester::TestSyntax() -> int
{
int iStat = 0;
qWarning() << "testing syntax engine...";
@ -455,7 +455,7 @@ int QmuParserTester::TestSyntax()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestVarConst()
auto QmuParserTester::TestVarConst() -> int
{
int iStat = 0;
qWarning() << "testing variable/constant detection...";
@ -588,7 +588,7 @@ int QmuParserTester::TestVarConst()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestMultiArg()
auto QmuParserTester::TestMultiArg() -> int
{
int iStat = 0;
qWarning() << "testing multiarg functions...";
@ -687,7 +687,7 @@ int QmuParserTester::TestMultiArg()
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestInfixOprt()
auto QmuParserTester::TestInfixOprt() -> int
{
int iStat ( 0 );
qWarning() << "testing infix operators...";
@ -756,7 +756,7 @@ int QmuParserTester::TestInfixOprt()
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestPostFix()
auto QmuParserTester::TestPostFix() -> int
{
int iStat = 0;
qWarning() << "testing postfix operators...";
@ -811,7 +811,7 @@ int QmuParserTester::TestPostFix()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestExpression()
auto QmuParserTester::TestExpression() -> int
{
int iStat = 0;
qWarning() << "testing expression samples...";
@ -901,7 +901,7 @@ int QmuParserTester::TestExpression()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestIfThenElse()
auto QmuParserTester::TestIfThenElse() -> int
{
int iStat = 0;
qWarning() << "testing if-then-else operator...";
@ -1011,7 +1011,7 @@ int QmuParserTester::TestIfThenElse()
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::TestException()
auto QmuParserTester::TestException() -> int
{
int iStat = 0;
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++;
@ -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.
*/
int QmuParserTester::EqnTestWithVarChange (const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
double a_fVar2)
auto QmuParserTester::EqnTestWithVarChange(const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
double a_fVar2) -> int
{
QmuParserTester::c_iCount++;
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.
*/
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++;
int iRet ( 0 );
@ -1467,7 +1467,7 @@ QT_WARNING_POP
//---------------------------------------------------------------------------------------------------------------------
/** \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++;
int iRet(0);

View File

@ -76,131 +76,62 @@ private:
void AddTest ( testfun_type a_pFun );
// Test Double Parser
static int EqnTest ( const QString &a_str, double a_fRes, bool a_fPass );
static int EqnTestWithVarChange (const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
double a_fVar2);
static int ThrowTest ( const QString &a_str, int a_iErrc, bool a_bFail = true );
static auto EqnTest(const QString &a_str, double a_fRes, bool a_fPass) -> int;
static auto EqnTestWithVarChange(const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2,
double a_fVar2) -> int;
static auto ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail = true) -> int;
// 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
static qreal f1of1 ( qreal v )
{
return v;
}
static auto f1of1(qreal v) -> qreal { return v; }
static qreal f1of2 ( qreal v, qreal )
{
return v;
}
static auto f1of2(qreal v, qreal) -> qreal { return v; }
static qreal f2of2 ( qreal, qreal v )
{
return v;
}
static auto f2of2(qreal, qreal v) -> qreal { return v; }
static qreal f1of3 ( qreal v, qreal, qreal )
{
return v;
}
static auto f1of3(qreal v, qreal, qreal) -> qreal { return v; }
static qreal f2of3 ( qreal, qreal v, qreal )
{
return v;
}
static auto f2of3(qreal, qreal v, qreal) -> qreal { return v; }
static qreal f3of3 ( qreal, qreal, qreal v )
{
return v;
}
static auto f3of3(qreal, qreal, qreal v) -> qreal { return v; }
static qreal f1of4 ( qreal v, qreal, qreal, qreal )
{
return v;
}
static auto f1of4(qreal v, qreal, qreal, qreal) -> qreal { return v; }
static qreal f2of4 ( qreal, qreal v, qreal, qreal )
{
return v;
}
static auto f2of4(qreal, qreal v, qreal, qreal) -> qreal { return v; }
static qreal f3of4 ( qreal, qreal, qreal v, qreal )
{
return v;
}
static auto f3of4(qreal, qreal, qreal v, qreal) -> qreal { return v; }
static qreal f4of4 ( qreal, qreal, qreal, qreal v )
{
return v;
}
static auto f4of4(qreal, qreal, qreal, qreal v) -> qreal { return v; }
static qreal f1of5 ( qreal v, qreal, qreal, qreal, qreal )
{
return v;
}
static auto f1of5(qreal v, qreal, qreal, qreal, qreal) -> qreal { return v; }
static qreal f2of5 ( qreal, qreal v, qreal, qreal, qreal )
{
return v;
}
static auto f2of5(qreal, qreal v, qreal, qreal, qreal) -> qreal { return v; }
static qreal f3of5 ( qreal, qreal, qreal v, qreal, qreal )
{
return v;
}
static auto f3of5(qreal, qreal, qreal v, qreal, qreal) -> qreal { return v; }
static qreal f4of5 ( qreal, qreal, qreal, qreal v, qreal )
{
return v;
}
static auto f4of5(qreal, qreal, qreal, qreal v, qreal) -> qreal { return v; }
static qreal f5of5 ( qreal, qreal, qreal, qreal, qreal v )
{
return v;
}
static auto f5of5(qreal, qreal, qreal, qreal, qreal v) -> qreal { return v; }
static qreal Min ( qreal a_fVal1, qreal a_fVal2 )
{
return ( a_fVal1 < a_fVal2 ) ? a_fVal1 : a_fVal2;
}
static auto Min(qreal a_fVal1, qreal a_fVal2) -> qreal { return (a_fVal1 < a_fVal2) ? a_fVal1 : a_fVal2; }
static qreal Max ( qreal a_fVal1, qreal a_fVal2 )
{
return ( a_fVal1 > a_fVal2 ) ? a_fVal1 : a_fVal2;
}
static auto Max(qreal a_fVal1, qreal a_fVal2) -> qreal { return (a_fVal1 > a_fVal2) ? a_fVal1 : a_fVal2; }
static qreal plus2 ( qreal v1 )
{
return v1 + 2;
}
static auto plus2(qreal v1) -> qreal { return v1 + 2; }
static qreal times3 ( qreal v1 )
{
return v1 * 3;
}
static auto times3(qreal v1) -> qreal { return v1 * 3; }
static qreal sqr ( qreal v1 )
{
return v1 * v1;
}
static auto sqr(qreal v1) -> qreal { return v1 * v1; }
static qreal sign ( qreal v )
{
return -v;
}
static auto sign(qreal v) -> qreal { return -v; }
static qreal add ( qreal v1, qreal v2 )
{
return v1 + v2;
}
static auto add(qreal v1, qreal v2) -> qreal { return v1 + v2; }
static qreal land ( qreal v1, qreal v2 )
{
return static_cast<int>( v1 ) & static_cast<int>( v2 );
}
static auto land(qreal v1, qreal v2) -> qreal { 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)
{
@ -210,7 +141,7 @@ private:
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)
{
@ -220,7 +151,7 @@ private:
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)
{
@ -235,7 +166,7 @@ private:
return fRes;
}
static qreal Rnd ( qreal v )
static auto Rnd(qreal v) -> qreal
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return static_cast<qreal>( ( 1 + ( v * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
@ -245,7 +176,7 @@ private:
#endif
}
static qreal RndWithString ( const char_type* )
static auto RndWithString(const char_type *) -> qreal
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
return static_cast<qreal>( ( 1 + ( 1000.0f * QRandomGenerator().bounded(static_cast<qreal>(RAND_MAX)) /
@ -255,73 +186,58 @@ private:
#endif
}
static qreal Ping()
{
return 10;
}
static auto Ping() -> qreal { return 10; }
static qreal ValueOf ( const QString & )
{
return 123;
}
static auto ValueOf(const QString &) -> qreal { return 123; }
static qreal StrFun1 ( const QString & v1 )
static auto StrFun1(const QString &v1) -> qreal
{
int val = v1.toInt();
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();
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();
return val + v2 + v3;
}
static qreal StrToFloat ( const QString & a_szMsg )
static auto StrToFloat(const QString &a_szMsg) -> qreal
{
qreal val = a_szMsg.toDouble();
return val;
}
// postfix operator callback
static qreal Mega ( qreal a_fVal )
{
return a_fVal * static_cast<qreal>( 1e6 );
}
static auto Mega(qreal a_fVal) -> qreal { return a_fVal * static_cast<qreal>(1e6); }
static qreal Micro ( qreal a_fVal )
{
return a_fVal * static_cast<qreal>( 1e-6 );
}
static auto Micro(qreal a_fVal) -> qreal { return a_fVal * static_cast<qreal>(1e-6); }
static qreal Milli ( qreal a_fVal )
{
return a_fVal / static_cast<qreal>( 1e3 );
}
static auto Milli(qreal a_fVal) -> qreal { return a_fVal / static_cast<qreal>(1e3); }
// Custom value recognition
static int IsHexVal (const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand);
static auto IsHexVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand) -> int;
int TestNames();
int TestSyntax();
int TestMultiArg();
int TestPostFix();
int TestExpression();
int TestInfixOprt();
int TestBinOprt();
int TestVarConst();
int TestInterface();
int TestException();
int TestStrArg();
int TestIfThenElse();
int TestBulkMode();
auto TestNames() -> int;
auto TestSyntax() -> int;
auto TestMultiArg() -> int;
auto TestPostFix() -> int;
auto TestExpression() -> int;
auto TestInfixOprt() -> int;
auto TestBinOprt() -> int;
auto TestVarConst() -> int;
auto TestInterface() -> int;
auto TestException() -> int;
auto TestStrArg() -> int;
auto TestIfThenElse() -> int;
auto TestBulkMode() -> int;
static void Abort();
};

View File

@ -670,15 +670,12 @@ auto QmuParserTokenReader::IsOprt ( token_type &a_Tok ) -> bool
{
return true;
}
else
{
// nope, no infix operator
return false;
// Error(ecUNEXPECTED_OPERATOR, m_iPos, a_Tok.GetAsString());
}
}
m_iPos += sID.length();
m_iSynFlags = noBC | noOPT | noARG_SEP | noPOSTOP | noEND | noASSIGN;
return true;

View File

@ -90,7 +90,7 @@ QmuTokenParser::QmuTokenParser(const QString &formula, bool osSeparator,
* @param formula expression for test
* @return true if fomula has single number
*/
bool QmuTokenParser::IsSingle(const QString &formula)
auto QmuTokenParser::IsSingle(const QString &formula) -> bool
{
QLocale c(QLocale::C);
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);

View File

@ -42,10 +42,10 @@ public:
const QMap<QString, QString> &translatedFunctions = QMap<QString, QString>());
virtual ~QmuTokenParser() = default;
static bool IsSingle(const QString &formula);
static auto IsSingle(const QString &formula) -> bool;
protected:
static qreal Warning(const QString &warningMsg, qreal value);
static auto Warning(const QString &warningMsg, qreal value) -> qreal;
private:
Q_DISABLE_COPY_MOVE(QmuTokenParser) // NOLINT

View File

@ -30,8 +30,8 @@ namespace qmu
{
//---------------------------------------------------------------------------------------------------------------------
QmuTranslation QmuTranslation::translate(const char *context, const char *sourceText,
const char *disambiguation, int n)
auto QmuTranslation::translate(const char *context, const char *sourceText, const char *disambiguation, int n)
-> QmuTranslation
{
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 )
{
@ -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)
{

View File

@ -56,15 +56,16 @@ public:
~QmuTranslation(){}
QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation = QString(),
int n = -1);
QmuTranslation &operator=(const QmuTranslation &tr);
auto operator=(const QmuTranslation &tr) -> QmuTranslation &;
QmuTranslation(const QmuTranslation &tr);
QString translate(const QString &locale) const;
static QmuTranslation translate(const char * context, const char * sourceText,
const char * disambiguation = nullptr, int n = -1);
QString getMcontext() const;
QString getMsourceText() const;
QString getMdisambiguation() const;
int getN() const;
auto translate(const QString &locale) const -> QString;
static auto translate(const char *context, const char *sourceText, const char *disambiguation = nullptr, int n = -1)
-> QmuTranslation;
auto getMcontext() const -> QString;
auto getMsourceText() const -> QString;
auto getMdisambiguation() const -> QString;
auto getN() const -> int;
private:
QString mcontext;
QString msourceText;
@ -75,25 +76,25 @@ private:
};
//---------------------------------------------------------------------------------------------------------------------
inline QString QmuTranslation::getMcontext() const
inline auto QmuTranslation::getMcontext() const -> QString
{
return mcontext;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString QmuTranslation::getMsourceText() const
inline auto QmuTranslation::getMsourceText() const -> QString
{
return msourceText;
}
//---------------------------------------------------------------------------------------------------------------------
inline QString QmuTranslation::getMdisambiguation() const
inline auto QmuTranslation::getMdisambiguation() const -> QString
{
return mdisambiguation;
}
//---------------------------------------------------------------------------------------------------------------------
inline int QmuTranslation::getN() const
inline auto QmuTranslation::getN() const -> int
{
return mn;
}

View File

@ -34,7 +34,7 @@
const QString endStringPlaceholder = QStringLiteral("%&?_?&%");
//---------------------------------------------------------------------------------------------------------------------
QMap<QString, QString> LocaleMap()
auto LocaleMap() -> QMap<QString, QString>
{
QMap <QString, QString> locMap
{

View File

@ -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
extern const QString endStringPlaceholder;
Q_REQUIRED_RESULT static inline bool DL_FuzzyComparePossibleNulls(double p1, double p2);
static inline bool DL_FuzzyComparePossibleNulls(double p1, double p2)
Q_REQUIRED_RESULT static inline auto DL_FuzzyComparePossibleNulls(double p1, double p2) -> bool;
static inline auto DL_FuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if(qFuzzyIsNull(p1))
{
return qFuzzyIsNull(p2);
}
else if(qFuzzyIsNull(p2))
if (qFuzzyIsNull(p2))
{
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

View File

@ -35,7 +35,7 @@ dx_iface::~dx_iface()
delete dxfW;
}
bool dx_iface::fileExport(bool binary)
auto dx_iface::fileExport(bool binary) -> bool
{
bool success = dxfW->write(this, version, binary);
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();
}
@ -442,7 +442,7 @@ void dx_iface::AddEntity(DRW_Entity *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;
ts.name = f.family().toUpper().toStdString();
@ -480,7 +480,7 @@ void dx_iface::AddBlock(dx_ifaceBlock *block)
cData.blocks.push_back(block);
}
std::string dx_iface::LocaleToISO()
auto dx_iface::LocaleToISO() -> std::string
{
QMap <QString, QString> locMap = LocaleMap();
return locMap.value(QLocale(VAbstractApplication::VApp()->Settings()->GetLocale()).name(),

View File

@ -98,12 +98,12 @@ class dx_iface final : public DRW_Interface
public:
dx_iface(const std::string& file, DRW::Version v, VarMeasurement varMeasurement, VarInsunits varInsunits);
virtual ~dx_iface();
bool fileExport(bool binary);
auto fileExport(bool binary) -> bool;
void writeEntity(DRW_Entity* e);
void AddXSpaceBlock(bool add) {dxfW->AddXSpaceBlock(add);}
std::string ErrorString() const;
auto ErrorString() const -> std::string;
// reimplement virtual DRW_Interface functions
// writer part, send all in class dx_data to writer
@ -122,7 +122,7 @@ public:
virtual void writeAppId() override;
void AddEntity(DRW_Entity* e);
UTF8STRING AddFont(const QFont &f);
auto AddFont(const QFont &f) -> UTF8STRING;
void AddBlock(dx_ifaceBlock* block);
void AddQtLTypes();
@ -143,7 +143,7 @@ private:
void InitVPorts();
void InitAppId();
static std::string LocaleToISO();
static auto LocaleToISO() -> std::string;
};
#endif // DX_IFACE_H

View File

@ -264,14 +264,14 @@ enum TransparencyCodes {
} // namespace DRW
Q_REQUIRED_RESULT static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2);
static inline bool DRW_FuzzyComparePossibleNulls(double p1, double p2)
Q_REQUIRED_RESULT static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool;
static inline auto DRW_FuzzyComparePossibleNulls(double p1, double p2) -> bool
{
if(qFuzzyIsNull(p1))
{
return qFuzzyIsNull(p2);
}
else if(qFuzzyIsNull(p2))
if (qFuzzyIsNull(p2))
{
return false;
}
@ -301,7 +301,7 @@ public:
z(data.z)
{}
DRW_Coord &operator = (const DRW_Coord& data)
auto operator=(const DRW_Coord &data) -> DRW_Coord &
{
if ( &data == this )
{
@ -483,7 +483,7 @@ public:
int code; /*!< dxf code of this value*/
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;
DRW_Coord vdata;
};
@ -527,7 +527,8 @@ public:
widthDefault = 31 /*!< by default (dxf -3) */
};
static int lineWidth2dxfInt(lineWidth lw){
static auto lineWidth2dxfInt(lineWidth lw) -> int
{
switch (lw){
case widthByLayer:
return -1;
@ -589,61 +590,110 @@ public:
return -3;
}
static lineWidth dxfInt2lineWidth(int i){
static auto dxfInt2lineWidth(int i) -> lineWidth
{
if (i<0) {
if (i==-1)
return widthByLayer;
else if (i==-2)
if (i == -2)
return widthByBlock;
else if (i == -3)
return widthDefault;
} else if (i<3) {
}
else if (i < 3)
{
return width00;
} else if (i<7) {
}
else if (i < 7)
{
return width01;
} else if (i<11) {
}
else if (i < 11)
{
return width02;
} else if (i<14) {
}
else if (i < 14)
{
return width03;
} else if (i<16) {
}
else if (i < 16)
{
return width04;
} else if (i<19) {
}
else if (i < 19)
{
return width05;
} else if (i<22) {
}
else if (i < 22)
{
return width06;
} else if (i<27) {
}
else if (i < 27)
{
return width07;
} else if (i<32) {
}
else if (i < 32)
{
return width08;
} else if (i<37) {
}
else if (i < 37)
{
return width09;
} else if (i<45) {
}
else if (i < 45)
{
return width10;
} else if (i<52) {
}
else if (i < 52)
{
return width11;
} else if (i<57) {
}
else if (i < 57)
{
return width12;
} else if (i<65) {
}
else if (i < 65)
{
return width13;
} else if (i<75) {
}
else if (i < 75)
{
return width14;
} else if (i<85) {
}
else if (i < 85)
{
return width15;
} else if (i<95) {
}
else if (i < 95)
{
return width16;
} else if (i<103) {
}
else if (i < 103)
{
return width17;
} else if (i<112) {
}
else if (i < 112)
{
return width18;
} else if (i<130) {
}
else if (i < 130)
{
return width19;
} else if (i<149) {
}
else if (i < 149)
{
return width20;
} else if (i<180) {
}
else if (i < 180)
{
return width21;
} else if (i<205) {
}
else if (i < 205)
{
return width22;
} else {
}
else
{
return width23;
}
//default by default

View File

@ -70,7 +70,8 @@ void DRW_Entity::extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const{
point->z = pz;
}
bool DRW_Entity::parseCode(int code, dxfReader *reader){
auto DRW_Entity::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 5:
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
bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){
auto DRW_Entity::parseDxfGroups(int code, dxfReader *reader) -> bool
{
std::list<DRW_Variant> ls;
DRW_Variant c;
int nc;
@ -198,7 +200,8 @@ bool DRW_Entity::parseDxfGroups(int code, dxfReader *reader){
return true;
}
bool DRW_Point::parseCode(int code, dxfReader *reader){
auto DRW_Point::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 10:
basePoint.x = reader->getDouble();
@ -229,7 +232,7 @@ bool DRW_Point::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_ASTMNotch::parseCode(int code, dxfReader *reader)
auto DRW_ASTMNotch::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 50:
@ -242,7 +245,8 @@ bool DRW_ASTMNotch::parseCode(int code, dxfReader *reader)
return true;
}
bool DRW_Line::parseCode(int code, dxfReader *reader){
auto DRW_Line::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 11:
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) {
case 40:
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) {
case 50:
staangle = reader->getDouble()/ ARAD;
@ -316,7 +322,8 @@ bool DRW_Arc::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Ellipse::parseCode(int code, dxfReader *reader){
auto DRW_Ellipse::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 40:
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) {
case 12:
thirdPoint.x = reader->getDouble();
@ -443,7 +451,8 @@ bool DRW_Trace::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_3Dface::parseCode(int code, dxfReader *reader){
auto DRW_3Dface::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 70:
invisibleflag = reader->getInt32();
@ -455,7 +464,8 @@ bool DRW_3Dface::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Block::parseCode(int code, dxfReader *reader){
auto DRW_Block::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 2:
name = reader->getUtf8String();
@ -470,7 +480,8 @@ bool DRW_Block::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Insert::parseCode(int code, dxfReader *reader){
auto DRW_Insert::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 2:
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) {
case 10: {
vertex = new DRW_Vertex2D();
@ -575,7 +587,8 @@ bool DRW_LWPolyline::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Text::parseCode(int code, dxfReader *reader){
auto DRW_Text::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 40:
height = reader->getDouble();
@ -611,7 +624,8 @@ bool DRW_Text::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_MText::parseCode(int code, dxfReader *reader){
auto DRW_MText::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 1:
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) {
case 70:
flags = reader->getInt32();
@ -730,7 +745,8 @@ bool DRW_Polyline::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Vertex::parseCode(int code, dxfReader *reader){
auto DRW_Vertex::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 70:
flags = reader->getInt32();
@ -769,7 +785,8 @@ bool DRW_Vertex::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Hatch::parseCode(int code, dxfReader *reader){
auto DRW_Hatch::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 2:
name = reader->getUtf8String();
@ -876,7 +893,8 @@ bool DRW_Hatch::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Spline::parseCode(int code, dxfReader *reader){
auto DRW_Spline::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 210:
normalVec.x = reader->getDouble();
@ -968,7 +986,8 @@ bool DRW_Spline::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Image::parseCode(int code, dxfReader *reader){
auto DRW_Image::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 12:
vVector.x = reader->getDouble();
@ -1007,7 +1026,8 @@ bool DRW_Image::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Dimension::parseCode(int code, dxfReader *reader){
auto DRW_Dimension::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 1:
text = reader->getUtf8String();
@ -1128,7 +1148,8 @@ bool DRW_Dimension::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Leader::parseCode(int code, dxfReader *reader){
auto DRW_Leader::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 3:
style = reader->getUtf8String();
@ -1219,7 +1240,8 @@ bool DRW_Leader::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_Viewport::parseCode(int code, dxfReader *reader){
auto DRW_Viewport::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 40:
pswidth = reader->getDouble();

View File

@ -185,14 +185,14 @@ public:
protected:
//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)
void calculateAxis(DRW_Coord extPoint);
//apply extrusion to @extPoint and return data in @point
void extrudePoint(DRW_Coord extPoint, DRW_Coord *point) const;
//parses dxf 102 groups to read entity
bool parseDxfGroups(int code, dxfReader *reader);
auto parseDxfGroups(int code, dxfReader *reader) -> bool;
public:
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*/
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 extAxisY;
DRW_Variant* curr;
@ -241,7 +241,7 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
DRW_Coord basePoint{}; /*!< base point, code 10, 20 & 30 */
@ -284,7 +284,7 @@ public:
void applyExtrusion() override{}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
@ -332,7 +332,7 @@ public:
void applyExtrusion() override;
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
double radious; /*!< radius, code 40 */
@ -357,21 +357,21 @@ public:
void applyExtrusion() override;
//! center point in OCS
const DRW_Coord & center() const { return basePoint; }
auto center() const -> const DRW_Coord & { return basePoint; }
//! the radius of the circle
double radius() const { return radious; }
auto radius() const -> double { return radious; }
//! start angle in radians
double startAngle() const { return staangle; }
auto startAngle() const -> double { return staangle; }
//! end angle in radians
double endAngle() const { return endangle; }
auto endAngle() const -> double { return endangle; }
//! thickness
double thick() const { return thickness; }
auto thick() const -> double { return thickness; }
//! extrusion
const DRW_Coord & extrusion() const { return extPoint; }
auto extrusion() const -> const DRW_Coord & { return extPoint; }
protected:
//! 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:
double staangle; /*!< start angle, code 50 in radians*/
@ -403,7 +403,7 @@ public:
protected:
//! 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:
void correctAxis();
@ -433,7 +433,7 @@ public:
void applyExtrusion() override;
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
@ -454,20 +454,19 @@ public:
public:
//! first corner (2D)
const DRW_Coord & firstCorner() const { return basePoint; }
auto firstCorner() const -> const DRW_Coord & { return basePoint; }
//! second corner (2D)
const DRW_Coord & secondCorner() const { return secPoint; }
auto secondCorner() const -> const DRW_Coord & { return secPoint; }
//! third corner (2D)
const DRW_Coord & thirdCorner() const { return thirdPoint; }
auto thirdCorner() const -> const DRW_Coord & { return thirdPoint; }
//! fourth corner (2D)
const DRW_Coord & fourthCorner() const { return thirdPoint; }
auto fourthCorner() const -> const DRW_Coord & { return thirdPoint; }
//! thickness
double thick() const { return thickness; }
auto thick() const -> double { return thickness; }
//! elevation
double elevation() const { return basePoint.z; }
auto elevation() const -> double { return basePoint.z; }
//! extrusion
const DRW_Coord & extrusion() const { return extPoint; }
auto extrusion() const -> const DRW_Coord & { return extPoint; }
};
//! Class to handle 3dface entity
@ -496,19 +495,19 @@ public:
void applyExtrusion() override {}
//! first corner in WCS
const DRW_Coord & firstCorner() const { return basePoint; }
auto firstCorner() const -> const DRW_Coord & { return basePoint; }
//! second corner in WCS
const DRW_Coord & secondCorner() const { return secPoint; }
auto secondCorner() const -> const DRW_Coord & { return secPoint; }
//! third corner in WCS
const DRW_Coord & thirdCorner() const { return thirdPoint; }
auto thirdCorner() const -> const DRW_Coord & { return thirdPoint; }
//! fourth corner in WCS
const DRW_Coord & fourthCorner() const { return fourPoint; }
auto fourthCorner() const -> const DRW_Coord & { return fourPoint; }
//! edge visibility flags
InvisibleEdgeFlags edgeFlags() const { return static_cast<InvisibleEdgeFlags>(invisibleflag); }
auto edgeFlags() const -> InvisibleEdgeFlags { return static_cast<InvisibleEdgeFlags>(invisibleflag); }
protected:
//! 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:
int invisibleflag; /*!< invisible edge flag, code 70 */
@ -534,7 +533,7 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
UTF8STRING name; /*!< block name, code 2 */
@ -565,7 +564,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
UTF8STRING name; /*!< block name, code 2 */
@ -629,7 +628,8 @@ public:
vert->bulge = v.bulge;
vertlist.push_back(vert);
}
DRW_Vertex2D *addVertex () {
auto addVertex() -> DRW_Vertex2D *
{
DRW_Vertex2D *vert = new DRW_Vertex2D();
vert->stawidth = 0;
vert->endwidth = 0;
@ -639,7 +639,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
int vertexnum; /*!< number of vertex, code 90 */
@ -651,7 +651,7 @@ public:
DRW_Vertex2D *vertex; /*!< current vertex to add data */
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
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
@ -697,7 +697,7 @@ public:
void applyExtrusion() override {} //RLZ TODO
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
double height; /*!< height text, code 40 */
@ -742,7 +742,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
void updateAngle(); //recalculate angle if 'haveXAxis' is true
public:
@ -792,7 +792,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
double stawidth; /*!< Start width, code 40 */
@ -871,7 +871,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
int flags; /*!< polyline flag, code 70, default 0 */
@ -886,7 +886,7 @@ public:
std::vector<DRW_Vertex *> vertlist; /*!< vertex list */
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+
duint32 firstEH; //handle of first entity, only in pre-2004
duint32 lastEH; //handle of last entity, only in pre-2004
@ -960,7 +960,7 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
// 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 */
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 *fitpoint; /*!< current fit point to add data */
};
@ -1072,7 +1072,7 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
UTF8STRING name; /*!< hatch pattern name, code 2 */
@ -1167,7 +1167,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
duint32 ref; /*!< Hard reference to imagedef object, code 340 */
@ -1254,56 +1254,68 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
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;}
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;}
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;}
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;}
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;}
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;}
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;}
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;}
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;}
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;}
// 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; }
double getActualMeasurement() const { return actual; }
auto getActualMeasurement() const -> double { return actual; }
protected:
DRW_Coord getPt2() const {return clonePoint;}
auto getPt2() const -> DRW_Coord { return clonePoint; }
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;}
DRW_Coord getPt4() const {return def2;}
auto getPt4() const -> DRW_Coord { return def2; }
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;}
DRW_Coord getPt6() const {return arcPoint;}
auto getPt6() const -> DRW_Coord { return arcPoint; }
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;}
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;}
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;}
public:
int type; /*!< Dimension type, code 70 */
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 */
DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
@ -1348,14 +1360,17 @@ public:
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);}
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);}
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);}
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);}
};
@ -1377,9 +1392,12 @@ public:
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);}
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);}
};
@ -1401,11 +1419,14 @@ public:
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);}
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);}
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);}
};
@ -1428,11 +1449,17 @@ public:
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);}
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);}
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);}
};
@ -1454,15 +1481,18 @@ public:
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);}
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);}
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);}
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);}
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);}
};
@ -1485,13 +1515,13 @@ public:
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);}
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);}
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);}
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);}
};
@ -1514,11 +1544,11 @@ public:
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);}
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);}
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);}
};
@ -1560,7 +1590,7 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
UTF8STRING style; /*!< Dimension style name, code 3 */
@ -1621,7 +1651,7 @@ public:
void applyExtrusion() override {}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
double pswidth; /*!< Width in paper space units, code 40 */

View File

@ -39,7 +39,8 @@ void DRW_Header::addComment(const std::string &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) {
DRW_DBG("invalid header code: ");
DRW_DBG(code);
@ -1705,7 +1706,7 @@ void DRW_Header::addCoord(std::string key, const DRW_Coord &value, int code){
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;
auto it=vars.find( key);
@ -1721,7 +1722,7 @@ bool DRW_Header::getDouble(const std::string &key, double *varDouble) const
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;
auto it=vars.find( key);
@ -1737,7 +1738,8 @@ bool DRW_Header::getInt(const std::string &key, int *varInt) const
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;
auto it=vars.find( key);
if (it != vars.end()) {
@ -1750,7 +1752,7 @@ bool DRW_Header::getStr(const std::string &key, std::string *varStr) const{
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;
auto it=vars.find( key);
@ -1766,7 +1768,8 @@ bool DRW_Header::getCoord(const std::string &key, DRW_Coord *varCoord) const
return result;
}
int DRW_Header::measurement(const int unit) {
auto DRW_Header::measurement(const int unit) -> int
{
switch (unit) {
case Units::Inch:
case Units::Foot:

View File

@ -91,7 +91,7 @@ public:
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)
{
@ -110,17 +110,18 @@ public:
void addInt(std::string key, int 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);
std::string getComments() const {return comments;}
auto getComments() const -> std::string { return comments; }
void write(dxfWriter *writer, DRW::Version ver);
void addComment(const std::string &c);
protected:
bool parseCode(int code, dxfReader *reader);
auto parseCode(int code, dxfReader *reader) -> bool;
private:
bool getDouble(const std::string &key, double *varDouble) const;
bool getInt(const std::string &key, int *varInt) const;
bool getStr(const std::string &key, std::string *varStr) const;
bool getCoord(const std::string &key, DRW_Coord *varCoord) const;
auto getDouble(const std::string &key, double *varDouble) const -> bool;
auto getInt(const std::string &key, int *varInt) const -> bool;
auto getStr(const std::string &key, std::string *varStr) const -> bool;
auto getCoord(const std::string &key, DRW_Coord *varCoord) const -> bool;
void clearVars()
{
for (auto it=vars.begin(); it!=vars.end(); ++it)
@ -150,7 +151,7 @@ private:
duint32 vportCtrl;
duint32 vpEntHeaderCtrl;
int measurement(const int unit);
auto measurement(const int unit) -> int;
};
#endif

View File

@ -24,7 +24,8 @@
* Base class for tables entries
* @author Rallaz
*/
bool DRW_TableEntry::parseCode(int code, dxfReader *reader){
auto DRW_TableEntry::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 5:
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
* @author Rallaz
*/
bool DRW_Dimstyle::parseCode(int code, dxfReader *reader){
auto DRW_Dimstyle::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 105:
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
* @author Rallaz
*/
bool DRW_LType::parseCode(int code, dxfReader *reader){
auto DRW_LType::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 3:
desc = reader->getUtf8String();
@ -385,7 +388,8 @@ void DRW_LType::update(){
* Class to handle layer symbol table entries
* @author Rallaz
*/
bool DRW_Layer::parseCode(int code, dxfReader *reader){
auto DRW_Layer::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 6:
lineType = reader->getUtf8String();
@ -420,7 +424,8 @@ bool DRW_Layer::parseCode(int code, dxfReader *reader){
* Class to handle text style symbol table entries
* @author Rallaz
*/
bool DRW_Textstyle::parseCode(int code, dxfReader *reader){
auto DRW_Textstyle::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 3:
font = reader->getUtf8String();
@ -458,7 +463,8 @@ bool DRW_Textstyle::parseCode(int code, dxfReader *reader){
* Class to handle vport symbol table entries
* @author Rallaz
*/
bool DRW_Vport::parseCode(int code, dxfReader *reader){
auto DRW_Vport::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 10:
lowerLeft.x = reader->getDouble();
@ -566,7 +572,8 @@ bool DRW_Vport::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_ImageDef::parseCode(int code, dxfReader *reader){
auto DRW_ImageDef::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 1:
fileName = reader->getUtf8String();
@ -602,7 +609,8 @@ bool DRW_ImageDef::parseCode(int code, dxfReader *reader){
return true;
}
bool DRW_PlotSettings::parseCode(int code, dxfReader *reader){
auto DRW_PlotSettings::parseCode(int code, dxfReader *reader) -> bool
{
switch (code) {
case 5:
handle = static_cast<duint32>(reader->getHandleString());

View File

@ -91,7 +91,7 @@ public:
}
protected:
virtual bool parseCode(int code, dxfReader *reader);
virtual auto parseCode(int code, dxfReader *reader) -> bool;
void reset()
{
flags = 0;
@ -112,7 +112,7 @@ public:
std::vector<DRW_Variant*> extData{}; /*!< FIFO list of extended data, codes 1000 to 1071*/
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};
};
@ -227,7 +227,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
//V12
@ -330,7 +330,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
void update();
public:
@ -374,7 +374,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
UTF8STRING lineType; /*!< line type, code 6 */
@ -442,7 +442,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
double height; /*!< Fixed text height (0 not set), code 40 */
@ -511,7 +511,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
DRW_Coord lowerLeft; /*!< Lower left corner, code 10 & 20 */
@ -576,7 +576,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
// std::string handle; /*!< entity identifier, code 5 */
@ -614,7 +614,7 @@ public:
}
protected:
bool parseCode(int code, dxfReader *reader) override;
auto parseCode(int code, dxfReader *reader) -> bool override;
public:
UTF8STRING plotViewName {}; /*!< Plot view name, code 6 */
@ -641,7 +641,7 @@ public:
}
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 {

View File

@ -35,7 +35,8 @@ private:
};
/********* debug class *************/
DRW_dbg *DRW_dbg::getInstance(){
auto DRW_dbg::getInstance() -> DRW_dbg *
{
if (instance == nullptr){
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;
}

View File

@ -43,8 +43,8 @@ public:
* is required.
*/
void setCustomDebugPrinter(std::unique_ptr<DRW::DebugPrinter> printer);
Level getLevel() const;
static DRW_dbg *getInstance();
auto getLevel() const -> Level;
static auto getInstance() -> DRW_dbg *;
void print(const std::string &s);
void print(signed char i);
void print(unsigned char i);

View File

@ -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>
{
@ -148,7 +148,7 @@ QMap<QString, QStringList> DRW_TextCodec::DXFCodePageMap()
return map;
}
VTextCodec *DRW_TextCodec::CodecForName(const QString &name)
auto DRW_TextCodec::CodecForName(const QString &name) -> VTextCodec *
{
QMap<QString, QStringList> knownCodecs = DXFCodePageMap();
if (knownCodecs.contains(name))
@ -166,7 +166,8 @@ VTextCodec *DRW_TextCodec::CodecForName(const QString &name)
return nullptr;
}
std::string DRW_TextCodec::toUtf8(const std::string &s) {
auto DRW_TextCodec::toUtf8(const std::string &s) -> std::string
{
if (conv == nullptr)
{
return s;
@ -176,7 +177,8 @@ std::string DRW_TextCodec::toUtf8(const std::string &s) {
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)
{
return s;

View File

@ -21,16 +21,16 @@ class DRW_TextCodec
{
public:
DRW_TextCodec();
std::string fromUtf8(const std::string &s);
std::string toUtf8(const std::string &s);
int getVersion() const {return version;}
auto fromUtf8(const std::string &s) -> std::string;
auto toUtf8(const std::string &s) -> std::string;
auto getVersion() const -> int { return version; }
void setVersion(const std::string &v, bool dxfFormat);
void setVersion(DRW::Version v, 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 VTextCodec* CodecForName(const QString &name);
static auto DXFCodePageMap() -> QMap<QString, QStringList>;
static auto CodecForName(const QString &name) -> VTextCodec *;
private:
static auto correctCodePage(const std::string& s) -> std::string;

View File

@ -18,7 +18,8 @@
#include "drw_textcodec.h"
#include "drw_dbg.h"
bool dxfReader::readRec(int *codeData) {
auto dxfReader::readRec(int *codeData) -> bool
{
// std::string text;
int code;
@ -97,7 +98,8 @@ bool dxfReader::readRec(int *codeData) {
return (filestr->good());
}
int dxfReader::getHandleString(){
auto dxfReader::getHandleString() -> int
{
int res;
#if defined(__APPLE__)
// cppcheck-suppress invalidScanfArgType_int
@ -112,7 +114,8 @@ int dxfReader::getHandleString(){
return res;
}
bool dxfReaderBinary::readCode(int *code) {
auto dxfReaderBinary::readCode(int *code) -> bool
{
unsigned short *int16p;
char buffer[2];
filestr->read(buffer,2);
@ -130,21 +133,24 @@ bool dxfReaderBinary::readCode(int *code) {
return (filestr->good());
}
bool dxfReaderBinary::readString() {
auto dxfReaderBinary::readString() -> bool
{
type = STRING;
std::getline(*filestr, strData, '\0');
DRW_DBG(strData); DRW_DBG("\n");
return (filestr->good());
}
bool dxfReaderBinary::readString(std::string *text) {
auto dxfReaderBinary::readString(std::string *text) -> bool
{
type = STRING;
std::getline(*filestr, *text, '\0');
DRW_DBG(*text); DRW_DBG("\n");
return (filestr->good());
}
bool dxfReaderBinary::readBinary() {
auto dxfReaderBinary::readBinary() -> bool
{
unsigned char chunklen {0};
filestr->read( reinterpret_cast<char *>(&chunklen), 1);
@ -154,7 +160,8 @@ bool dxfReaderBinary::readBinary() {
return (filestr->good());
}
bool dxfReaderBinary::readInt16() {
auto dxfReaderBinary::readInt16() -> bool
{
type = INT32;
char buffer[2];
filestr->read(buffer,2);
@ -163,7 +170,8 @@ bool dxfReaderBinary::readInt16() {
return (filestr->good());
}
bool dxfReaderBinary::readInt32() {
auto dxfReaderBinary::readInt32() -> bool
{
type = INT32;
unsigned int *int32p;
char buffer[4];
@ -175,7 +183,8 @@ bool dxfReaderBinary::readInt32() {
return (filestr->good());
}
bool dxfReaderBinary::readInt64() {
auto dxfReaderBinary::readInt64() -> bool
{
type = INT64;
unsigned long long int *int64p; //64 bits integer pointer
char buffer[8];
@ -187,7 +196,8 @@ bool dxfReaderBinary::readInt64() {
return (filestr->good());
}
bool dxfReaderBinary::readDouble() {
auto dxfReaderBinary::readDouble() -> bool
{
type = DOUBLE;
double *result;
char buffer[8];
@ -201,7 +211,8 @@ bool dxfReaderBinary::readDouble() {
}
//saved as int or add a bool member??
bool dxfReaderBinary::readBool() {
auto dxfReaderBinary::readBool() -> bool
{
char buffer[1];
filestr->read(buffer,1);
intData = static_cast<int>(buffer[0]);
@ -209,14 +220,16 @@ bool dxfReaderBinary::readBool() {
return (filestr->good());
}
bool dxfReaderAscii::readCode(int *code) {
auto dxfReaderAscii::readCode(int *code) -> bool
{
std::string text;
std::getline(*filestr, text);
*code = atoi(text.c_str());
DRW_DBG(*code); DRW_DBG("\n");
return (filestr->good());
}
bool dxfReaderAscii::readString(std::string *text) {
auto dxfReaderAscii::readString(std::string *text) -> bool
{
type = STRING;
std::getline(*filestr, *text);
if (!text->empty() && text->at(text->size()-1) == '\r')
@ -224,7 +237,8 @@ bool dxfReaderAscii::readString(std::string *text) {
return (filestr->good());
}
bool dxfReaderAscii::readString() {
auto dxfReaderAscii::readString() -> bool
{
type = STRING;
std::getline(*filestr, strData);
if (!strData.empty() && strData.at(strData.size()-1) == '\r')
@ -233,11 +247,13 @@ bool dxfReaderAscii::readString() {
return (filestr->good());
}
bool dxfReaderAscii::readBinary() {
auto dxfReaderAscii::readBinary() -> bool
{
return readString();
}
bool dxfReaderAscii::readInt16() {
auto dxfReaderAscii::readInt16() -> bool
{
type = INT32;
std::string text;
if (readString(&text)){
@ -248,17 +264,20 @@ bool dxfReaderAscii::readInt16() {
return false;
}
bool dxfReaderAscii::readInt32() {
auto dxfReaderAscii::readInt32() -> bool
{
type = INT32;
return readInt16();
}
bool dxfReaderAscii::readInt64() {
auto dxfReaderAscii::readInt64() -> bool
{
type = INT64;
return readInt16();
}
bool dxfReaderAscii::readDouble() {
auto dxfReaderAscii::readDouble() -> bool
{
type = DOUBLE;
std::string text;
if (readString(&text)){
@ -280,7 +299,8 @@ bool dxfReaderAscii::readDouble() {
}
//saved as int or add a bool member??
bool dxfReaderAscii::readBool() {
auto dxfReaderAscii::readBool() -> bool
{
type = BOOL;
std::string text;
if (readString(&text)){

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