Refactoring.
Code style.
This commit is contained in:
parent
ccdabec868
commit
d1cbb61238
|
@ -27,10 +27,10 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vpdialogabout.h"
|
#include "vpdialogabout.h"
|
||||||
#include "ui_vpdialogabout.h"
|
|
||||||
#include "../vmisc/projectversion.h"
|
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include "../fervor/fvupdater.h"
|
#include "../fervor/fvupdater.h"
|
||||||
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vmisc/projectversion.h"
|
||||||
|
#include "ui_vpdialogabout.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
@ -55,7 +55,8 @@ VPDialogAbout::VPDialogAbout(QWidget *parent)
|
||||||
// mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
// mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
|
||||||
RetranslateUi();
|
RetranslateUi();
|
||||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, []()
|
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this,
|
||||||
|
[]()
|
||||||
{
|
{
|
||||||
if (not QDesktopServices::openUrl(QUrl(QStringLiteral(VER_COMPANYDOMAIN_STR))))
|
if (not QDesktopServices::openUrl(QUrl(QStringLiteral(VER_COMPANYDOMAIN_STR))))
|
||||||
{
|
{
|
||||||
|
@ -63,7 +64,8 @@ VPDialogAbout::VPDialogAbout(QWidget *parent)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &VPDialogAbout::close);
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &VPDialogAbout::close);
|
||||||
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []()
|
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked,
|
||||||
|
[]()
|
||||||
{
|
{
|
||||||
// Set feed URL before doing anything else
|
// Set feed URL before doing anything else
|
||||||
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
||||||
|
|
|
@ -65,8 +65,6 @@ auto main(int argc, char *argv[]) -> int
|
||||||
Q_INIT_RESOURCE(win_theme); // NOLINT
|
Q_INIT_RESOURCE(win_theme); // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
VAbstractApplication::WinAttachConsole();
|
VAbstractApplication::WinAttachConsole();
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,6 +90,8 @@ auto main(int argc, char *argv[]) -> int
|
||||||
VPApplication app(argc, argv);
|
VPApplication app(argc, argv);
|
||||||
app.InitOptions();
|
app.InitOptions();
|
||||||
|
|
||||||
|
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
VPApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.puzzle.desktop"));
|
VPApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.puzzle.desktop"));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "dialogabouttape.h"
|
#include "dialogabouttape.h"
|
||||||
#include "ui_dialogabouttape.h"
|
#include "../fervor/fvupdater.h"
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vmisc/projectversion.h"
|
#include "../vmisc/projectversion.h"
|
||||||
#include "../fervor/fvupdater.h"
|
#include "ui_dialogabouttape.h"
|
||||||
|
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
@ -55,7 +55,8 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
|
||||||
// mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
// mApp->Settings()->GetOsSeparator() ? setLocale(QLocale()) : setLocale(QLocale::c());
|
||||||
|
|
||||||
RetranslateUi();
|
RetranslateUi();
|
||||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, []()
|
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this,
|
||||||
|
[]()
|
||||||
{
|
{
|
||||||
if (not QDesktopServices::openUrl(
|
if (not QDesktopServices::openUrl(
|
||||||
QUrl(QStringLiteral("https://%1").arg(QStringLiteral(VER_COMPANYDOMAIN_STR)))))
|
QUrl(QStringLiteral("https://%1").arg(QStringLiteral(VER_COMPANYDOMAIN_STR)))))
|
||||||
|
@ -64,7 +65,8 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
|
||||||
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []()
|
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked,
|
||||||
|
[]()
|
||||||
{
|
{
|
||||||
// Set feed URL before doing anything else
|
// Set feed URL before doing anything else
|
||||||
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
||||||
|
|
|
@ -63,8 +63,6 @@ auto main(int argc, char *argv[]) -> int
|
||||||
Q_INIT_RESOURCE(win_theme); // NOLINT
|
Q_INIT_RESOURCE(win_theme); // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
VAbstractApplication::WinAttachConsole();
|
VAbstractApplication::WinAttachConsole();
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,6 +88,8 @@ auto main(int argc, char *argv[]) -> int
|
||||||
MApplication app(argc, argv);
|
MApplication app(argc, argv);
|
||||||
app.InitOptions();
|
app.InitOptions();
|
||||||
|
|
||||||
|
QT_REQUIRE_VERSION(argc, argv, "5.4.0") // clazy:exclude=qstring-arg,qstring-allocations NOLINT
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
MApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.tape.desktop"));
|
MApplication::setDesktopFileName(QStringLiteral("ua.com.smart-pattern.tape.desktop"));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,15 +27,15 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "dialogaboutapp.h"
|
#include "dialogaboutapp.h"
|
||||||
|
#include "../fervor/fvupdater.h"
|
||||||
|
#include "../vmisc/projectversion.h"
|
||||||
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
#include "ui_dialogaboutapp.h"
|
#include "ui_dialogaboutapp.h"
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include "../fervor/fvupdater.h"
|
|
||||||
#include "../vmisc/projectversion.h"
|
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
|
||||||
|
|
||||||
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
#if !defined(BUILD_REVISION) && defined(QBS_BUILD)
|
||||||
#include <vcsRepoState.h>
|
#include <vcsRepoState.h>
|
||||||
|
@ -43,8 +43,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
DialogAboutApp::DialogAboutApp(QWidget *parent)
|
||||||
QDialog(parent),
|
: QDialog(parent),
|
||||||
ui(new Ui::DialogAboutApp)
|
ui(new Ui::DialogAboutApp)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -64,9 +64,9 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
"KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY "
|
"KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY "
|
||||||
"AND FITNESS FOR A PARTICULAR PURPOSE."));
|
"AND FITNESS FOR A PARTICULAR PURPOSE."));
|
||||||
|
|
||||||
|
|
||||||
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(QStringLiteral(VER_COMPANYDOMAIN_STR)));
|
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(QStringLiteral(VER_COMPANYDOMAIN_STR)));
|
||||||
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this, []()
|
connect(ui->pushButton_Web_Site, &QPushButton::clicked, this,
|
||||||
|
[]()
|
||||||
{
|
{
|
||||||
if (not QDesktopServices::openUrl(
|
if (not QDesktopServices::openUrl(
|
||||||
QUrl(QStringLiteral("https://%1").arg(QStringLiteral(VER_COMPANYDOMAIN_STR)))))
|
QUrl(QStringLiteral("https://%1").arg(QStringLiteral(VER_COMPANYDOMAIN_STR)))))
|
||||||
|
@ -75,7 +75,8 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []()
|
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked,
|
||||||
|
[]()
|
||||||
{
|
{
|
||||||
// Set feed URL before doing anything else
|
// Set feed URL before doing anything else
|
||||||
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
FvUpdater::sharedUpdater()->SetFeedURL(FvUpdater::CurrentFeedURL());
|
||||||
|
|
|
@ -27,17 +27,17 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "dialoglayoutsettings.h"
|
#include "dialoglayoutsettings.h"
|
||||||
#include "ui_dialoglayoutsettings.h"
|
|
||||||
#include "../vmisc/vvalentinasettings.h"
|
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
|
#include "../vmisc/vvalentinasettings.h"
|
||||||
|
#include "ui_dialoglayoutsettings.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 7, 0)
|
||||||
#include "../vlayout/vlayoutgenerator.h"
|
#include "../vlayout/vlayoutgenerator.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPushButton>
|
|
||||||
#include <QPrinterInfo>
|
#include <QPrinterInfo>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
|
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent, bool disableSettings)
|
||||||
|
@ -73,35 +73,35 @@ DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget
|
||||||
RestoreDefaults();
|
RestoreDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui->comboBoxPrinter, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxPrinter, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogLayoutSettings::PrinterMargins);
|
&DialogLayoutSettings::PrinterMargins);
|
||||||
|
|
||||||
connect(ui->comboBoxTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxTemplates, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogLayoutSettings::TemplateSelected);
|
&DialogLayoutSettings::TemplateSelected);
|
||||||
connect(ui->comboBoxPaperSizeUnit, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxPaperSizeUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogLayoutSettings::ConvertPaperSize);
|
&DialogLayoutSettings::ConvertPaperSize);
|
||||||
|
|
||||||
connect(ui->doubleSpinBoxPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||||
this, &DialogLayoutSettings::PaperSizeChanged);
|
&DialogLayoutSettings::PaperSizeChanged);
|
||||||
connect(ui->doubleSpinBoxPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||||
this, &DialogLayoutSettings::PaperSizeChanged);
|
&DialogLayoutSettings::PaperSizeChanged);
|
||||||
|
|
||||||
connect(ui->doubleSpinBoxPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||||
this, &DialogLayoutSettings::FindTemplate);
|
&DialogLayoutSettings::FindTemplate);
|
||||||
connect(ui->doubleSpinBoxPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||||
this, &DialogLayoutSettings::FindTemplate);
|
&DialogLayoutSettings::FindTemplate);
|
||||||
|
|
||||||
connect(ui->doubleSpinBoxPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxPaperWidth, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||||
this, &DialogLayoutSettings::CorrectMaxFileds);
|
&DialogLayoutSettings::CorrectMaxFileds);
|
||||||
connect(ui->doubleSpinBoxPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
connect(ui->doubleSpinBoxPaperHeight, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this,
|
||||||
this, &DialogLayoutSettings::CorrectMaxFileds);
|
&DialogLayoutSettings::CorrectMaxFileds);
|
||||||
|
|
||||||
connect(ui->checkBoxIgnoreFileds, &QCheckBox::stateChanged, this, &DialogLayoutSettings::IgnoreAllFields);
|
connect(ui->checkBoxIgnoreFileds, &QCheckBox::stateChanged, this, &DialogLayoutSettings::IgnoreAllFields);
|
||||||
|
|
||||||
connect(ui->toolButtonPortrait, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
connect(ui->toolButtonPortrait, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
||||||
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
||||||
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxLayoutUnit, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
this, &DialogLayoutSettings::ConvertLayoutSize);
|
&DialogLayoutSettings::ConvertLayoutSize);
|
||||||
|
|
||||||
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
connect(bOk, &QPushButton::clicked, this, &DialogLayoutSettings::DialogAccepted);
|
connect(bOk, &QPushButton::clicked, this, &DialogLayoutSettings::DialogAccepted);
|
||||||
|
@ -762,8 +762,8 @@ void DialogLayoutSettings::InitPaperUnits()
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
m_oldPaperUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
m_oldPaperUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
const qint32 indexUnit = ui->comboBoxPaperSizeUnit->findData(
|
const qint32 indexUnit =
|
||||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
ui->comboBoxPaperSizeUnit->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxPaperSizeUnit->setCurrentIndex(indexUnit);
|
||||||
|
@ -779,15 +779,14 @@ void DialogLayoutSettings::InitLayoutUnits()
|
||||||
|
|
||||||
// set default unit
|
// set default unit
|
||||||
m_oldLayoutUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
m_oldLayoutUnit = StrToUnits(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
const qint32 indexUnit = ui->comboBoxLayoutUnit->findData(
|
const qint32 indexUnit =
|
||||||
VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
ui->comboBoxLayoutUnit->findData(VAbstractValApplication::VApp()->ValentinaSettings()->GetUnit());
|
||||||
if (indexUnit != -1)
|
if (indexUnit != -1)
|
||||||
{
|
{
|
||||||
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
ui->comboBoxLayoutUnit->setCurrentIndex(indexUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::InitPrinter()
|
void DialogLayoutSettings::InitPrinter()
|
||||||
{
|
{
|
||||||
|
@ -1108,7 +1107,6 @@ void DialogLayoutSettings::SetMinMargins(const QMarginsF &fields, const QMargins
|
||||||
|
|
||||||
if (fields.bottom() < minFields.bottom())
|
if (fields.bottom() < minFields.bottom())
|
||||||
{
|
{
|
||||||
ui->doubleSpinBoxBottomField->setValue(UnitConvertor(minFields.bottom(), Unit::Px,
|
ui->doubleSpinBoxBottomField->setValue(UnitConvertor(minFields.bottom(), Unit::Px, LayoutUnit()));
|
||||||
LayoutUnit()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,14 +161,7 @@ const QString TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine");
|
||||||
*/
|
*/
|
||||||
auto StylesList() -> QStringList
|
auto StylesList() -> QStringList
|
||||||
{
|
{
|
||||||
return QStringList{
|
return {TypeLineNone, TypeLineLine, TypeLineDashLine, TypeLineDotLine, TypeLineDashDotLine, TypeLineDashDotDotLine};
|
||||||
TypeLineNone,
|
|
||||||
TypeLineLine,
|
|
||||||
TypeLineDashLine,
|
|
||||||
TypeLineDotLine,
|
|
||||||
TypeLineDashDotLine,
|
|
||||||
TypeLineDashDotDotLine
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include "../vmisc/typedef.h"
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vmisc/typedef.h"
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
#include "../vmisc/diagnostic.h"
|
#include "../vmisc/diagnostic.h"
|
||||||
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
@ -202,7 +202,6 @@ extern const QString ColorLime;
|
||||||
extern const QString ColorDeepSkyBlue;
|
extern const QString ColorDeepSkyBlue;
|
||||||
extern const QString ColorCornFlowerBlue;
|
extern const QString ColorCornFlowerBlue;
|
||||||
|
|
||||||
|
|
||||||
// variables name
|
// variables name
|
||||||
// Hacks for avoiding the linker error "undefined reference to"
|
// Hacks for avoiding the linker error "undefined reference to"
|
||||||
#define SPL_ "Spl_"
|
#define SPL_ "Spl_"
|
||||||
|
|
|
@ -2039,7 +2039,7 @@ auto VAbstractPattern::ListFinalMeasurementsExpressions() const -> QVector<VForm
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractPattern::IsVariable(const QString &token) const -> bool
|
auto VAbstractPattern::IsVariable(const QString &token) -> bool
|
||||||
{
|
{
|
||||||
for (const auto &var : BuilInVariables())
|
for (const auto &var : BuilInVariables())
|
||||||
{
|
{
|
||||||
|
@ -2054,16 +2054,11 @@ auto VAbstractPattern::IsVariable(const QString &token) const -> bool
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token.startsWith('#'))
|
return token.startsWith('#');
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto VAbstractPattern::IsFunction(const QString &token) const -> bool
|
auto VAbstractPattern::IsFunction(const QString &token) -> bool
|
||||||
{
|
{
|
||||||
for (const auto &fn : BuilInFunctions())
|
for (const auto &fn : BuilInFunctions())
|
||||||
{
|
{
|
||||||
|
|
|
@ -538,8 +538,8 @@ private:
|
||||||
auto ListPieceExpressions() const -> QVector<VFormulaField>;
|
auto ListPieceExpressions() const -> QVector<VFormulaField>;
|
||||||
auto ListFinalMeasurementsExpressions() const -> QVector<VFormulaField>;
|
auto ListFinalMeasurementsExpressions() const -> QVector<VFormulaField>;
|
||||||
|
|
||||||
auto IsVariable(const QString &token) const -> bool;
|
static auto IsVariable(const QString &token) -> bool;
|
||||||
auto IsFunction(const QString &token) const -> bool;
|
static auto IsFunction(const QString &token) -> bool;
|
||||||
|
|
||||||
auto ParseItemElement(const QDomElement &domElement) -> QPair<bool, QMap<quint32, quint32>>;
|
auto ParseItemElement(const QDomElement &domElement) -> QPair<bool, QMap<quint32, quint32>>;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <Qt>
|
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <map>
|
#include <map>
|
||||||
#ifdef QMUP_USE_OPENMP
|
#ifdef QMUP_USE_OPENMP
|
||||||
|
@ -52,16 +51,6 @@ namespace qmu
|
||||||
bool QmuParserBase::g_DbgDumpCmdCode = false;
|
bool QmuParserBase::g_DbgDumpCmdCode = false;
|
||||||
bool QmuParserBase::g_DbgDumpStack = false;
|
bool QmuParserBase::g_DbgDumpStack = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Identifiers for built in binary operators.
|
|
||||||
*
|
|
||||||
* When defining custom binary operators with #AddOprt(...) make sure not to choose
|
|
||||||
* names conflicting with these definitions.
|
|
||||||
*/
|
|
||||||
const QStringList QmuParserBase::c_DefaultOprt = QStringList()<< "<=" << ">=" << "!=" << "==" << "<" << ">" << "+"
|
|
||||||
<< "-" << "*" << "/" << "^" << "&&" << "||" << "="
|
|
||||||
<< "(" << ")" << "?" << ":";
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief Constructor.
|
* @brief Constructor.
|
||||||
|
@ -135,7 +124,8 @@ QmuParserBase::QmuParserBase(const QmuParserBase &a_Parser)
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserBase::~QmuParserBase()
|
QmuParserBase::~QmuParserBase()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -353,8 +343,8 @@ auto QmuParserBase::GetVersion(EParserVersionInfo eInfo) -> QString
|
||||||
/**
|
/**
|
||||||
* @brief Add a function or operator callback to the parser.
|
* @brief Add a function or operator callback to the parser.
|
||||||
*/
|
*/
|
||||||
void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback,
|
void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback, funmap_type &a_Storage,
|
||||||
funmap_type &a_Storage, const QString &a_szCharSet )
|
const QString &a_szCharSet)
|
||||||
{
|
{
|
||||||
if (a_Callback.GetAddr() == nullptr)
|
if (a_Callback.GetAddr() == nullptr)
|
||||||
{
|
{
|
||||||
|
@ -938,10 +928,7 @@ void QmuParserBase::ApplyBinOprt(QStack<token_type> &a_stOpt, QStack<token_type>
|
||||||
Error(ecUNEXPECTED_OPERATOR);
|
Error(ecUNEXPECTED_OPERATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
token_type valTok1 = a_stVal.pop(),
|
token_type valTok1 = a_stVal.pop(), valTok2 = a_stVal.pop(), optTok = a_stOpt.pop(), resTok;
|
||||||
valTok2 = a_stVal.pop(),
|
|
||||||
optTok = a_stOpt.pop(),
|
|
||||||
resTok;
|
|
||||||
|
|
||||||
if (valTok1.GetType() != valTok2.GetType() || (valTok1.GetType() == tpSTR && valTok2.GetType() == tpSTR))
|
if (valTok1.GetType() != valTok2.GetType() || (valTok1.GetType() == tpSTR && valTok2.GetType() == tpSTR))
|
||||||
{
|
{
|
||||||
|
@ -1024,8 +1011,9 @@ auto QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const -> qreal
|
||||||
|
|
||||||
// Note: The check for nOffset==0 and nThreadID here is not necessary but
|
// Note: The check for nOffset==0 and nThreadID here is not necessary but
|
||||||
// brings a minor performance gain when not in bulk mode.
|
// brings a minor performance gain when not in bulk mode.
|
||||||
qreal *Stack = ((nOffset==0) && (nThreadID==0)) ? &m_vStackBuffer[0] : &m_vStackBuffer[nThreadID *
|
qreal *Stack = ((nOffset == 0) && (nThreadID == 0))
|
||||||
(m_vStackBuffer.size() / s_MaxNumOpenMPThreads)];
|
? &m_vStackBuffer[0]
|
||||||
|
: &m_vStackBuffer[nThreadID * (m_vStackBuffer.size() / s_MaxNumOpenMPThreads)];
|
||||||
qreal buf;
|
qreal buf;
|
||||||
qmusizetype sidx(0);
|
qmusizetype sidx(0);
|
||||||
for (const SToken *pTok = m_vRPN.GetBase(); pTok->Cmd != cmEND; ++pTok)
|
for (const SToken *pTok = m_vRPN.GetBase(); pTok->Cmd != cmEND; ++pTok)
|
||||||
|
@ -1180,36 +1168,38 @@ QT_WARNING_DISABLE_MSVC(4191)
|
||||||
continue;
|
continue;
|
||||||
case 5:
|
case 5:
|
||||||
sidx -= 4;
|
sidx -= 4;
|
||||||
Stack[sidx] = (*reinterpret_cast<fun_type5>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx+1],
|
Stack[sidx] = (*reinterpret_cast<fun_type5>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+2], Stack[sidx+3], Stack[sidx+4]);
|
Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3], Stack[sidx + 4]);
|
||||||
continue;
|
continue;
|
||||||
case 6:
|
case 6:
|
||||||
sidx -= 5;
|
sidx -= 5;
|
||||||
Stack[sidx] = (*reinterpret_cast<fun_type6>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx + 1],
|
Stack[sidx] = (*reinterpret_cast<fun_type6>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx + 1],
|
||||||
Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5]);
|
Stack[sidx + 2], Stack[sidx + 3],
|
||||||
|
Stack[sidx + 4], Stack[sidx + 5]);
|
||||||
continue;
|
continue;
|
||||||
case 7:
|
case 7:
|
||||||
sidx -= 6;
|
sidx -= 6;
|
||||||
Stack[sidx] = (*reinterpret_cast<fun_type7>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx+1],
|
Stack[sidx] = (*reinterpret_cast<fun_type7>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6]);
|
Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3], Stack[sidx + 4],
|
||||||
|
Stack[sidx + 5], Stack[sidx + 6]);
|
||||||
continue;
|
continue;
|
||||||
case 8:
|
case 8:
|
||||||
sidx -= 7;
|
sidx -= 7;
|
||||||
Stack[sidx] = (*reinterpret_cast<fun_type8>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx+1],
|
Stack[sidx] = (*reinterpret_cast<fun_type8>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6],
|
Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3], Stack[sidx + 4],
|
||||||
Stack[sidx+7]);
|
Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7]);
|
||||||
continue;
|
continue;
|
||||||
case 9:
|
case 9:
|
||||||
sidx -= 8;
|
sidx -= 8;
|
||||||
Stack[sidx] = (*reinterpret_cast<fun_type9>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx+1],
|
Stack[sidx] = (*reinterpret_cast<fun_type9>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6],
|
Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3], Stack[sidx + 4],
|
||||||
Stack[sidx+7], Stack[sidx+8]);
|
Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7], Stack[sidx + 8]);
|
||||||
continue;
|
continue;
|
||||||
case 10:
|
case 10:
|
||||||
sidx -= 9;
|
sidx -= 9;
|
||||||
Stack[sidx] = (*reinterpret_cast<fun_type10>(pTok->Fun.ptr))(Stack[sidx], Stack[sidx+1],
|
Stack[sidx] = (*reinterpret_cast<fun_type10>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+2], Stack[sidx+3], Stack[sidx+4], Stack[sidx+5], Stack[sidx+6],
|
Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3], Stack[sidx + 4],
|
||||||
Stack[sidx+7], Stack[sidx+8], Stack[sidx+9]);
|
Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7], Stack[sidx + 8], Stack[sidx + 9]);
|
||||||
continue;
|
continue;
|
||||||
default:
|
default:
|
||||||
if (iArgCount > 0) // function with variable arguments store the number as a negative value
|
if (iArgCount > 0) // function with variable arguments store the number as a negative value
|
||||||
|
@ -1237,8 +1227,8 @@ QT_WARNING_DISABLE_MSVC(4191)
|
||||||
Stack[sidx] = (*reinterpret_cast<strfun_type1>(pTok->Fun.ptr))(m_vStringBuf.at(iIdxStack));
|
Stack[sidx] = (*reinterpret_cast<strfun_type1>(pTok->Fun.ptr))(m_vStringBuf.at(iIdxStack));
|
||||||
continue;
|
continue;
|
||||||
case 1:
|
case 1:
|
||||||
Stack[sidx] = (*reinterpret_cast<strfun_type2>(pTok->Fun.ptr))(m_vStringBuf.at(iIdxStack),
|
Stack[sidx] =
|
||||||
Stack[sidx]);
|
(*reinterpret_cast<strfun_type2>(pTok->Fun.ptr))(m_vStringBuf.at(iIdxStack), Stack[sidx]);
|
||||||
continue;
|
continue;
|
||||||
case 2:
|
case 2:
|
||||||
Stack[sidx] = (*reinterpret_cast<strfun_type3>(pTok->Fun.ptr))(m_vStringBuf.at(iIdxStack),
|
Stack[sidx] = (*reinterpret_cast<strfun_type3>(pTok->Fun.ptr))(m_vStringBuf.at(iIdxStack),
|
||||||
|
@ -1262,8 +1252,8 @@ QT_WARNING_DISABLE_MSVC(4191)
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type0>(pTok->Fun.ptr))(nOffset, nThreadID);
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type0>(pTok->Fun.ptr))(nOffset, nThreadID);
|
||||||
continue;
|
continue;
|
||||||
case 1:
|
case 1:
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type1>(pTok->Fun.ptr))(nOffset, nThreadID,
|
Stack[sidx] =
|
||||||
Stack[sidx]);
|
(*reinterpret_cast<bulkfun_type1>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx]);
|
||||||
continue;
|
continue;
|
||||||
case 2:
|
case 2:
|
||||||
sidx -= 1;
|
sidx -= 1;
|
||||||
|
@ -1272,49 +1262,48 @@ QT_WARNING_DISABLE_MSVC(4191)
|
||||||
continue;
|
continue;
|
||||||
case 3:
|
case 3:
|
||||||
sidx -= 2;
|
sidx -= 2;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type3>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type3>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2]);
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2]);
|
||||||
continue;
|
continue;
|
||||||
case 4:
|
case 4:
|
||||||
sidx -= 3;
|
sidx -= 3;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type4>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type4>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2], Stack[sidx+3]);
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3]);
|
||||||
continue;
|
continue;
|
||||||
case 5:
|
case 5:
|
||||||
sidx -= 4;
|
sidx -= 4;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type5>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type5>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2], Stack[sidx+3],
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3],
|
||||||
Stack[sidx + 4]);
|
Stack[sidx + 4]);
|
||||||
continue;
|
continue;
|
||||||
case 6:
|
case 6:
|
||||||
sidx -= 5;
|
sidx -= 5;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type6>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type6>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2],
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3],
|
||||||
Stack[sidx+3], Stack[sidx+4], Stack[sidx+5]);
|
Stack[sidx + 4], Stack[sidx + 5]);
|
||||||
continue;
|
continue;
|
||||||
case 7:
|
case 7:
|
||||||
sidx -= 6;
|
sidx -= 6;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type7>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type7>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2], Stack[sidx+3],
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3],
|
||||||
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6]);
|
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6]);
|
||||||
continue;
|
continue;
|
||||||
case 8:
|
case 8:
|
||||||
sidx -= 7;
|
sidx -= 7;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type8>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type8>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2], Stack[sidx+3],
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3],
|
||||||
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7]);
|
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7]);
|
||||||
continue;
|
continue;
|
||||||
case 9:
|
case 9:
|
||||||
sidx -= 8;
|
sidx -= 8;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type9>(pTok->Fun.ptr))(nOffset, nThreadID, Stack[sidx],
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type9>(pTok->Fun.ptr))(
|
||||||
Stack[sidx+1], Stack[sidx+2], Stack[sidx+3],
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3],
|
||||||
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7], Stack[sidx + 8]);
|
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7], Stack[sidx + 8]);
|
||||||
continue;
|
continue;
|
||||||
case 10:
|
case 10:
|
||||||
sidx -= 9;
|
sidx -= 9;
|
||||||
Stack[sidx] = (*reinterpret_cast<bulkfun_type10>(pTok->Fun.ptr))(nOffset, nThreadID,
|
Stack[sidx] = (*reinterpret_cast<bulkfun_type10>(pTok->Fun.ptr))(
|
||||||
Stack[sidx],
|
nOffset, nThreadID, Stack[sidx], Stack[sidx + 1], Stack[sidx + 2], Stack[sidx + 3],
|
||||||
Stack[sidx+1], Stack[sidx+2], Stack[sidx+3],
|
|
||||||
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7], Stack[sidx + 8],
|
Stack[sidx + 4], Stack[sidx + 5], Stack[sidx + 6], Stack[sidx + 7], Stack[sidx + 8],
|
||||||
Stack[sidx + 9]);
|
Stack[sidx + 9]);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1457,8 +1446,8 @@ void QmuParserBase::CreateRPN() const
|
||||||
|
|
||||||
stOpt.pop(); // Take opening bracket from stack
|
stOpt.pop(); // Take opening bracket from stack
|
||||||
|
|
||||||
if (iArgCount>1 && ( stOpt.size()==0 || (stOpt.top().GetCode()!=cmFUNC &&
|
if (iArgCount > 1 && (stOpt.size() == 0 ||
|
||||||
stOpt.top().GetCode()!=cmFUNC_BULK &&
|
(stOpt.top().GetCode() != cmFUNC && stOpt.top().GetCode() != cmFUNC_BULK &&
|
||||||
stOpt.top().GetCode() != cmFUNC_STR)))
|
stOpt.top().GetCode() != cmFUNC_STR)))
|
||||||
{
|
{
|
||||||
Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
|
Error(ecUNEXPECTED_ARG, m_pTokenReader->GetPos());
|
||||||
|
@ -1504,16 +1493,14 @@ void QmuParserBase::CreateRPN() const
|
||||||
stOpt.top().GetCode() != cmIF)
|
stOpt.top().GetCode() != cmIF)
|
||||||
{
|
{
|
||||||
const token_type &topToken = stOpt.top();
|
const token_type &topToken = stOpt.top();
|
||||||
int nPrec1 = GetOprtPrecedence(topToken),
|
int nPrec1 = GetOprtPrecedence(topToken), nPrec2 = GetOprtPrecedence(opt);
|
||||||
nPrec2 = GetOprtPrecedence(opt);
|
|
||||||
|
|
||||||
const ECmdCode code = topToken.GetCode();
|
const ECmdCode code = topToken.GetCode();
|
||||||
if (code == opt.GetCode())
|
if (code == opt.GetCode())
|
||||||
{
|
{
|
||||||
// Deal with operator associativity
|
// Deal with operator associativity
|
||||||
EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
|
EOprtAssociativity eOprtAsct = GetOprtAssociativity(opt);
|
||||||
if ( (eOprtAsct==oaRIGHT && (nPrec1 <= nPrec2)) ||
|
if ((eOprtAsct == oaRIGHT && (nPrec1 <= nPrec2)) || (eOprtAsct == oaLEFT && (nPrec1 < nPrec2)))
|
||||||
(eOprtAsct==oaLEFT && (nPrec1 < nPrec2)) )
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1824,8 +1811,7 @@ void QmuParserBase::SetArgSep(char_type cArgSep)
|
||||||
*/
|
*/
|
||||||
void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<token_type> &a_stOprt) const
|
void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<token_type> &a_stOprt) const
|
||||||
{
|
{
|
||||||
QStack<token_type> stOprt(a_stOprt),
|
QStack<token_type> stOprt(a_stOprt), stVal(a_stVal);
|
||||||
stVal(a_stVal);
|
|
||||||
|
|
||||||
qDebug() << "\nValue stack:\n";
|
qDebug() << "\nValue stack:\n";
|
||||||
while (stVal.empty() == false)
|
while (stVal.empty() == false)
|
||||||
|
@ -1847,7 +1833,7 @@ void QmuParserBase::StackDump(const QStack<token_type> &a_stVal, const QStack<to
|
||||||
const token_type &topToken = stOprt.top();
|
const token_type &topToken = stOprt.top();
|
||||||
if (topToken.GetCode() <= cmASSIGN)
|
if (topToken.GetCode() <= cmASSIGN)
|
||||||
{
|
{
|
||||||
qDebug() << "OPRT_INTRNL \"" << QmuParserBase::c_DefaultOprt[topToken.GetCode()] << "\" \n";
|
qDebug() << "OPRT_INTRNL \"" << QmuParserBase::GetOprtDef()[topToken.GetCode()] << "\" \n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ class QMUPARSERSHARED_EXPORT QmuParserBase
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QmuParserBase();
|
QmuParserBase();
|
||||||
explicit QmuParserBase(const QmuParserBase &a_Parser);
|
QmuParserBase(const QmuParserBase &a_Parser);
|
||||||
auto operator=(const QmuParserBase &a_Parser) -> QmuParserBase &;
|
auto operator=(const QmuParserBase &a_Parser) -> QmuParserBase &;
|
||||||
virtual ~QmuParserBase();
|
virtual ~QmuParserBase();
|
||||||
|
|
||||||
|
|
|
@ -27,26 +27,15 @@
|
||||||
|
|
||||||
namespace qmu
|
namespace qmu
|
||||||
{
|
{
|
||||||
const QmuParserErrorMsg QmuParserErrorMsg::m_Instance;
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
QmuParserErrorMsg::~QmuParserErrorMsg()
|
|
||||||
{}
|
|
||||||
|
|
||||||
#define translate(context, source, disambiguation) QmuTranslation::translate((context), (source), (disambiguation))
|
#define translate(context, source, disambiguation) QmuTranslation::translate((context), (source), (disambiguation))
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserErrorMsg::QmuParserErrorMsg()
|
QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
: m_vErrMsg ()
|
|
||||||
{
|
{
|
||||||
m_vErrMsg.clear();
|
|
||||||
|
|
||||||
m_vErrMsg.insert(ecUNASSIGNABLE_TOKEN,
|
m_vErrMsg.insert(ecUNASSIGNABLE_TOKEN,
|
||||||
translate("QmuParserErrorMsg", "Unexpected token \"$TOK$\" found at position $POS$.",
|
translate("QmuParserErrorMsg", "Unexpected token \"$TOK$\" found at position $POS$.",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
||||||
m_vErrMsg.insert(ecINTERNAL_ERROR,
|
m_vErrMsg.insert(ecINTERNAL_ERROR, translate("QmuParserErrorMsg", "Internal error", "Math parser error messages."));
|
||||||
translate("QmuParserErrorMsg", "Internal error",
|
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecINVALID_NAME,
|
m_vErrMsg.insert(ecINVALID_NAME,
|
||||||
translate("QmuParserErrorMsg", "Invalid function-, variable- or constant name: \"$TOK$\".",
|
translate("QmuParserErrorMsg", "Invalid function-, variable- or constant name: \"$TOK$\".",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\""));
|
"Math parser error messages. Left untouched \"$TOK$\""));
|
||||||
|
@ -59,20 +48,16 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
m_vErrMsg.insert(ecINVALID_POSTFIX_IDENT,
|
m_vErrMsg.insert(ecINVALID_POSTFIX_IDENT,
|
||||||
translate("QmuParserErrorMsg", "Invalid postfix operator identifier: \"$TOK$\".",
|
translate("QmuParserErrorMsg", "Invalid postfix operator identifier: \"$TOK$\".",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\""));
|
"Math parser error messages. Left untouched \"$TOK$\""));
|
||||||
m_vErrMsg.insert(ecINVALID_FUN_PTR,
|
m_vErrMsg.insert(ecINVALID_FUN_PTR, translate("QmuParserErrorMsg", "Invalid pointer to callback function.",
|
||||||
translate("QmuParserErrorMsg", "Invalid pointer to callback function.",
|
|
||||||
"Math parser error messages."));
|
"Math parser error messages."));
|
||||||
m_vErrMsg.insert(ecEMPTY_EXPRESSION,
|
m_vErrMsg.insert(ecEMPTY_EXPRESSION,
|
||||||
translate("QmuParserErrorMsg", "Expression is empty.",
|
translate("QmuParserErrorMsg", "Expression is empty.", "Math parser error messages."));
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecINVALID_VAR_PTR,
|
m_vErrMsg.insert(ecINVALID_VAR_PTR,
|
||||||
translate("QmuParserErrorMsg", "Invalid pointer to variable.",
|
translate("QmuParserErrorMsg", "Invalid pointer to variable.", "Math parser error messages."));
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecUNEXPECTED_OPERATOR,
|
m_vErrMsg.insert(ecUNEXPECTED_OPERATOR,
|
||||||
translate("QmuParserErrorMsg", "Unexpected operator \"$TOK$\" found at position $POS$",
|
translate("QmuParserErrorMsg", "Unexpected operator \"$TOK$\" found at position $POS$",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
||||||
m_vErrMsg.insert(ecUNEXPECTED_EOF,
|
m_vErrMsg.insert(ecUNEXPECTED_EOF, translate("QmuParserErrorMsg", "Unexpected end of expression at position $POS$",
|
||||||
translate("QmuParserErrorMsg", "Unexpected end of expression at position $POS$",
|
|
||||||
"Math parser error messages. Left untouched $POS$"));
|
"Math parser error messages. Left untouched $POS$"));
|
||||||
m_vErrMsg.insert(ecUNEXPECTED_ARG_SEP,
|
m_vErrMsg.insert(ecUNEXPECTED_ARG_SEP,
|
||||||
translate("QmuParserErrorMsg", "Unexpected argument separator at position $POS$",
|
translate("QmuParserErrorMsg", "Unexpected argument separator at position $POS$",
|
||||||
|
@ -80,8 +65,7 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
m_vErrMsg.insert(ecUNEXPECTED_PARENS,
|
m_vErrMsg.insert(ecUNEXPECTED_PARENS,
|
||||||
translate("QmuParserErrorMsg", "Unexpected parenthesis \"$TOK$\" at position $POS$",
|
translate("QmuParserErrorMsg", "Unexpected parenthesis \"$TOK$\" at position $POS$",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
||||||
m_vErrMsg.insert(ecUNEXPECTED_FUN,
|
m_vErrMsg.insert(ecUNEXPECTED_FUN, translate("QmuParserErrorMsg", "Unexpected function \"$TOK$\" at position $POS$",
|
||||||
translate("QmuParserErrorMsg", "Unexpected function \"$TOK$\" at position $POS$",
|
|
||||||
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
||||||
m_vErrMsg.insert(ecUNEXPECTED_VAL,
|
m_vErrMsg.insert(ecUNEXPECTED_VAL,
|
||||||
translate("QmuParserErrorMsg", "Unexpected value \"$TOK$\" found at position $POS$",
|
translate("QmuParserErrorMsg", "Unexpected value \"$TOK$\" found at position $POS$",
|
||||||
|
@ -93,8 +77,7 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
translate("QmuParserErrorMsg", "Function arguments used without a function (position: $POS$)",
|
translate("QmuParserErrorMsg", "Function arguments used without a function (position: $POS$)",
|
||||||
"Math parser error messages. Left untouched $POS$"));
|
"Math parser error messages. Left untouched $POS$"));
|
||||||
m_vErrMsg.insert(ecMISSING_PARENS,
|
m_vErrMsg.insert(ecMISSING_PARENS,
|
||||||
translate("QmuParserErrorMsg", "Missing parenthesis",
|
translate("QmuParserErrorMsg", "Missing parenthesis", "Math parser error messages."));
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecTOO_MANY_PARAMS,
|
m_vErrMsg.insert(ecTOO_MANY_PARAMS,
|
||||||
translate("QmuParserErrorMsg",
|
translate("QmuParserErrorMsg",
|
||||||
"Too many parameters for function \"$TOK$\" at expression position $POS$",
|
"Too many parameters for function \"$TOK$\" at expression position $POS$",
|
||||||
|
@ -103,17 +86,10 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
translate("QmuParserErrorMsg",
|
translate("QmuParserErrorMsg",
|
||||||
"Too few parameters for function \"$TOK$\" at expression position $POS$",
|
"Too few parameters for function \"$TOK$\" at expression position $POS$",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
||||||
m_vErrMsg.insert(ecDIV_BY_ZERO,
|
m_vErrMsg.insert(ecDIV_BY_ZERO, translate("QmuParserErrorMsg", "Divide by zero", "Math parser error messages."));
|
||||||
translate("QmuParserErrorMsg", "Divide by zero",
|
m_vErrMsg.insert(ecDOMAIN_ERROR, translate("QmuParserErrorMsg", "Domain error", "Math parser error messages."));
|
||||||
"Math parser error messages."));
|
m_vErrMsg.insert(ecNAME_CONFLICT, translate("QmuParserErrorMsg", "Name conflict", "Math parser error messages."));
|
||||||
m_vErrMsg.insert(ecDOMAIN_ERROR,
|
m_vErrMsg.insert(ecOPT_PRI, translate("QmuParserErrorMsg",
|
||||||
translate("QmuParserErrorMsg", "Domain error",
|
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecNAME_CONFLICT,
|
|
||||||
translate("QmuParserErrorMsg", "Name conflict",
|
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecOPT_PRI,
|
|
||||||
translate("QmuParserErrorMsg",
|
|
||||||
"Invalid value for operator priority (must be greater or equal to zero).",
|
"Invalid value for operator priority (must be greater or equal to zero).",
|
||||||
"Math parser error messages."));
|
"Math parser error messages."));
|
||||||
m_vErrMsg.insert(ecBUILTIN_OVERLOAD,
|
m_vErrMsg.insert(ecBUILTIN_OVERLOAD,
|
||||||
|
@ -136,11 +112,8 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
translate("QmuParserErrorMsg", "No suitable overload for operator \"$TOK$\" at position $POS$.",
|
translate("QmuParserErrorMsg", "No suitable overload for operator \"$TOK$\" at position $POS$.",
|
||||||
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
"Math parser error messages. Left untouched \"$TOK$\" and $POS$"));
|
||||||
m_vErrMsg.insert(ecSTR_RESULT,
|
m_vErrMsg.insert(ecSTR_RESULT,
|
||||||
translate("QmuParserErrorMsg", "Function result is a string.",
|
translate("QmuParserErrorMsg", "Function result is a string.", "Math parser error messages."));
|
||||||
"Math parser error messages."));
|
m_vErrMsg.insert(ecGENERIC, translate("QmuParserErrorMsg", "Parser error.", "Math parser error messages."));
|
||||||
m_vErrMsg.insert(ecGENERIC,
|
|
||||||
translate("QmuParserErrorMsg", "Parser error.",
|
|
||||||
"Math parser error messages."));
|
|
||||||
m_vErrMsg.insert(ecLOCALE,
|
m_vErrMsg.insert(ecLOCALE,
|
||||||
translate("QmuParserErrorMsg", "Decimal separator is identic to function argument separator.",
|
translate("QmuParserErrorMsg", "Decimal separator is identic to function argument separator.",
|
||||||
"Math parser error messages."));
|
"Math parser error messages."));
|
||||||
|
@ -150,8 +123,7 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
m_vErrMsg.insert(ecMISSING_ELSE_CLAUSE,
|
m_vErrMsg.insert(ecMISSING_ELSE_CLAUSE,
|
||||||
translate("QmuParserErrorMsg", "If-then-else operator is missing an else clause",
|
translate("QmuParserErrorMsg", "If-then-else operator is missing an else clause",
|
||||||
"Math parser error messages. Do not translate operator name."));
|
"Math parser error messages. Do not translate operator name."));
|
||||||
m_vErrMsg.insert(ecMISPLACED_COLON,
|
m_vErrMsg.insert(ecMISPLACED_COLON, translate("QmuParserErrorMsg", "Misplaced colon at position $POS$",
|
||||||
translate("QmuParserErrorMsg", "Misplaced colon at position $POS$",
|
|
||||||
"Math parser error messages. Left untouched $POS$"));
|
"Math parser error messages. Left untouched $POS$"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +139,15 @@ QmuParserErrorMsg::QmuParserErrorMsg()
|
||||||
* @brief Default constructor.
|
* @brief Default constructor.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError()
|
QmuParserError::QmuParserError()
|
||||||
: QException(), m_sMsg(), m_sExpr(), m_sTok(), m_iPos ( -1 ), m_iErrc ( ecUNDEFINED ),
|
: QException(),
|
||||||
|
m_sMsg(),
|
||||||
|
m_sExpr(),
|
||||||
|
m_sTok(),
|
||||||
|
m_iPos(-1),
|
||||||
|
m_iErrc(ecUNDEFINED),
|
||||||
m_ErrMsg(QmuParserErrorMsg::Instance())
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -178,7 +156,12 @@ QmuParserError::QmuParserError()
|
||||||
* It does not contain any information but the error code.
|
* It does not contain any information but the error code.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError(EErrorCodes a_iErrc)
|
QmuParserError::QmuParserError(EErrorCodes a_iErrc)
|
||||||
: QException(), m_sMsg(), m_sExpr(), m_sTok(), m_iPos ( -1 ), m_iErrc ( a_iErrc ),
|
: QException(),
|
||||||
|
m_sMsg(),
|
||||||
|
m_sExpr(),
|
||||||
|
m_sTok(),
|
||||||
|
m_iPos(-1),
|
||||||
|
m_iErrc(a_iErrc),
|
||||||
m_ErrMsg(QmuParserErrorMsg::Instance())
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
{
|
{
|
||||||
m_sMsg = m_ErrMsg[m_iErrc];
|
m_sMsg = m_ErrMsg[m_iErrc];
|
||||||
|
@ -191,9 +174,15 @@ QmuParserError::QmuParserError ( EErrorCodes a_iErrc )
|
||||||
* @brief Construct an error from a message text.
|
* @brief Construct an error from a message text.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError(const QString &sMsg)
|
QmuParserError::QmuParserError(const QString &sMsg)
|
||||||
: QException(), m_sMsg(sMsg), m_sExpr(), m_sTok(), m_iPos ( -1 ), m_iErrc ( ecUNDEFINED ),
|
: QException(),
|
||||||
|
m_sMsg(sMsg),
|
||||||
|
m_sExpr(),
|
||||||
|
m_sTok(),
|
||||||
|
m_iPos(-1),
|
||||||
|
m_iErrc(ecUNDEFINED),
|
||||||
m_ErrMsg(QmuParserErrorMsg::Instance())
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -204,7 +193,12 @@ QmuParserError::QmuParserError ( const QString &sMsg )
|
||||||
* @param [in] iPos the position in the expression where the error occured.
|
* @param [in] iPos the position in the expression where the error occured.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError(EErrorCodes iErrc, const QString &sTok, const QString &sExpr, qmusizetype iPos)
|
QmuParserError::QmuParserError(EErrorCodes iErrc, const QString &sTok, const QString &sExpr, qmusizetype iPos)
|
||||||
: QException(), m_sMsg(), m_sExpr ( sExpr ), m_sTok ( sTok ), m_iPos ( iPos ), m_iErrc ( iErrc ),
|
: QException(),
|
||||||
|
m_sMsg(),
|
||||||
|
m_sExpr(sExpr),
|
||||||
|
m_sTok(sTok),
|
||||||
|
m_iPos(iPos),
|
||||||
|
m_iErrc(iErrc),
|
||||||
m_ErrMsg(QmuParserErrorMsg::Instance())
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
{
|
{
|
||||||
m_sMsg = m_ErrMsg[m_iErrc];
|
m_sMsg = m_ErrMsg[m_iErrc];
|
||||||
|
@ -220,7 +214,12 @@ QmuParserError::QmuParserError (EErrorCodes iErrc, const QString &sTok, const QS
|
||||||
* @param [in] sTok The token string related to this error.
|
* @param [in] sTok The token string related to this error.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError(EErrorCodes a_iErrc, int a_iPos, const QString &sTok)
|
QmuParserError::QmuParserError(EErrorCodes a_iErrc, int a_iPos, const QString &sTok)
|
||||||
: QException(), m_sMsg(), m_sExpr(), m_sTok ( sTok ), m_iPos ( a_iPos ), m_iErrc ( a_iErrc ),
|
: QException(),
|
||||||
|
m_sMsg(),
|
||||||
|
m_sExpr(),
|
||||||
|
m_sTok(sTok),
|
||||||
|
m_iPos(a_iPos),
|
||||||
|
m_iErrc(a_iErrc),
|
||||||
m_ErrMsg(QmuParserErrorMsg::Instance())
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
{
|
{
|
||||||
m_sMsg = m_ErrMsg[m_iErrc];
|
m_sMsg = m_ErrMsg[m_iErrc];
|
||||||
|
@ -235,7 +234,12 @@ QmuParserError::QmuParserError ( EErrorCodes a_iErrc, int a_iPos, const QString
|
||||||
* @param [in] sTok The token string related to this error.
|
* @param [in] sTok The token string related to this error.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError(const QString &szMsg, int iPos, const QString &sTok)
|
QmuParserError::QmuParserError(const QString &szMsg, int iPos, const QString &sTok)
|
||||||
: QException(), m_sMsg ( szMsg ), m_sExpr(), m_sTok ( sTok ), m_iPos ( iPos ), m_iErrc ( ecGENERIC ),
|
: QException(),
|
||||||
|
m_sMsg(szMsg),
|
||||||
|
m_sExpr(),
|
||||||
|
m_sTok(sTok),
|
||||||
|
m_iPos(iPos),
|
||||||
|
m_iErrc(ecGENERIC),
|
||||||
m_ErrMsg(QmuParserErrorMsg::Instance())
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
{
|
{
|
||||||
m_sMsg.replace("$POS$", QString().setNum(m_iPos));
|
m_sMsg.replace("$POS$", QString().setNum(m_iPos));
|
||||||
|
@ -247,9 +251,15 @@ QmuParserError::QmuParserError ( const QString &szMsg, int iPos, const QString &
|
||||||
* @brief Copy constructor.
|
* @brief Copy constructor.
|
||||||
*/
|
*/
|
||||||
QmuParserError::QmuParserError(const QmuParserError &a_Obj)
|
QmuParserError::QmuParserError(const QmuParserError &a_Obj)
|
||||||
: QException(), m_sMsg ( a_Obj.m_sMsg ), m_sExpr ( a_Obj.m_sExpr ), m_sTok ( a_Obj.m_sTok ),
|
: QException(),
|
||||||
m_iPos ( a_Obj.m_iPos ), m_iErrc ( a_Obj.m_iErrc ), m_ErrMsg ( QmuParserErrorMsg::Instance() )
|
m_sMsg(a_Obj.m_sMsg),
|
||||||
{}
|
m_sExpr(a_Obj.m_sExpr),
|
||||||
|
m_sTok(a_Obj.m_sTok),
|
||||||
|
m_iPos(a_Obj.m_iPos),
|
||||||
|
m_iErrc(a_Obj.m_iErrc),
|
||||||
|
m_ErrMsg(QmuParserErrorMsg::Instance())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/** @brief Assignment operator. */
|
/** @brief Assignment operator. */
|
||||||
|
@ -303,13 +313,17 @@ auto QmuParserError::clone() const -> QmuParserError *
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserWarning::QmuParserWarning(const QString &sMsg)
|
QmuParserWarning::QmuParserWarning(const QString &sMsg)
|
||||||
: QException(), m_sMsg ( sMsg )
|
: QException(),
|
||||||
{}
|
m_sMsg(sMsg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserWarning::QmuParserWarning(const QmuParserWarning &a_Obj)
|
QmuParserWarning::QmuParserWarning(const QmuParserWarning &a_Obj)
|
||||||
: QException(), m_sMsg(a_Obj.m_sMsg)
|
: QException(),
|
||||||
{}
|
m_sMsg(a_Obj.m_sMsg)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto QmuParserWarning::operator=(const QmuParserWarning &a_Obj) -> QmuParserWarning &
|
auto QmuParserWarning::operator=(const QmuParserWarning &a_Obj) -> QmuParserWarning &
|
||||||
|
|
|
@ -104,10 +104,10 @@ enum EErrorCodes
|
||||||
class QMUPARSERSHARED_EXPORT QmuParserErrorMsg
|
class QMUPARSERSHARED_EXPORT QmuParserErrorMsg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef QmuParserErrorMsg self_type;
|
using self_type = QmuParserErrorMsg;
|
||||||
|
|
||||||
QmuParserErrorMsg();
|
QmuParserErrorMsg();
|
||||||
~QmuParserErrorMsg();
|
~QmuParserErrorMsg() = default;
|
||||||
|
|
||||||
static auto Instance() -> const QmuParserErrorMsg &;
|
static auto Instance() -> const QmuParserErrorMsg &;
|
||||||
auto operator[](int a_iIdx) const -> QString;
|
auto operator[](int a_iIdx) const -> QString;
|
||||||
|
@ -115,7 +115,7 @@ public:
|
||||||
private:
|
private:
|
||||||
// cppcheck-suppress unknownMacro
|
// cppcheck-suppress unknownMacro
|
||||||
Q_DISABLE_COPY_MOVE(QmuParserErrorMsg) // NOLINT
|
Q_DISABLE_COPY_MOVE(QmuParserErrorMsg) // NOLINT
|
||||||
QMap<int, QmuTranslation> m_vErrMsg; ///< A map with the predefined error messages
|
QMap<int, QmuTranslation> m_vErrMsg{}; ///< A map with the predefined error messages
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
******************************************************************************************************/
|
******************************************************************************************************/
|
||||||
|
|
||||||
#include "qmutranslation.h"
|
#include "qmutranslation.h"
|
||||||
#include "qmuparserdef.h"
|
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -37,14 +36,20 @@ auto QmuTranslation::translate(const char *context, const char *sourceText, cons
|
||||||
{
|
{
|
||||||
n = -1;
|
n = -1;
|
||||||
}
|
}
|
||||||
QmuTranslation t(context, sourceText, disambiguation, n);
|
|
||||||
return t;
|
return {context, sourceText, disambiguation, n};
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuTranslation::QmuTranslation()
|
QmuTranslation::QmuTranslation()
|
||||||
: mcontext(), msourceText(), mdisambiguation(), mn(-1), localeName(), cachedTranslation()
|
: mcontext(),
|
||||||
{}
|
msourceText(),
|
||||||
|
mdisambiguation(),
|
||||||
|
mn(-1),
|
||||||
|
localeName(),
|
||||||
|
cachedTranslation()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuTranslation::QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation, int n)
|
QmuTranslation::QmuTranslation(const QString &context, const QString &sourceText, const QString &disambiguation, int n)
|
||||||
|
@ -54,7 +59,8 @@ QmuTranslation::QmuTranslation(const QString &context, const QString &sourceText
|
||||||
mn(n),
|
mn(n),
|
||||||
localeName(),
|
localeName(),
|
||||||
cachedTranslation()
|
cachedTranslation()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto QmuTranslation::operator=(const QmuTranslation &tr) -> QmuTranslation &
|
auto QmuTranslation::operator=(const QmuTranslation &tr) -> QmuTranslation &
|
||||||
|
@ -80,7 +86,8 @@ QmuTranslation::QmuTranslation(const QmuTranslation &tr)
|
||||||
mn(tr.mn),
|
mn(tr.mn),
|
||||||
localeName(),
|
localeName(),
|
||||||
cachedTranslation()
|
cachedTranslation()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto QmuTranslation::translate(const QString &locale) const -> QString
|
auto QmuTranslation::translate(const QString &locale) const -> QString
|
||||||
|
|
|
@ -27,53 +27,53 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vpatternrecipe.h"
|
#include "vpatternrecipe.h"
|
||||||
|
#include "../ifc/exception/vexceptioninvalidhistory.h"
|
||||||
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
|
#include "../vgeometry/vpointf.h"
|
||||||
|
#include "../vgeometry/vsplinepath.h"
|
||||||
#include "../vmisc/projectversion.h"
|
#include "../vmisc/projectversion.h"
|
||||||
#include "../vmisc/vabstractvalapplication.h"
|
#include "../vmisc/vabstractvalapplication.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
|
||||||
#include "../ifc/exception/vexceptioninvalidhistory.h"
|
|
||||||
#include "../vpatterndb/vcontainer.h"
|
|
||||||
#include "../vgeometry/vpointf.h"
|
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
|
||||||
#include "../vgeometry/vsplinepath.h"
|
|
||||||
#include "../vgeometry/vcubicbezierpath.h"
|
|
||||||
#include "../vpatterndb/calculator.h"
|
#include "../vpatterndb/calculator.h"
|
||||||
#include "../vpatterndb/variables/vincrement.h"
|
#include "../vpatterndb/variables/vincrement.h"
|
||||||
#include "../vpatterndb/variables/vmeasurement.h"
|
#include "../vpatterndb/variables/vmeasurement.h"
|
||||||
|
#include "../vpatterndb/vcontainer.h"
|
||||||
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h"
|
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h"
|
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h"
|
#include "../vtools/tools/drawTools/operation/vtoolmove.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h"
|
#include "../vtools/tools/drawTools/operation/vtoolrotation.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolarc.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolarc.h"
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolarcwithlength.h"
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolspline.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezier.h"
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolsplinepath.h"
|
|
||||||
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.h"
|
||||||
#include "../vtools/tools/drawTools/vtoolline.h"
|
#include "../vtools/tools/drawTools/toolcurve/vtoolellipticalarc.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolcurve/vtoolspline.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolcurve/vtoolsplinepath.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolbasepoint.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
||||||
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.h"
|
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.h"
|
#include "../vtools/tools/drawTools/vtoolline.h"
|
||||||
#include "../vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/vtoolrotation.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.h"
|
|
||||||
#include "../vtools/tools/drawTools/operation/vtoolmove.h"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -127,8 +127,9 @@ VPatternRecipe::VPatternRecipe(VAbstractPattern *pattern, QObject *parent)
|
||||||
recipeElement.appendChild(Content());
|
recipeElement.appendChild(Content());
|
||||||
|
|
||||||
appendChild(recipeElement);
|
appendChild(recipeElement);
|
||||||
insertBefore(createProcessingInstruction(QStringLiteral("xml"),
|
insertBefore(
|
||||||
QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")), firstChild());
|
createProcessingInstruction(QStringLiteral("xml"), QStringLiteral("version=\"1.0\" encoding=\"UTF-8\"")),
|
||||||
|
firstChild());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -150,8 +151,8 @@ auto VPatternRecipe::Prerequisite() -> QDomElement
|
||||||
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
QDomElement prerequisiteElement = createElement(QStringLiteral("prerequisite"));
|
||||||
|
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), AppVersionStr()));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("valentina"), AppVersionStr()));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("unit"),
|
prerequisiteElement.appendChild(
|
||||||
UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
|
CreateElementWithText(QStringLiteral("unit"), UnitsToStr(VAbstractValApplication::VApp()->patternUnits())));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("author"), m_pattern->GetCompanyName()));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("pattenName"), m_pattern->GetPatternName()));
|
||||||
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription()));
|
prerequisiteElement.appendChild(CreateElementWithText(QStringLiteral("description"), m_pattern->GetDescription()));
|
||||||
|
@ -495,20 +496,22 @@ auto VPatternRecipe::FinalMeasurement(const VFinalMeasurement &fm, const VContai
|
||||||
const qreal result = cal->EvalFormula(data.DataVariables(), fm.formula);
|
const qreal result = cal->EvalFormula(data.DataVariables(), fm.formula);
|
||||||
if (qIsInf(result) || qIsNaN(result))
|
if (qIsInf(result) || qIsNaN(result))
|
||||||
{
|
{
|
||||||
const QString errorMsg = QString("%1\n\n%1").arg(tr("Reading final measurements error."),
|
const QString errorMsg = QString("%1\n\n%1")
|
||||||
|
.arg(tr("Reading final measurements error."),
|
||||||
tr("Value for final measurtement '%1' is infinite or NaN. "
|
tr("Value for final measurtement '%1' is infinite or NaN. "
|
||||||
"Please, check your calculations.").arg(fm.name));
|
"Please, check your calculations.")
|
||||||
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg)
|
.arg(fm.name));
|
||||||
: qWarning()
|
VAbstractApplication::VApp()->IsPedantic()
|
||||||
<< VAbstractValApplication::warningMessageSignature + errorMsg;
|
? throw VException(errorMsg)
|
||||||
|
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);
|
SetAttribute(recipeFinalMeasurement, QStringLiteral("value"), result);
|
||||||
}
|
}
|
||||||
catch (const qmu::QmuParserError &e)
|
catch (const qmu::QmuParserError &e)
|
||||||
{
|
{
|
||||||
throw VExceptionInvalidHistory(tr("Unable to create record for final measurement '%1'. Error: %2")
|
throw VExceptionInvalidHistory(
|
||||||
.arg(fm.name).arg(e.GetMsg()));
|
tr("Unable to create record for final measurement '%1'. Error: %2").arg(fm.name).arg(e.GetMsg()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return recipeFinalMeasurement;
|
return recipeFinalMeasurement;
|
||||||
|
@ -1157,16 +1160,14 @@ inline void VPatternRecipe::Formula(QDomElement &step, const VFormula &formula,
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename T>
|
template <typename T> inline void VPatternRecipe::LineAttributes(QDomElement &step, T *tool)
|
||||||
inline void VPatternRecipe::LineAttributes(QDomElement &step, T *tool)
|
|
||||||
{
|
{
|
||||||
SetAttribute(step, AttrLineColor, tool->GetLineColor());
|
SetAttribute(step, AttrLineColor, tool->GetLineColor());
|
||||||
SetAttribute(step, AttrTypeLine, tool->getLineType());
|
SetAttribute(step, AttrTypeLine, tool->getLineType());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename T>
|
template <typename T> void VPatternRecipe::CurveAttributes(QDomElement &step, T *tool)
|
||||||
void VPatternRecipe::CurveAttributes(QDomElement &step, T *tool)
|
|
||||||
{
|
{
|
||||||
SetAttribute(step, AttrLineColor, tool->GetLineColor());
|
SetAttribute(step, AttrLineColor, tool->GetLineColor());
|
||||||
SetAttribute(step, AttrPenStyle, tool->GetPenStyle());
|
SetAttribute(step, AttrPenStyle, tool->GetPenStyle());
|
||||||
|
@ -1176,10 +1177,8 @@ void VPatternRecipe::CurveAttributes(QDomElement &step, T *tool)
|
||||||
[](const QString &suffix) noexcept { return suffix.isEmpty(); });
|
[](const QString &suffix) noexcept { return suffix.isEmpty(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename T>
|
template <typename T> void VPatternRecipe::CutCurveAttributes(QDomElement &step, T *tool)
|
||||||
void VPatternRecipe::CutCurveAttributes(QDomElement &step, T *tool)
|
|
||||||
{
|
{
|
||||||
SetAttributeOrRemoveIf<QString>(step, AttrAlias1, tool->GetAliasSuffix1(),
|
SetAttributeOrRemoveIf<QString>(step, AttrAlias1, tool->GetAliasSuffix1(),
|
||||||
[](const QString &suffix) noexcept { return suffix.isEmpty(); });
|
[](const QString &suffix) noexcept { return suffix.isEmpty(); });
|
||||||
|
@ -1188,8 +1187,7 @@ void VPatternRecipe::CutCurveAttributes(QDomElement &step, T *tool)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename T>
|
template <typename T> inline void VPatternRecipe::ToolAttributes(QDomElement &step, T *tool)
|
||||||
inline void VPatternRecipe::ToolAttributes(QDomElement &step, T *tool)
|
|
||||||
{
|
{
|
||||||
SetAttribute(step, AttrType, T::ToolType);
|
SetAttribute(step, AttrType, T::ToolType);
|
||||||
SetAttribute(step, AttrLabel, tool->name());
|
SetAttribute(step, AttrLabel, tool->name());
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#ifndef LITERALS_H
|
#ifndef LITERALS_H
|
||||||
#define LITERALS_H
|
#define LITERALS_H
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QtCore/qcontainerfwd.h>
|
#include <QtCore/qcontainerfwd.h>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
|
|
@ -27,13 +27,12 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "tst_buitinregexp.h"
|
#include "tst_buitinregexp.h"
|
||||||
#include "../qmuparser/qmudef.h"
|
|
||||||
#include "../vpatterndb/vtranslatevars.h"
|
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../vmisc/literals.h"
|
#include "../vmisc/literals.h"
|
||||||
|
#include "../vpatterndb/vtranslatevars.h"
|
||||||
|
|
||||||
#include <QtTest>
|
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
#include <QtTest>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
TST_BuitInRegExp::TST_BuitInRegExp(const QString &locale, QObject *parent)
|
TST_BuitInRegExp::TST_BuitInRegExp(const QString &locale, QObject *parent)
|
||||||
|
@ -197,8 +196,8 @@ void TST_BuitInRegExp::TestCheckUnderlineExists()
|
||||||
const QString translated = m_trMs->InternalVarToUser(name);
|
const QString translated = m_trMs->InternalVarToUser(name);
|
||||||
if ((translated.right(1) == QLatin1String("_")) != exists)
|
if ((translated.right(1) == QLatin1String("_")) != exists)
|
||||||
{
|
{
|
||||||
const QString message = QString("String '%1' doesn't contain underline. Original string is '%2'")
|
const QString message =
|
||||||
.arg(translated, name);
|
QString("String '%1' doesn't contain underline. Original string is '%2'").arg(translated, name);
|
||||||
QFAIL(qUtf8Printable(message));
|
QFAIL(qUtf8Printable(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user