Backward compatibility for type qsizetype.

This commit is contained in:
Roman Telezhynskyi 2023-02-09 17:23:11 +02:00
parent af8505f468
commit 171b3be090
130 changed files with 641 additions and 546 deletions

View File

@ -136,7 +136,7 @@ void DialogPuzzlePreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -45,7 +45,8 @@
#endif
//---------------------------------------------------------------------------------------------------------------------
DialogSaveManualLayout::DialogSaveManualLayout(int count, bool consoleExport, const QString &fileName, QWidget *parent)
DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName,
QWidget *parent)
: VAbstractLayoutDialog(parent),
ui(new Ui::DialogSaveManualLayout),
m_count(count),

View File

@ -41,7 +41,7 @@ class DialogSaveManualLayout : public VAbstractLayoutDialog
Q_OBJECT // NOLINT
public:
explicit DialogSaveManualLayout(int count, bool consoleExport, const QString &fileName = QString(),
explicit DialogSaveManualLayout(vsizetype count, bool consoleExport, const QString &fileName = QString(),
QWidget *parent = nullptr);
~DialogSaveManualLayout() override;
@ -77,7 +77,7 @@ private:
// cppcheck-suppress unknownMacro
Q_DISABLE_COPY_MOVE(DialogSaveManualLayout) // NOLINT
Ui::DialogSaveManualLayout *ui;
int m_count;
vsizetype m_count;
bool m_isInitialized{false};
bool m_scaleConnected{true};
bool m_consoleExport;

View File

@ -41,7 +41,7 @@ auto CorrectedZValues(const QList<QVector<QString>> &order) -> QHash<QString, qr
qreal step = 0;
if (not order.isEmpty())
{
step = 1.0/order.size();
step = 1.0 / static_cast<int>(order.size());
}
for (int i = 0; i < order.size(); ++i)
@ -266,7 +266,7 @@ auto VPUndoPieceZValueMove::LevelStep(const QList<VPPiecePtr> &pieces) const ->
return 0;
}
return 1.0/levels.size();
return 1.0 / static_cast<int>(levels.size());
}
//---------------------------------------------------------------------------------------------------------------------
@ -509,5 +509,5 @@ auto VPUndoPiecesZValueMove::LevelStep(const QList<VPPiecePtr> &pieces) -> qreal
return 0;
}
return 1.0/levels.size();
return 1.0 / static_cast<int>(levels.size());
}

View File

@ -620,7 +620,7 @@ void VPApplication::SetPreferencesDialog(const QSharedPointer<DialogPuzzlePrefer
void VPApplication::Clean()
{
// cleanup any deleted main windows first
for (int i = m_mainWindows.count() - 1; i >= 0; --i)
for (vsizetype i = m_mainWindows.count() - 1; i >= 0; --i)
{
if (m_mainWindows.at(i).isNull())
{

View File

@ -39,7 +39,7 @@ std::shared_ptr<VPCommandLine> VPCommandLine::instance = nullptr; // NOLINT(cppc
auto VPCommandLine::IsExportEnabled() const -> bool
{
const bool result = IsOptionSet(LONG_OPTION_EXPORT_FILE);
int argSize = parser.positionalArguments().size();
auto argSize = parser.positionalArguments().size();
if (result && argSize != 1)
{
qCritical() << translate("Puzzle", "Export options can be used with single input file only.") << "/n";

View File

@ -1592,7 +1592,7 @@ void VPMainWindow::UpdateWindowTitle()
}
else
{
int index = VPApplication::VApp()->MainWindows().indexOf(this);
vsizetype index = VPApplication::VApp()->MainWindows().indexOf(this);
if (index != -1)
{
showName = tr("untitled %1.vlt").arg(index+1);
@ -1745,7 +1745,7 @@ void VPMainWindow::CreateWindowMenu(QMenu *menu)
VPMainWindow *window = windows.at(i);
QString title = QStringLiteral("%1. %2").arg(i+1).arg(window->windowTitle());
const int index = title.lastIndexOf(QLatin1String("[*]"));
const vsizetype index = title.lastIndexOf(QLatin1String("[*]"));
if (index != -1)
{
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
@ -2915,13 +2915,13 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
firstPageNumber = 0;
}
int lastPageNumber = printer->toPage() - 1;
vsizetype lastPageNumber = printer->toPage() - 1;
if (lastPageNumber == -1 || lastPageNumber >= sheets.count())
{
lastPageNumber = sheets.count() - 1;
}
const int numPages = lastPageNumber - firstPageNumber + 1;
const vsizetype numPages = lastPageNumber - firstPageNumber + 1;
int copyCount = 1;
if (not printer->supportsMultipleCopies())
{
@ -2946,7 +2946,8 @@ void VPMainWindow::PrintLayoutSheets(QPrinter *printer, const QList<VPSheetPtr>
{
for (int j = 0; j < numPages; ++j)
{
int index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
vsizetype index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j
: lastPageNumber - j;
const VPSheetPtr& sheet = sheets.at(index);
if (sheet.isNull())
@ -3013,13 +3014,13 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheet
firstPageNumber = 0;
}
int lastPageNumber = printer->toPage() - 1;
vsizetype lastPageNumber = printer->toPage() - 1;
if (lastPageNumber == -1 || lastPageNumber >= pages.count())
{
lastPageNumber = pages.count() - 1;
}
const int numPages = lastPageNumber - firstPageNumber + 1;
const vsizetype numPages = lastPageNumber - firstPageNumber + 1;
int copyCount = 1;
if (not printer->supportsMultipleCopies())
{
@ -3036,7 +3037,8 @@ void VPMainWindow::PrintLayoutTiledSheets(QPrinter *printer, const QList<VPSheet
{
for (int j = 0; j < numPages; ++j)
{
int index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j : lastPageNumber - j;
vsizetype index = printer->pageOrder() == QPrinter::FirstPageFirst ? firstPageNumber + j
: lastPageNumber - j;
const VPLayoutPrinterPage &page = pages.at(index);
if (not PrintLayoutTiledSheetPage(printer, painter, page, firstPage))
@ -3287,7 +3289,7 @@ void VPMainWindow::TranslatePieces()
}
//---------------------------------------------------------------------------------------------------------------------
void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, int selectedPiecesCount,
void VPMainWindow::TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, vsizetype selectedPiecesCount,
qreal dx, qreal dy)
{
if (not piece.isNull())

View File

@ -506,7 +506,7 @@ private:
auto AddLayoutPieces(const QVector<VLayoutPiece> &pieces) -> bool;
void TranslatePieces();
void TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, int selectedPiecesCount, qreal dx,
void TranslatePieceRelatively(const VPPiecePtr &piece, const QRectF &rect, vsizetype selectedPiecesCount, qreal dx,
qreal dy);
void RotatePieces();
};

View File

@ -69,7 +69,7 @@ void DialogDimensionCustomNames::InitTable(const QMap<MeasurementDimension, Meas
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(dimensions.size());
ui->tableWidget->setRowCount(static_cast<int>(dimensions.size()));
int row = 0;
QMap<MeasurementDimension, MeasurementDimension_p>::const_iterator i = dimensions.constBegin();

View File

@ -162,7 +162,7 @@ void DialogDimensionLabels::InitTable()
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setRowCount(bases.size());
ui->tableWidget->setRowCount(static_cast<int>(bases.size()));
const DimesionLabels labels = m_labels.value(type);

View File

@ -217,7 +217,7 @@ auto DialogMeasurementsCSVColumns::ColumnMandatory(int column) const -> bool
if (m_dimensions.size() > 1)
{
mandatory += qMin(m_dimensions.size(), 2);
mandatory += qMin(static_cast<int>(m_dimensions.size()), 2);
}
return static_cast<int>(column) < mandatory;
@ -315,7 +315,7 @@ auto DialogMeasurementsCSVColumns::MinimumColumns() const -> int
if (m_dimensions.size() > 1)
{
mandatory += qMin(m_dimensions.size(), 2);
mandatory += qMin(static_cast<int>(m_dimensions.size()), 2);
}
return mandatory;

View File

@ -523,7 +523,7 @@ void DialogRestrictDimension::InitTable()
{
MeasurementDimension_p dimension = m_dimensions.at(index);
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setRowCount(bases.size());
ui->tableWidget->setRowCount(static_cast<int>(bases.size()));
ui->tableWidget->setVerticalHeaderLabels(DimensionLabels(bases, dimension));
}
};
@ -534,7 +534,7 @@ void DialogRestrictDimension::InitTable()
{
MeasurementDimension_p dimension = m_dimensions.at(index);
const QVector<qreal> bases = dimension->ValidBases();
ui->tableWidget->setColumnCount(bases.size());
ui->tableWidget->setColumnCount(static_cast<int>(bases.size()));
ui->tableWidget->setHorizontalHeaderLabels(DimensionLabels(bases, dimension));
}
};

View File

@ -132,7 +132,7 @@ void DialogTapePreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -743,7 +743,7 @@ void MApplication::NewLocalSocketConnection()
void MApplication::Clean()
{
// cleanup any deleted main windows first
for (int i = m_mainWindows.count() - 1; i >= 0; --i)
for (vsizetype i = m_mainWindows.count() - 1; i >= 0; --i)
{
if (m_mainWindows.at(i).isNull())
{

View File

@ -1471,7 +1471,7 @@ void TMainWindow::AddKnown()
QScopedPointer<DialogMDataBase> dialog (new DialogMDataBase(m_m->ListKnown(), this));
if (dialog->exec() == QDialog::Accepted)
{
qint32 currentRow;
vsizetype currentRow;
const QStringList list = dialog->GetNewNames();
if (ui->tableWidget->currentRow() == -1)
@ -1514,7 +1514,7 @@ void TMainWindow::AddKnown()
RefreshData();
m_search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->selectRow(currentRow);
ui->tableWidget->selectRow(static_cast<int>(currentRow));
ui->actionExportToCSV->setEnabled(true);
@ -1596,7 +1596,7 @@ void TMainWindow::ImportFromPattern()
measurements = FilterMeasurements(measurements, m_m->ListAll());
qint32 currentRow;
vsizetype currentRow;
if (ui->tableWidget->currentRow() == -1)
{
@ -1622,7 +1622,7 @@ void TMainWindow::ImportFromPattern()
m_search->RefreshList(ui->lineEditFind->text());
ui->tableWidget->selectRow(currentRow);
ui->tableWidget->selectRow(static_cast<int>(currentRow));
MeasurementsWereSaved(false);
}
@ -3020,7 +3020,7 @@ void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString
SCASSERT(table != nullptr)
QString header = table->horizontalHeaderItem(column)->text();
const int index = header.indexOf(QLatin1String("("));
const auto index = header.indexOf(QLatin1String("("));
if (index != -1)
{
header.remove(index-1, 100);
@ -3187,7 +3187,7 @@ void TMainWindow::RefreshTable(bool freshCall)
const QMap<int, QSharedPointer<VMeasurement> > orderedTable = OrderedMeasurments();
qint32 currentRow = -1;
ui->tableWidget->setRowCount ( orderedTable.size() );
ui->tableWidget->setRowCount ( static_cast<int>(orderedTable.size()) );
for (auto iMap = orderedTable.constBegin(); iMap != orderedTable.constEnd(); ++iMap)
{
const QSharedPointer<VMeasurement> &meash = iMap.value();
@ -3432,7 +3432,7 @@ void TMainWindow::UpdateWindowTitle()
}
else
{
int index = MApplication::VApp()->MainWindows().indexOf(this);
auto index = MApplication::VApp()->MainWindows().indexOf(this);
if (index != -1)
{
showName = tr("untitled %1").arg(index+1);
@ -3483,7 +3483,7 @@ void TMainWindow::UpdateWindowTitle()
auto TMainWindow::ClearCustomName(const QString &name) -> QString
{
QString clear = name;
const int index = clear.indexOf(CustomMSign);
const auto index = clear.indexOf(CustomMSign);
if (index == 0)
{
clear.remove(0, 1);
@ -3798,7 +3798,7 @@ void TMainWindow::CreateWindowMenu(QMenu *menu)
TMainWindow *window = windows.at(i);
QString title = QStringLiteral("%1. %2").arg(i+1).arg(window->windowTitle());
const int index = title.lastIndexOf(QLatin1String("[*]"));
const auto index = title.lastIndexOf(QLatin1String("[*]"));
if (index != -1)
{
window->isWindowModified() ? title.replace(index, 3, QChar('*')) : title.replace(index, 3, QString());
@ -4093,11 +4093,11 @@ void TMainWindow::ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVec
}
//---------------------------------------------------------------------------------------------------------------------
auto TMainWindow::ImportMultisizeMeasurement(
const QxtCsvModel &csv, int i, const QVector<int> &map,int dimensionsCount,
auto TMainWindow::ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, const QVector<int> &map,
vsizetype dimensionsCount,
QSet<QString> &importedNames) -> TMainWindow::MultisizeMeasurement
{
const int nameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Name));
const auto nameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Name));
const QString name = csv.text(i, nameColumn).simplified();
if (name.isEmpty())
{
@ -4110,18 +4110,18 @@ auto TMainWindow::ImportMultisizeMeasurement(
importedNames.insert(mName);
measurement.name = mName;
const int baseValueColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
const auto baseValueColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::BaseValue));
measurement.base = ConverToDouble(csv.text(i, baseValueColumn),
tr("Cannot convert base value to double in column 2."));
const int shiftAColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
const auto shiftAColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftA));
measurement.shiftA = ConverToDouble(csv.text(i, shiftAColumn),
tr("Cannot convert shift value to double in column %1.")
.arg(shiftAColumn));
if (dimensionsCount > 1)
{
const int shiftBColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
const auto shiftBColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftB));
measurement.shiftB = ConverToDouble(csv.text(i, shiftBColumn),
tr("Cannot convert shift value to double in column %1.")
.arg(shiftBColumn));
@ -4129,7 +4129,7 @@ auto TMainWindow::ImportMultisizeMeasurement(
if (dimensionsCount > 2)
{
const int shiftCColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
const auto shiftCColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::ShiftC));
measurement.shiftC = ConverToDouble(csv.text(i, shiftCColumn),
tr("Cannot convert shift value to double in column %1.")
.arg(shiftCColumn));
@ -4139,7 +4139,7 @@ auto TMainWindow::ImportMultisizeMeasurement(
const bool custom = name.startsWith(CustomMSign);
if (columns > 4 && custom)
{
const int fullNameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::FullName));
const auto fullNameColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::FullName));
if (fullNameColumn >= 0)
{
measurement.fullName = csv.text(i, fullNameColumn).simplified();
@ -4148,7 +4148,7 @@ auto TMainWindow::ImportMultisizeMeasurement(
if (columns > 5 && custom)
{
const int descriptionColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Description));
const auto descriptionColumn = map.at(static_cast<int>(MultisizeMeasurementsColumns::Description));
if (descriptionColumn >= 0)
{
measurement.description = csv.text(i, descriptionColumn).simplified();

View File

@ -266,7 +266,7 @@ private:
void ImportIndividualMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader);
void ImportMultisizeMeasurements(const QxtCsvModel &csv, const QVector<int> &map, bool withHeader);
auto ImportMultisizeMeasurement(const QxtCsvModel &csv, int i, const QVector<int> &map,
int dimensionsCount, QSet<QString> &importedNames) -> MultisizeMeasurement;
vsizetype dimensionsCount, QSet<QString> &importedNames) -> MultisizeMeasurement;
void SetCurrentPatternUnit();

View File

@ -737,7 +737,7 @@ void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &pr
{
auto *lineTypeProperty = new VPE::VLineTypeProperty(propertyName);
lineTypeProperty->setStyles(styles);
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->getLineType());
if (index == -1)
{
qWarning()<<"Can't find line style" << i->getLineType()<<"in list";
@ -753,7 +753,7 @@ void VToolOptionsPropertyBrowser::AddPropertyCurvePenStyle(Tool *i, const QStrin
{
auto *penStyleProperty = new VPE::VLineTypeProperty(propertyName);
penStyleProperty->setStyles(styles);
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->GetPenStyle());
if (index == -1)
{
qWarning()<<"Can't find pen style" << i->getLineType()<<"in list";
@ -769,7 +769,7 @@ void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &p
{
auto *lineColorProperty = new VPE::VLineColorProperty(propertyName);
lineColorProperty->setColors(colors);
const qint32 index = VPE::VLineColorProperty::IndexOfColor(colors, i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(colors, i->GetLineColor());
if (index == -1)
{
qWarning()<<"Can't find line style" << i->GetLineColor()<<"in list";
@ -3348,12 +3348,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3379,12 +3379,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3423,12 +3423,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
m_idToProperty[AttrAngle2]->setValue(valueSecondAngle);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrColor]->setValue(index);
}
@ -3465,12 +3465,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength()
m_idToProperty[AttrLength]->setValue(valueLength);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrColor]->setValue(index);
}
@ -3499,12 +3499,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector()
m_idToProperty[AttrLength]->setValue(valueFormula);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3625,12 +3625,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3655,12 +3655,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLine()
auto *i = qgraphicsitem_cast<VToolLine *>(m_currentItem);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3715,12 +3715,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal()
m_idToProperty[AttrAngle]->setValue( i->GetAngle());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3899,12 +3899,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -3968,7 +3968,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
m_idToProperty[AttrLength2]->setValue(length2);
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -3992,7 +3992,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -4032,7 +4032,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -4056,7 +4056,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(CurvePenStylesPics(), i->GetPenStyle());
m_idToProperty[AttrPenStyle]->setValue(index);
}
@ -4105,12 +4105,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -4140,12 +4140,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis()
m_idToProperty[AttrName]->setValue(i->name());
{
const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
const auto index = VPE::VLineTypeProperty::IndexOfStyle(LineStylesPics(), i->getLineType());
m_idToProperty[AttrTypeLine]->setValue(index);
}
{
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrLineColor]->setValue(index);
}
@ -4264,7 +4264,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
valueFormulaRotationAngle.setValue(i->GetFormulaRotationAngle());
m_idToProperty[AttrRotationAngle]->setValue(valueFormulaRotationAngle);
const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
const auto index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
m_idToProperty[AttrColor]->setValue(index);
QVariant valueCenterPoint;

View File

@ -483,7 +483,7 @@ void DialogFinalMeasurements::FillFinalMeasurements(bool freshCall)
ui->tableWidget->blockSignals(true);
ui->tableWidget->clearContents();
ui->tableWidget->setRowCount(m_measurements.size());
ui->tableWidget->setRowCount(static_cast<int>(m_measurements.size()));
for (int i=0; i < m_measurements.size(); ++i)
{
const VFinalMeasurement &m = m_measurements.at(i);

View File

@ -177,7 +177,7 @@ void DialogHistory::FillTable()
QVector<VToolRecord> history = m_doc->getLocalHistory();
qint32 currentRow = -1;
qint32 count = 0;
ui->tableWidget->setRowCount(history.size());//Make row count max possible number
ui->tableWidget->setRowCount(static_cast<int>(history.size()));//Make row count max possible number
std::function<HistoryRecord (const VToolRecord &tool)> CreateRecord = [this](const VToolRecord &tool)
{

View File

@ -203,7 +203,7 @@ void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget
i.next();
qreal length = *i.value()->GetValue();
currentRow++;
table->setRowCount ( varTable.size() );
table->setRowCount ( static_cast<int>(varTable.size()) );
auto *item = new QTableWidgetItem(i.key());
item->setTextAlignment(Qt::AlignLeft);
@ -349,7 +349,7 @@ auto DialogIncrements::GetCustomName() const -> QString
auto DialogIncrements::ClearIncrementName(const QString &name) -> QString
{
QString clear = name;
const int index = clear.indexOf(CustomIncrSign);
const auto index = clear.indexOf(CustomIncrSign);
if (index == 0)
{
clear.remove(0, 1);
@ -1315,7 +1315,7 @@ void DialogIncrements::FillIncrementsTable(QTableWidget *table,
qint32 currentRow = -1;
QMapIterator<quint32, QString> iMap(map);
table->setRowCount ( map.size() );
table->setRowCount ( static_cast<int>(map.size()) );
while (iMap.hasNext())
{
iMap.next();

View File

@ -148,7 +148,7 @@ void DialogPreferences::Apply()
if (not preferences.isEmpty())
{
const QString text = tr("Followed %n option(s) require restart to take effect: %1.", "",
preferences.size()).arg(preferences.join(QStringLiteral(", ")));
static_cast<int>(preferences.size())).arg(preferences.join(QStringLiteral(", ")));
QMessageBox::information(this, QCoreApplication::applicationName(), text);
}

View File

@ -732,7 +732,7 @@ void VWidgetBackgroundImages::FillTable(const QVector<VBackgroundPatternImage> &
ui->tableWidget->clear();
ui->tableWidget->setColumnCount(3);
ui->tableWidget->setRowCount(images.size());
ui->tableWidget->setRowCount(static_cast<int>(images.size()));
qint32 currentRow = -1;
auto ReadOnly = [](QTableWidgetItem *item)

View File

@ -173,7 +173,7 @@ void VWidgetDetails::FillTable(const QHash<quint32, VPiece> *details)
ui->tableWidget->clearContents();
ui->tableWidget->setColumnCount(2);
ui->tableWidget->setRowCount(details->size());
ui->tableWidget->setRowCount(static_cast<int>(details->size()));
qint32 currentRow = -1;
auto i = details->constBegin();
while (i != details->constEnd())

View File

@ -338,7 +338,7 @@ void VWidgetGroups::FillTable(QMap<quint32, VGroupData> groups)
ui->tableWidget->clear();
ui->tableWidget->setColumnCount(2);
ui->tableWidget->setRowCount(groups.size());
ui->tableWidget->setRowCount(static_cast<int>(groups.size()));
qint32 currentRow = -1;
auto i = groups.constBegin();
while (i != groups.constEnd())

View File

@ -6202,7 +6202,8 @@ void MainWindow::ExportLayoutAs()
try
{
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(
new DialogSaveLayout(m_layoutSettings->LayoutScenes().size(), Draw::Layout, FileName(), this));
new DialogSaveLayout(static_cast<int>(m_layoutSettings->LayoutScenes().size()), Draw::Layout, FileName(),
this));
if (m_dialogSaveLayout->exec() == QDialog::Rejected)
{
@ -6615,7 +6616,7 @@ auto MainWindow::DoExport(const VCommandLinePtr &expParams) -> bool
try
{
m_dialogSaveLayout = QSharedPointer<DialogSaveLayout>(
new DialogSaveLayout(m_layoutSettings->LayoutScenes().size(),
new DialogSaveLayout(static_cast<int>(m_layoutSettings->LayoutScenes().size()),
Draw::Layout, expParams->OptBaseName(), this));
m_dialogSaveLayout->SetDestinationPath(expParams->OptDestinationPath());
m_dialogSaveLayout->SelectFormat(static_cast<LayoutExportFormats>(expParams->OptExportType()));

View File

@ -249,7 +249,7 @@ bool MainWindowsNoGUI::GenerateLayout(VLayoutGenerator& lGenerator)
int rotatate = 1;
lGenerator.SetShift(-1); // Trigger first shift calulation
lGenerator.SetRotate(false);
int papersCount = INT_MAX;
vsizetype papersCount = INT_MAX;
qreal efficiency = 0;
bool hasResult = false;
@ -913,7 +913,7 @@ QVector<VLayoutPiece> MainWindowsNoGUI::PrepareDetailsForLayout(const QVector<De
return VLayoutPiece::Create(data.piece, data.id, tool->getData());
};
QProgressDialog progress(tr("Preparing details for layout"), QString(), 0, details.size());
QProgressDialog progress(tr("Preparing details for layout"), QString(), 0, static_cast<int>(details.size()));
progress.setWindowModality(Qt::ApplicationModal);
QFutureWatcher<VLayoutPiece> futureWatcher;

View File

@ -1537,7 +1537,7 @@ QString VPattern::GetLabelBase(quint32 index) const
QString base;
const int count = qFloor(index/static_cast<quint32>(alphabet.size()));
const int number = static_cast<int>(index) - alphabet.size() * count;
const int number = static_cast<int>(index) - static_cast<int>(alphabet.size()) * count;
int i = 0;
do
{
@ -4229,13 +4229,13 @@ void VPattern::SetIncrementSpecialUnits(const QString &name, bool special)
//---------------------------------------------------------------------------------------------------------------------
void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const QString &name, const QString &newName)
{
const int bias = name.length() - newName.length();
const auto bias = name.length() - newName.length();
for(int i = 0; i < expressions.size(); ++i)
{
if (expressions.at(i).expression.indexOf(name) != -1)
{
QMap<int, QString> tokens;
QMap<vsizetype, QString> tokens;
// Eval formula
try
@ -4256,7 +4256,7 @@ void VPattern::ReplaceNameInFormula(QVector<VFormulaField> &expressions, const Q
continue;
}
QList<int> tKeys = tokens.keys();// Take all tokens positions
QList<vsizetype> tKeys = tokens.keys();// Take all tokens positions
QString newFormula = expressions.at(i).expression;
for (int i = 0; i < tKeys.size(); ++i)

View File

@ -175,15 +175,16 @@ void VAbstractConverter::ReserveFile() const
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::Replace(QString &formula, const QString &newName, int position, const QString &token,
int &bias) const
void VAbstractConverter::Replace(QString &formula, const QString &newName, vsizetype position, const QString &token,
vsizetype &bias) const
{
formula.replace(position, token.length(), newName);
bias = token.length() - newName.length();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens) const
void VAbstractConverter::CorrectionsPositions(vsizetype position, vsizetype bias,
QMap<vsizetype, QString> &tokens) const
{
if (bias == 0)
{
@ -194,10 +195,10 @@ void VAbstractConverter::CorrectionsPositions(int position, int bias, QMap<int,
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractConverter::BiasTokens(int position, int bias, QMap<int, QString> &tokens)
void VAbstractConverter::BiasTokens(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens)
{
QMap<int, QString> newTokens;
QMap<int, QString>::const_iterator i = tokens.constBegin();
QMap<vsizetype, QString> newTokens;
QMap<vsizetype, QString>::const_iterator i = tokens.constBegin();
while (i != tokens.constEnd())
{
if (i.key()<= position)

View File

@ -75,9 +75,10 @@ protected:
virtual bool IsReadOnly() const =0;
void Replace(QString &formula, const QString &newName, int position, const QString &token, int &bias) const;
void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens) const;
static void BiasTokens(int position, int bias, QMap<int, QString> &tokens);
void Replace(QString &formula, const QString &newName, vsizetype position, const QString &token,
vsizetype &bias) const;
void CorrectionsPositions(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens) const;
static void BiasTokens(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens);
void ValidateXML(const QString &schema) const;

View File

@ -1658,7 +1658,7 @@ auto VAbstractPattern::CheckTagExists(const QString &tag) -> QDomElement
void VAbstractPattern::InsertTag(const QStringList &tags, const QDomElement &element)
{
QDomElement pattern = documentElement();
for (int i = tags.indexOf(element.tagName())-1; i >= 0; --i)
for (vsizetype i = tags.indexOf(element.tagName())-1; i >= 0; --i)
{
const QDomNodeList list = elementsByTagName(tags.at(i));
if (not list.isEmpty())

View File

@ -1001,10 +1001,10 @@ QString VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formul
"Time to refactor the code.");
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula, false, false));// Eval formula
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
QMap<vsizetype, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
delete cal.take();
QList<int> tKeys = tokens.keys();// Take all tokens positions
QList<vsizetype> tKeys = tokens.keys();// Take all tokens positions
QList<QString> tValues = tokens.values();
QString newFormula = formula;// Local copy for making changes
@ -1015,7 +1015,7 @@ QString VPatternConverter::FixMeasurementInFormulaToV0_2_0(const QString &formul
continue;
}
int bias = 0;
vsizetype bias = 0;
Replace(newFormula, names.value(tValues.at(i)), tKeys.at(i), tValues.at(i), bias);
if (bias != 0)
{// Translated token has different length than original. Position next tokens need to be corrected.
@ -1035,21 +1035,21 @@ QString VPatternConverter::FixIncrementInFormulaToV0_2_0(const QString &formula,
"Time to refactor the code.");
qmu::QmuTokenParser *cal = new qmu::QmuTokenParser(formula, false, false);// Eval formula
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
QMap<vsizetype, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
delete cal;
QList<int> tKeys = tokens.keys();// Take all tokens positions
QList<vsizetype> tKeys = tokens.keys();// Take all tokens positions
QList<QString> tValues = tokens.values();
QString newFormula = formula;// Local copy for making changes
for (int i = 0; i < tValues.size(); ++i)
for (vsizetype i = 0; i < tValues.size(); ++i)
{
if (not names.contains(tValues.at(i)))
{
continue;
}
int bias = 0;
vsizetype bias = 0;
Replace(newFormula, "#"+tValues.at(i), tKeys.at(i), tValues.at(i), bias);
if (bias != 0)
{// Translated token has different length than original. Position next tokens need to be corrected.
@ -1870,7 +1870,7 @@ QDomElement VPatternConverter::AddTagPatternLabelV0_5_1()
QDomElement element = createElement(*strPatternLabel);
QDomElement pattern = documentElement();
for (int i = tags.indexOf(element.tagName())-1; i >= 0; --i)
for (vsizetype i = tags.indexOf(element.tagName())-1; i >= 0; --i)
{
const QDomNodeList list = elementsByTagName(tags.at(i));
if (not list.isEmpty())

View File

@ -167,7 +167,8 @@ static int CheckChar(QChar &c, const QLocale &locale, const QChar &decimal, cons
}
//---------------------------------------------------------------------------------------------------------------------
int ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal, const QChar &thousand)
qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal,
const QChar &thousand)
{
// Must not be equal
if (decimal == thousand || formula.isEmpty())
@ -335,9 +336,9 @@ QString NameRegExp()
}
//---------------------------------------------------------------------------------------------------------------------
int FindFirstNotOf(const QString &string, const QString &chars, int pos)
qmusizetype FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos)
{
int chPos = pos;
qmusizetype chPos = pos;
QString::const_iterator it = string.constBegin() + pos;
QString::const_iterator end = string.constEnd();
while (it != end)

View File

@ -144,9 +144,9 @@ static inline bool QmuFuzzyComparePossibleNulls(double p1, double p2)
}
}
QMUPARSERSHARED_EXPORT int ReadVal(const QString &formula, qreal &val, const QLocale &locale, const QChar &decimal,
const QChar &thousand);
QMUPARSERSHARED_EXPORT qmusizetype ReadVal(const QString &formula, qreal &val, const QLocale &locale,
const QChar &decimal, const QChar &thousand);
QMUPARSERSHARED_EXPORT int FindFirstNotOf(const QString &string, const QString &chars, int pos = 0);
QMUPARSERSHARED_EXPORT qmusizetype FindFirstNotOf(const QString &string, const QString &chars, qmusizetype pos = 0);
#endif // QMUDEF_H

View File

@ -177,9 +177,9 @@ void QmuFormulaBase::SetSepForEval()
* @param map map with tokens
* @param val token that need delete
*/
void QmuFormulaBase::RemoveAll(QMap<int, QString> &map, const QString &val)
void QmuFormulaBase::RemoveAll(QMap<vsizetype, QString> &map, const QString &val)
{
const QList<int> listKeys = map.keys(val);//Take all keys that contain token.
const QList<vsizetype> listKeys = map.keys(val);//Take all keys that contain token.
for (auto key : listKeys)
{
map.remove(key);

View File

@ -45,7 +45,7 @@ public:
void SetSepForTr(bool osSeparator, bool fromUser);
static void RemoveAll(QMap<int, QString> &map, const QString &val);
static void RemoveAll(QMap<vsizetype, QString> &map, const QString &val);
protected:
static qreal* AddVariable(const QString &a_szName, void *a_pUserData);

View File

@ -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, int a_iArgc)
qreal QmuParser::Sum(const qreal *a_afArg, qmusizetype a_iArgc)
{
if (a_iArgc == 0)
{
@ -320,7 +320,7 @@ qreal QmuParser::Sum(const qreal *a_afArg, int 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, int a_iArgc)
qreal QmuParser::Avg(const qreal *a_afArg, qmusizetype a_iArgc)
{
if (a_iArgc == 0)
{
@ -341,7 +341,7 @@ qreal QmuParser::Avg(const qreal *a_afArg, int 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, int a_iArgc)
qreal QmuParser::Min(const qreal *a_afArg, qmusizetype a_iArgc)
{
if (a_iArgc == 0)
{
@ -362,7 +362,7 @@ qreal QmuParser::Min(const qreal *a_afArg, int 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, int a_iArgc)
qreal QmuParser::Max(const qreal *a_afArg, qmusizetype a_iArgc)
{
if (a_iArgc == 0)
{
@ -385,12 +385,13 @@ qreal QmuParser::Max(const qreal *a_afArg, int 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, int *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
int QmuParser::IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand)
{
qreal fVal(0);
int pos = ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal, thousand);
qmusizetype pos = ReadVal(a_szExpr, fVal, locale != QLocale::c() && cNumbers ? QLocale::c() : locale, decimal,
thousand);
if (pos == -1)
{
@ -510,7 +511,7 @@ void QmuParser::InitOprt()
}
//---------------------------------------------------------------------------------------------------------------------
void QmuParser::OnDetectVar(const QString &pExpr, int &nStart, int &nEnd)
void QmuParser::OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd)
{
Q_UNUSED(pExpr)
Q_UNUSED(nStart)

View File

@ -58,11 +58,11 @@ namespace qmu
virtual void InitFun() override;
virtual void InitConst() override;
virtual void InitOprt() override;
virtual void OnDetectVar(const QString &pExpr, int &nStart, int &nEnd) override;
virtual void OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd) override;
qreal Diff(qreal *a_Var, qreal a_fPos, qreal a_fEpsilon = 0) const;
protected:
static int IsVal(const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand);
static int IsVal(const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand);
// hyperbolic functions
static qreal Sinh(qreal);
static qreal Cosh(qreal);
@ -96,10 +96,10 @@ namespace qmu
// !!! Unary Minus is a MUST if you want to use negative signs !!!
static qreal UnaryMinus(qreal v);
// Functions with variable number of arguments
static qreal Sum(const qreal*, int); // sum
static qreal Avg(const qreal*, int); // mean value
static qreal Min(const qreal*, int); // minimum
static qreal Max(const qreal*, int); // maximum
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
};
QT_WARNING_POP

View File

@ -85,8 +85,8 @@ QmuParserBase::QmuParserBase()
m_nIfElseCounter(0),
m_vStackBuffer(),
m_nFinalResultIdx(0),
m_Tokens(QMap<int, QString>()),
m_Numbers(QMap<int, QString>()),
m_Tokens(QMap<qmusizetype, QString>()),
m_Numbers(QMap<qmusizetype, QString>()),
allowSubexpressions(true)
{
InitTokenReader();
@ -121,8 +121,8 @@ QmuParserBase::QmuParserBase(const QmuParserBase &a_Parser)
m_nIfElseCounter(0),
m_vStackBuffer(),
m_nFinalResultIdx(0),
m_Tokens(QMap<int, QString>()),
m_Numbers(QMap<int, QString>()),
m_Tokens(QMap<qmusizetype, QString>()),
m_Numbers(QMap<qmusizetype, QString>()),
allowSubexpressions(true)
{
m_pTokenReader.reset(new token_reader_type(this));
@ -229,7 +229,7 @@ void QmuParserBase::ReInit() const
}
//---------------------------------------------------------------------------------------------------------------------
void QmuParserBase::OnDetectVar(const QString &pExpr, int &nStart, int &nEnd)
void QmuParserBase::OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd)
{
Q_UNUSED(pExpr)
Q_UNUSED(nStart)
@ -1023,7 +1023,7 @@ qreal QmuParserBase::ParseCmdCodeBulk(int nOffset, int nThreadID) const
qreal *Stack = ((nOffset==0) && (nThreadID==0)) ? &m_vStackBuffer[0] : &m_vStackBuffer[nThreadID *
(m_vStackBuffer.size() / s_MaxNumOpenMPThreads)];
qreal buf;
int sidx(0);
qmusizetype sidx(0);
for (const SToken *pTok = m_vRPN.GetBase(); pTok->Cmd!=cmEND ; ++pTok)
{
switch (pTok->Cmd)
@ -1143,7 +1143,7 @@ QT_WARNING_POP
// Next is treatment of numeric functions
case cmFUNC:
{
int iArgCount = pTok->Fun.argc;
qmusizetype iArgCount = pTok->Fun.argc;
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wcast-function-type")
@ -1224,7 +1224,7 @@ QT_WARNING_DISABLE_MSVC(4191)
sidx -= pTok->Fun.argc -1;
// The index of the string argument in the string table
int iIdxStack = pTok->Fun.idx;
qmusizetype iIdxStack = pTok->Fun.idx;
Q_ASSERT( iIdxStack>=0 && iIdxStack<m_vStringBuf.size() );
switch (pTok->Fun.argc) // switch according to argument count
@ -1248,7 +1248,7 @@ QT_WARNING_DISABLE_MSVC(4191)
}
case cmFUNC_BULK:
{
int iArgCount = pTok->Fun.argc;
qmusizetype iArgCount = pTok->Fun.argc;
// switch according to argument count
switch (iArgCount)
@ -1648,7 +1648,7 @@ qreal QmuParserBase::ParseString() const
* @param a_sTok [in] The token string representation associated with the error.
* @throw ParserException always throws thats the only purpose of this function.
*/
void Q_NORETURN QmuParserBase::Error(EErrorCodes a_iErrc, int a_iPos, const QString &a_sTok) const
void Q_NORETURN QmuParserBase::Error(EErrorCodes a_iErrc, qmusizetype a_iPos, const QString &a_sTok) const
{
throw qmu::QmuParserError (a_iErrc, a_sTok, m_pTokenReader->GetExpr(), a_iPos);
}

View File

@ -111,8 +111,8 @@ public:
const funmap_type& GetFunDef() const;
static QString GetVersion(EParserVersionInfo eInfo = pviFULL);
static const QStringList& GetOprtDef();
QMap<int, QString> GetTokens() const;
QMap<int, QString> GetNumbers() const;
QMap<qmusizetype, QString> GetTokens() const;
QMap<qmusizetype, QString> GetNumbers() const;
void DefineNameChars(const QString &a_szCharset);
void DefineOprtChars(const QString &a_szCharset);
void DefineInfixOprtChars(const QString &a_szCharset);
@ -121,7 +121,7 @@ public:
const QString& ValidInfixOprtChars() const;
void SetArgSep(char_type cArgSep);
QChar GetArgSep() const;
void Q_NORETURN Error(EErrorCodes a_iErrc, int a_iPos = -1, const QString &a_sTok = QString() ) const;
void Q_NORETURN Error(EErrorCodes a_iErrc, qmusizetype a_iPos = -1, const QString &a_sTok = QString() ) const;
template<typename T>
void DefineFun(const QString &a_strName, T a_pFun, bool a_bAllowOpt = true);
@ -162,7 +162,7 @@ protected:
virtual void InitFun() = 0;
virtual void InitConst() = 0;
virtual void InitOprt() = 0;
virtual void OnDetectVar(const QString &pExpr, int &nStart, int &nEnd);
virtual void OnDetectVar(const QString &pExpr, qmusizetype &nStart, qmusizetype &nEnd);
/**
* @brief A facet class used to change decimal and thousands separator.
*/
@ -256,8 +256,8 @@ private:
// items merely used for caching state information
mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine
mutable int m_nFinalResultIdx;
mutable QMap<int, QString> m_Tokens;///< Keep all tokens that we can translate
mutable QMap<int, QString> m_Numbers;///< Keep all numbers what exist in formula
mutable QMap<qmusizetype, QString> m_Tokens;///< Keep all tokens that we can translate
mutable QMap<qmusizetype, QString> m_Numbers;///< Keep all numbers what exist in formula
bool allowSubexpressions;
@ -337,13 +337,13 @@ inline const QStringList &QmuParserBase::GetOprtDef()
}
//---------------------------------------------------------------------------------------------------------------------
inline QMap<int, QString> QmuParserBase::GetTokens() const
inline QMap<qmusizetype, QString> QmuParserBase::GetTokens() const
{
return m_Tokens;
}
//---------------------------------------------------------------------------------------------------------------------
inline QMap<int, QString> QmuParserBase::GetNumbers() const
inline QMap<qmusizetype, QString> QmuParserBase::GetNumbers() const
{
return m_Numbers;
}

View File

@ -139,7 +139,7 @@ void QmuParserByteCode::AddVal(qreal a_fVal)
//---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::ConstantFolding(ECmdCode a_Oprt)
{
int sz = m_vRPN.size();
qmusizetype sz = m_vRPN.size();
qreal &x = m_vRPN[sz-2].Val.data2,
&y = m_vRPN[sz-1].Val.data2;
switch (a_Oprt)
@ -216,7 +216,7 @@ void QmuParserByteCode::ConstantFolding(ECmdCode a_Oprt)
}
//---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::OpPOW(int sz, bool &bOptimized)
void QmuParserByteCode::OpPOW(qmusizetype sz, bool &bOptimized)
{
if (m_vRPN.at(sz-2).Cmd == cmVAR && m_vRPN.at(sz-1).Cmd == cmVAL) //-V807
{
@ -242,7 +242,7 @@ void QmuParserByteCode::OpPOW(int sz, bool &bOptimized)
}
//---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::OpSUBADD(ECmdCode a_Oprt, int sz, bool &bOptimized)
void QmuParserByteCode::OpSUBADD(ECmdCode a_Oprt, qmusizetype sz, bool &bOptimized)
{
if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) ||
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) ||
@ -273,7 +273,7 @@ void QmuParserByteCode::OpSUBADD(ECmdCode a_Oprt, int sz, bool &bOptimized)
}
//---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::OpMUL(int sz, bool &bOptimized)
void QmuParserByteCode::OpMUL(qmusizetype sz, bool &bOptimized)
{
if ( (m_vRPN.at(sz-1).Cmd == cmVAR && m_vRPN.at(sz-2).Cmd == cmVAL) ||
(m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVAR) )
@ -319,7 +319,7 @@ void QmuParserByteCode::OpMUL(int sz, bool &bOptimized)
}
//---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::OpDIV(int sz, bool &bOptimized)
void QmuParserByteCode::OpDIV(qmusizetype sz, bool &bOptimized)
{
if (m_vRPN.at(sz-1).Cmd == cmVAL && m_vRPN.at(sz-2).Cmd == cmVARMUL &&
not qFuzzyIsNull(m_vRPN.at(sz-1).Val.data2))
@ -370,7 +370,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
return;
}
int sz = m_vRPN.size();
qmusizetype sz = m_vRPN.size();
// Check for foldable constants like:
// cmVAL cmVAL cmADD
@ -477,7 +477,7 @@ void QmuParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc)
* @param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
* @param a_pFun Pointer to function callback.
*/
void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc)
void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, qmusizetype a_iArgc)
{
m_iStackPos = static_cast<quint32>(static_cast<int>(m_iStackPos) - a_iArgc + 1);
m_iMaxStackSize = qMax(m_iMaxStackSize, m_iStackPos);
@ -497,7 +497,7 @@ void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc)
* A string function entry consists of the stack position of the return value, followed by a cmSTRFUNC code, the
* function pointer and an index into the string buffer maintained by the parser.
*/
void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx)
void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, qmusizetype a_iIdx)
{
m_iStackPos = static_cast<quint32>(static_cast<int>(m_iStackPos) - a_iArgc + 1);

View File

@ -58,8 +58,8 @@ struct SToken
// pointer due to constraints in the ANSI standard which allows
// data pointers and function pointers to differ in size.
generic_fun_type ptr;
int argc;
int idx;
qmusizetype argc;
qmusizetype idx;
} Fun;
struct //SOprtData
@ -98,13 +98,13 @@ public:
void AddIfElse(ECmdCode a_Oprt);
void AddAssignOp(qreal *a_pVar);
void AddFun(generic_fun_type a_pFun, int a_iArgc);
void AddBulkFun(generic_fun_type a_pFun, int a_iArgc);
void AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx);
void AddBulkFun(generic_fun_type a_pFun, qmusizetype a_iArgc);
void AddStrFun(generic_fun_type a_pFun, int a_iArgc, qmusizetype a_iIdx);
void EnableOptimizer(bool bStat);
void Finalize();
void clear();
auto GetMaxStackSize() const -> int;
auto GetSize() const -> int;
auto GetSize() const -> qmusizetype;
auto GetBase() const -> const SToken*;
void AsciiDump();
private:
@ -127,10 +127,10 @@ private:
void ConstantFolding(ECmdCode a_Oprt);
void OpPOW(int sz, bool &bOptimized);
void OpSUBADD(ECmdCode a_Oprt, int sz, bool &bOptimized);
void OpMUL(int sz, bool &bOptimized);
void OpDIV(int sz, bool &bOptimized);
void OpPOW(qmusizetype sz, bool &bOptimized);
void OpSUBADD(ECmdCode a_Oprt, qmusizetype sz, bool &bOptimized);
void OpMUL(qmusizetype sz, bool &bOptimized);
void OpDIV(qmusizetype sz, bool &bOptimized);
};
//---------------------------------------------------------------------------------------------------------------------
@ -150,7 +150,7 @@ inline auto QmuParserByteCode::GetMaxStackSize() const -> int
* @brief Returns the number of entries in the bytecode.
*/
// cppcheck-suppress unusedFunction
inline auto QmuParserByteCode::GetSize() const -> int
inline auto QmuParserByteCode::GetSize() const -> qmusizetype
{
return m_vRPN.size();
}

View File

@ -26,6 +26,7 @@
#include <QString>
#include <locale>
#include <ciso646>
#include <QtGlobal>
#include "qmuparserfixes.h"
@ -99,6 +100,12 @@
class QLocale;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
using qmusizetype = qsizetype;
#else
using qmusizetype = int;
#endif
namespace qmu
{
//------------------------------------------------------------------------------
@ -224,7 +231,7 @@ typedef std::map<QString, qreal*> varmap_type;
typedef std::map<QString, qreal> valmap_type;
/** @brief Type for assigning a string name to an index in the internal string table. */
typedef std::map<QString, int> strmap_type;
typedef std::map<QString, qmusizetype> strmap_type;
// Parser callbacks
@ -298,7 +305,7 @@ typedef qreal ( *bulkfun_type9 ) ( int, int, qreal, qreal, qreal, qreal, qreal,
typedef qreal ( *bulkfun_type10 ) ( int, int, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal, qreal );
/** @brief Callback type used for functions with a variable argument list. */
typedef qreal ( *multfun_type ) ( const qreal*, int );
typedef qreal ( *multfun_type ) ( const qreal*, qmusizetype );
/** @brief Callback type used for functions taking a string as an argument. */
typedef qreal ( *strfun_type1 ) ( const QString & );
@ -310,8 +317,8 @@ typedef qreal ( *strfun_type2 ) ( const QString &, qreal );
typedef qreal ( *strfun_type3 ) ( const QString &, qreal, qreal );
/** @brief Callback used for functions that identify values in a string. */
typedef int ( *identfun_type ) ( const QString &sExpr, int *nPos, qreal *fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand );
typedef int ( *identfun_type ) ( const QString &sExpr, qmusizetype *nPos, qreal *fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand );
/** @brief Callback used for variable creation factory functions. */
typedef qreal* ( *facfun_type ) ( const QString &, void* );

View File

@ -203,7 +203,7 @@ QmuParserError::QmuParserError ( const QString &sMsg )
* @param [in] sExpr The expression related to the error.
* @param [in] iPos the position in the expression where the error occured.
*/
QmuParserError::QmuParserError ( EErrorCodes iErrc, const QString &sTok, const QString &sExpr, int 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 ),
m_ErrMsg ( QmuParserErrorMsg::Instance() )
{

View File

@ -170,7 +170,7 @@ public:
QmuParserError();
explicit QmuParserError ( EErrorCodes a_iErrc );
explicit QmuParserError ( const QString &sMsg );
QmuParserError ( EErrorCodes a_iErrc, const QString &sTok, const QString &sFormula = QString(), int a_iPos = -1 );
QmuParserError ( EErrorCodes a_iErrc, const QString &sTok, const QString &sFormula = QString(), qmusizetype a_iPos = -1 );
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 );
@ -180,7 +180,7 @@ public:
void SetFormula ( const QString &a_strFormula );
const QString& GetExpr() const;
const QString& GetMsg() const;
int GetPos() const;
qmusizetype GetPos() const;
const QString& GetToken() const;
EErrorCodes GetCode() const;
Q_NORETURN virtual void raise() const override;
@ -189,7 +189,7 @@ private:
QString m_sMsg; ///< The message string
QString m_sExpr; ///< Formula string
QString m_sTok; ///< Token related with the error
int m_iPos; ///< Formula position related to the error
qmusizetype m_iPos; ///< Formula position related to the error
EErrorCodes m_iErrc; ///< Error code
const QmuParserErrorMsg &m_ErrMsg;
void Reset();
@ -228,7 +228,7 @@ inline const QString& QmuParserError::GetMsg() const
*
* If the error is not related to a distinct position this will return -1
*/
inline int QmuParserError::GetPos() const
inline qmusizetype QmuParserError::GetPos() const
{
return m_iPos;
}

View File

@ -74,7 +74,7 @@ QmuParserTester::QmuParserTester(QObject *parent)
}
//---------------------------------------------------------------------------------------------------------------------
int QmuParserTester::IsHexVal ( const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale,
int QmuParserTester::IsHexVal ( const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand )
{
Q_UNUSED(locale)
@ -102,7 +102,7 @@ int QmuParserTester::IsHexVal ( const QString &a_szExpr, int *a_iPos, qreal *a_f
return 1;
}
*a_iPos += static_cast<int>(2 + nPos);
*a_iPos += static_cast<qmusizetype>(2 + nPos);
*a_fVal = static_cast<qreal>(iVal);
return 1;
}

View File

@ -201,7 +201,7 @@ private:
return static_cast<int>( v1 ) & static_cast<int>( v2 );
}
static qreal FirstArg ( const qreal* a_afArg, int a_iArgc )
static qreal FirstArg ( const qreal* a_afArg, qmusizetype a_iArgc )
{
if ( a_iArgc == 0)
{
@ -211,7 +211,7 @@ private:
return a_afArg[0];
}
static qreal LastArg ( const qreal* a_afArg, int a_iArgc )
static qreal LastArg ( const qreal* a_afArg, qmusizetype a_iArgc )
{
if ( a_iArgc == 0)
{
@ -221,7 +221,7 @@ private:
return a_afArg[a_iArgc - 1];
}
static qreal Sum ( const qreal* a_afArg, int a_iArgc )
static qreal Sum ( const qreal* a_afArg, qmusizetype a_iArgc )
{
if ( a_iArgc == 0)
{
@ -307,8 +307,8 @@ private:
}
// Custom value recognition
static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale, bool cNumbers,
const QChar &decimal, const QChar &thousand);
static int IsHexVal (const QString &a_szExpr, qmusizetype *a_iPos, qreal *a_fVal, const QLocale &locale,
bool cNumbers, const QChar &decimal, const QChar &thousand);
int TestNames();
int TestSyntax();

View File

@ -215,7 +215,7 @@ public:
* Member variables not necessary for variable tokens will be invalidated.
* @throw nothrow
*/
auto SetString ( const TString &a_strTok, int a_iSize ) -> QmuParserToken&
auto SetString ( const TString &a_strTok, qmusizetype a_iSize ) -> QmuParserToken&
{
m_iCode = cmSTRING;
m_iType = tpSTR;
@ -235,7 +235,7 @@ public:
* @param a_iIdx The index the string function result will take in the bytecode parser.
* @throw QmuParserError if #a_iIdx<0 or #m_iType!=cmSTRING
*/
void SetIdx ( int a_iIdx )
void SetIdx ( qmusizetype a_iIdx )
{
if ( m_iCode != cmSTRING || a_iIdx < 0 )
{
@ -254,7 +254,7 @@ public:
* @throw QmuParserError if #m_iIdx<0 or #m_iType!=cmSTRING
* @return The index the result will take in the Bytecode calculatin array (#m_iIdx).
*/
auto GetIdx() const -> int
auto GetIdx() const -> qmusizetype
{
if ( m_iIdx < 0 || m_iCode != cmSTRING )
{
@ -465,7 +465,7 @@ private:
ECmdCode m_iCode{cmUNKNOWN}; ///< Type of the token; The token type is a constant of type #ECmdCode.
ETypeCode m_iType{tpVOID};
void *m_pTok{nullptr}; ///< Stores Token pointer; not applicable for all tokens
int m_iIdx{-1}; ///< An otional index to an external buffer storing the token data
qmusizetype m_iIdx{-1}; ///< An otional index to an external buffer storing the token data
TString m_strTok{}; ///< Token string
TString m_strVal{}; ///< Value for string variables
qreal m_fVal{}; ///< the value

View File

@ -283,7 +283,7 @@ auto QmuParserTokenReader::ReadNextToken(const QLocale &locale, bool cNumbers, c
// !!! From this point on there is no exit without an exception possible...
//
QString strTok;
int iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
if ( iEnd != m_iPos )
{
Error ( ecUNASSIGNABLE_TOKEN, m_iPos, strTok );
@ -318,9 +318,10 @@ void QmuParserTokenReader::SetParent ( QmuParserBase *a_pParent )
*/
QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4309)
auto QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a_sTok, int a_iPos ) const -> int
auto QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a_sTok,
qmusizetype a_iPos ) const -> qmusizetype
{
int iEnd = FindFirstNotOf(m_strFormula, a_szCharSet, a_iPos);
qmusizetype iEnd = FindFirstNotOf(m_strFormula, a_szCharSet, a_iPos);
if (iEnd == -1)
{
@ -344,9 +345,9 @@ auto QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a
* alphabetic characters are allowed in operator tokens. To avoid this this function checks specifically
* for operator tokens.
*/
auto QmuParserTokenReader::ExtractOperatorToken ( QString &a_sTok, int a_iPos ) const -> int
auto QmuParserTokenReader::ExtractOperatorToken ( QString &a_sTok, qmusizetype a_iPos ) const -> qmusizetype
{
int iEnd = FindFirstNotOf(m_strFormula, m_pParser->ValidOprtChars(), a_iPos);
qmusizetype iEnd = FindFirstNotOf(m_strFormula, m_pParser->ValidOprtChars(), a_iPos);
if ( iEnd == -1 )
{
@ -380,7 +381,7 @@ auto QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok ) -> bool
// check string for operator/function
for ( int i = 0; i < pOprtDef.size(); ++i )
{
int len = pOprtDef.at ( i ).length();
qmusizetype len = pOprtDef.at ( i ).length();
if ( pOprtDef.at ( i ) == m_strFormula.mid ( m_iPos, len ) )
{
if (i >= cmLE && i <= cmASSIGN)
@ -549,7 +550,7 @@ auto QmuParserTokenReader::IsEOF ( token_type &a_Tok ) -> bool
auto QmuParserTokenReader::IsInfixOpTok ( token_type &a_Tok ) -> bool
{
QString sTok;
int iEnd = ExtractToken ( m_pParser->ValidInfixOprtChars(), sTok, m_iPos );
qmusizetype iEnd = ExtractToken ( m_pParser->ValidInfixOprtChars(), sTok, m_iPos );
if ( iEnd == m_iPos )
{
return false;
@ -588,7 +589,7 @@ auto QmuParserTokenReader::IsInfixOpTok ( token_type &a_Tok ) -> bool
auto QmuParserTokenReader::IsFunTok ( token_type &a_Tok ) -> bool
{
QString strTok;
int iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
if ( iEnd == m_iPos )
{
return false;
@ -628,7 +629,7 @@ auto QmuParserTokenReader::IsOprt ( token_type &a_Tok ) -> bool
{
QString strTok;
int iEnd = ExtractOperatorToken ( strTok, m_iPos );
qmusizetype iEnd = ExtractOperatorToken ( strTok, m_iPos );
if ( iEnd == m_iPos )
{
return false;
@ -718,7 +719,7 @@ auto QmuParserTokenReader::IsPostOpTok ( token_type &a_Tok ) -> bool
// Test if there could be a postfix operator
QString sTok;
int iEnd = ExtractToken ( m_pParser->ValidOprtChars(), sTok, m_iPos );
qmusizetype iEnd = ExtractToken ( m_pParser->ValidOprtChars(), sTok, m_iPos );
if ( iEnd == m_iPos )
{
return false;
@ -758,7 +759,7 @@ auto QmuParserTokenReader::IsValTok ( token_type &a_Tok, const QLocale &locale,
QString strTok;
qreal fVal ( 0 );
int iEnd ( 0 );
qmusizetype iEnd ( 0 );
// 2.) Check for user defined constant
// Read everything that could be a constant name
@ -786,7 +787,7 @@ auto QmuParserTokenReader::IsValTok ( token_type &a_Tok, const QLocale &locale,
auto item = m_vIdentFun.begin();
for ( item = m_vIdentFun.begin(); item != m_vIdentFun.end(); ++item )
{
int iStart = m_iPos;
qmusizetype iStart = m_iPos;
if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal, locale, cNumbers, decimal, thousand ) == 1 )
{
// 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2
@ -819,7 +820,7 @@ auto QmuParserTokenReader::IsVarTok ( token_type &a_Tok ) -> bool
}
QString strTok;
int iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
if ( iEnd == m_iPos )
{
return false;
@ -858,7 +859,7 @@ auto QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok ) -> bool
}
QString strTok;
int iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
qmusizetype iEnd = ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos );
if ( iEnd == m_iPos )
{
return false;
@ -899,7 +900,7 @@ auto QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok ) -> bool
auto QmuParserTokenReader::IsUndefVarTok ( token_type &a_Tok ) -> bool
{
QString strTok;
int iEnd ( ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ) );
qmusizetype iEnd ( ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ) );
if ( iEnd == m_iPos )
{
return false;
@ -966,7 +967,7 @@ auto QmuParserTokenReader::IsString ( token_type &a_Tok ) -> bool
}
QString strBuf (m_strFormula.mid(m_iPos + 1));
int iEnd ( 0 ), iSkip ( 0 );
qmusizetype iEnd ( 0 ), iSkip ( 0 );
// parser over escaped '\"' end replace them with '"'
for ( iEnd = strBuf.indexOf ( "\"" ); iEnd != 0 && iEnd != -1; iEnd = strBuf.indexOf ( "\"", iEnd ) )
@ -1011,7 +1012,7 @@ auto QmuParserTokenReader::IsString ( token_type &a_Tok ) -> bool
* @param a_sTok [in] The token string representation associated with the error.
* @throw ParserException always throws thats the only purpose of this function.
*/
void Q_NORETURN QmuParserTokenReader::Error ( EErrorCodes a_iErrc, int a_iPos, const QString &a_sTok ) const
void Q_NORETURN QmuParserTokenReader::Error ( EErrorCodes a_iErrc, qmusizetype a_iPos, const QString &a_sTok ) const
{
m_pParser->Error ( a_iErrc, a_iPos, a_sTok );
}

View File

@ -62,7 +62,7 @@ public:
void SetVarCreator(facfun_type a_pFactory, void *pUserData);
void SetFormula(const QString &a_strFormula);
void SetArgSep(char_type cArgSep);
auto GetPos() const -> int;
auto GetPos() const -> qmusizetype;
auto GetExpr() const -> const QString&;
auto GetUsedVar() -> varmap_type&;
auto GetArgSep() const -> QChar;
@ -100,7 +100,7 @@ private:
QmuParserBase *m_pParser;
QString m_strFormula{};
int m_iPos{0};
qmusizetype m_iPos{0};
int m_iSynFlags{0};
bool m_bIgnoreUndefVar{false};
@ -126,8 +126,8 @@ private:
void Assign(const QmuParserTokenReader &a_Reader);
void SetParent(QmuParserBase *a_pParent);
auto ExtractToken(const QString &a_szCharSet, QString &a_strTok, int a_iPos) const -> int;
auto ExtractOperatorToken(QString &a_sTok, int a_iPos) const -> int;
auto ExtractToken(const QString &a_szCharSet, QString &a_strTok, qmusizetype a_iPos) const -> qmusizetype;
auto ExtractOperatorToken(QString &a_sTok, qmusizetype a_iPos) const -> qmusizetype;
auto IsBuiltIn(token_type &a_Tok) -> bool;
auto IsArgSep(token_type &a_Tok) -> bool;
@ -142,7 +142,7 @@ private:
auto IsStrVarTok(token_type &a_Tok) -> bool;
auto IsUndefVarTok(token_type &a_Tok) -> bool;
auto IsString(token_type &a_Tok) -> bool;
void Q_NORETURN Error(EErrorCodes a_iErrc, int a_iPos = -1, const QString &a_sTok = QString() ) const;
void Q_NORETURN Error(EErrorCodes a_iErrc, qmusizetype a_iPos = -1, const QString &a_sTok = QString() ) const;
auto SaveBeforeReturn(const token_type &tok) -> token_type&;
};
@ -154,7 +154,7 @@ private:
* @return #m_iPos
* @throw nothrow
*/
inline auto QmuParserTokenReader::GetPos() const -> int
inline auto QmuParserTokenReader::GetPos() const -> qmusizetype
{
return m_iPos;
}

View File

@ -860,7 +860,8 @@ void VDxfEngine::ExportPieceText(const QSharedPointer<dx_ifaceBlock> &detailBloc
for (int i = 0; i < list.size(); ++i)
{
QPointF pos(startPos.x(), startPos.y() - ToPixel(AAMATextHeight * m_yscale, m_varInsunits)*(list.size() - i-1));
const qreal height = ToPixel(AAMATextHeight * m_yscale, m_varInsunits);
QPointF pos(startPos.x(), startPos.y() - height * (static_cast<int>(list.size()) - i-1));
detailBlock->ent.push_back(AAMAText(pos, list.at(i), *layer1));
}
}
@ -875,8 +876,8 @@ void VDxfEngine::ExportStyleSystemText(const QSharedPointer<dx_iface> &input, co
{
for (int j = 0; j < strings.size(); ++j)
{
QPointF pos(0, GetSize().height() -
ToPixel(AAMATextHeight * m_yscale, m_varInsunits)*(strings.size() - j-1));
const qreal height = ToPixel(AAMATextHeight * m_yscale, m_varInsunits);
QPointF pos(0, GetSize().height() - height * (static_cast<int>(strings.size()) - j-1));
input->AddEntity(AAMAText(pos, strings.at(j), *layer1));
}
return;

View File

@ -1464,7 +1464,7 @@ qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool
QString VMeasurements::ClearPMCode(const QString &code) const
{
QString clear = code;
const int index = clear.indexOf(QLatin1Char('p'));
const vsizetype index = clear.indexOf(QLatin1Char('p'));
if (index == 0)
{
clear.remove(0, 1);

View File

@ -57,10 +57,10 @@ public:
auto operator= (const VAbstractCubicBezierPath &curve) -> VAbstractCubicBezierPath&;
~VAbstractCubicBezierPath() override;
virtual auto CountSubSpl() const -> qint32 =0;
virtual auto CountPoints() const -> qint32 =0;
virtual auto CountSubSpl() const -> vsizetype =0;
virtual auto CountPoints() const -> vsizetype =0;
virtual void Clear() =0;
virtual auto GetSpline(qint32 index) const -> VSpline =0;
virtual auto GetSpline(vsizetype index) const -> VSpline =0;
virtual auto GetSplinePath() const -> QVector<VSplinePoint> =0;
auto GetPath() const -> QPainterPath override;

View File

@ -167,13 +167,13 @@ VCubicBezierPath::~VCubicBezierPath()
}
//---------------------------------------------------------------------------------------------------------------------
VPointF &VCubicBezierPath::operator[](int indx)
VPointF &VCubicBezierPath::operator[](vsizetype indx)
{
return d->path[indx];
}
//---------------------------------------------------------------------------------------------------------------------
const VPointF &VCubicBezierPath::at(int indx) const
const VPointF &VCubicBezierPath::at(vsizetype indx) const
{
return d->path[indx];
}
@ -186,13 +186,13 @@ void VCubicBezierPath::append(const VPointF &point)
}
//---------------------------------------------------------------------------------------------------------------------
qint32 VCubicBezierPath::CountSubSpl() const
vsizetype VCubicBezierPath::CountSubSpl() const
{
return CountSubSpl(d->path.size());
}
//---------------------------------------------------------------------------------------------------------------------
qint32 VCubicBezierPath::CountPoints() const
vsizetype VCubicBezierPath::CountPoints() const
{
return d->path.size();
}
@ -205,7 +205,7 @@ void VCubicBezierPath::Clear()
}
//---------------------------------------------------------------------------------------------------------------------
VSpline VCubicBezierPath::GetSpline(qint32 index) const
VSpline VCubicBezierPath::GetSpline(vsizetype index) const
{
if (CountPoints() < 4)
{
@ -217,7 +217,7 @@ VSpline VCubicBezierPath::GetSpline(qint32 index) const
throw VException(tr("This spline does not exist."));
}
const qint32 base = SubSplOffset(index);
const vsizetype base = SubSplOffset(index);
// Correction the first control point of each next spline curve except for the first.
QPointF p2 = static_cast<QPointF>(d->path.at(base + 1));
@ -252,7 +252,7 @@ qreal VCubicBezierPath::GetStartAngle() const
//---------------------------------------------------------------------------------------------------------------------
qreal VCubicBezierPath::GetEndAngle() const
{
const qint32 count = CountSubSpl();
const vsizetype count = CountSubSpl();
if (count > 0)
{
return GetSpline(count).GetEndAngle();
@ -279,7 +279,7 @@ qreal VCubicBezierPath::GetC1Length() const
//---------------------------------------------------------------------------------------------------------------------
qreal VCubicBezierPath::GetC2Length() const
{
const qint32 count = CountSubSpl();
const vsizetype count = CountSubSpl();
if (count > 0)
{
return GetSpline(count).GetC2Length();
@ -293,7 +293,7 @@ qreal VCubicBezierPath::GetC2Length() const
//---------------------------------------------------------------------------------------------------------------------
QVector<VSplinePoint> VCubicBezierPath::GetSplinePath() const
{
const int size = CountSubSpl();
const vsizetype size = CountSubSpl();
QVector<VSplinePoint> splPoints(size+1);
for (qint32 i = 1; i <= size; ++i)
@ -326,17 +326,21 @@ QVector<VPointF> VCubicBezierPath::GetCubicPath() const
}
//---------------------------------------------------------------------------------------------------------------------
qint32 VCubicBezierPath::CountSubSpl(qint32 size)
vsizetype VCubicBezierPath::CountSubSpl(vsizetype size)
{
if (size <= 0)
{
return 0;
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return qFloor(qAbs((size - 4) / 3.0L + 1));
#else
return qFloor(qAbs((size - 4) / 3.0 + 1));
#endif
}
//---------------------------------------------------------------------------------------------------------------------
qint32 VCubicBezierPath::SubSplOffset(qint32 subSplIndex)
vsizetype VCubicBezierPath::SubSplOffset(vsizetype subSplIndex)
{
if (subSplIndex <= 0)
{
@ -347,7 +351,7 @@ qint32 VCubicBezierPath::SubSplOffset(qint32 subSplIndex)
}
//---------------------------------------------------------------------------------------------------------------------
qint32 VCubicBezierPath::SubSplPointsCount(qint32 countSubSpl)
vsizetype VCubicBezierPath::SubSplPointsCount(vsizetype countSubSpl)
{
if (countSubSpl <= 0)
{
@ -373,7 +377,7 @@ VPointF VCubicBezierPath::FirstPoint() const
//---------------------------------------------------------------------------------------------------------------------
VPointF VCubicBezierPath::LastPoint() const
{
const qint32 count = CountSubSpl();
const vsizetype count = CountSubSpl();
if (count >= 1)
{
return d->path.at(SubSplOffset(count) + 3);// Take last point of the last real spline

View File

@ -62,16 +62,16 @@ public:
VCubicBezierPath &operator=(VCubicBezierPath &&curve) Q_DECL_NOTHROW;
#endif
VPointF &operator[](int indx);
VPointF &operator[](vsizetype indx);
const VPointF &at(int indx) const;
const VPointF &at(vsizetype indx) const;
void append(const VPointF &point);
virtual qint32 CountSubSpl() const override;
virtual qint32 CountPoints() const override;
virtual vsizetype CountSubSpl() const override;
virtual vsizetype CountPoints() const override;
virtual void Clear() override;
virtual VSpline GetSpline(qint32 index) const override;
virtual VSpline GetSpline(vsizetype index) const override;
virtual qreal GetStartAngle () const override;
virtual qreal GetEndAngle () const override;
@ -81,9 +81,9 @@ public:
virtual QVector<VSplinePoint> GetSplinePath() const override;
QVector<VPointF> GetCubicPath() const;
static qint32 CountSubSpl(qint32 size);
static qint32 SubSplOffset(qint32 subSplIndex);
static qint32 SubSplPointsCount(qint32 countSubSpl);
static vsizetype CountSubSpl(vsizetype size);
static vsizetype SubSplOffset(vsizetype subSplIndex);
static vsizetype SubSplPointsCount(vsizetype countSubSpl);
protected:
virtual VPointF FirstPoint() const override;
virtual VPointF LastPoint() const override;

View File

@ -216,7 +216,7 @@ void VSplinePath::append(const VSplinePoint &point)
* @brief CountSubSpl return count of simple splines.
* @return count.
*/
qint32 VSplinePath::CountSubSpl() const
vsizetype VSplinePath::CountSubSpl() const
{
if (d->path.isEmpty())
{
@ -232,7 +232,7 @@ qint32 VSplinePath::CountSubSpl() const
* @param index index spline in spline path.
* @return spline
*/
VSpline VSplinePath::GetSpline(qint32 index) const
VSpline VSplinePath::GetSpline(vsizetype index) const
{
if (CountPoints()<1)
{
@ -337,7 +337,7 @@ VSplinePath &VSplinePath::operator=(VSplinePath &&path) Q_DECL_NOTHROW
* @param indx index in list.
* @return spline point.
*/
VSplinePoint & VSplinePath::operator[](int indx)
VSplinePoint & VSplinePath::operator[](vsizetype indx)
{
return d->path[indx];
}
@ -348,7 +348,7 @@ VSplinePoint & VSplinePath::operator[](int indx)
* @param indx index in list.
* @return spline point.
*/
const VSplinePoint &VSplinePath::at(int indx) const
const VSplinePoint &VSplinePath::at(vsizetype indx) const
{
return d->path[indx];
}
@ -409,7 +409,7 @@ VPointF VSplinePath::FirstPoint() const
//---------------------------------------------------------------------------------------------------------------------
VPointF VSplinePath::LastPoint() const
{
const qint32 count = CountSubSpl();
const vsizetype count = CountSubSpl();
return count >= 1 ? d->path.at(count).P() :// Take last point of the last real spline
VPointF();
}
@ -419,7 +419,7 @@ VPointF VSplinePath::LastPoint() const
* @brief CountPoints return count of points.
* @return count.
*/
qint32 VSplinePath::CountPoints() const
vsizetype VSplinePath::CountPoints() const
{
return d->path.size();
}

View File

@ -64,7 +64,7 @@ public:
VSplinePath Move(qreal length, qreal angle, const QString &prefix = QString()) const;
virtual ~VSplinePath() override;
VSplinePoint &operator[](int indx);
VSplinePoint &operator[](vsizetype indx);
VSplinePath &operator=(const VSplinePath &path);
#ifdef Q_COMPILER_RVALUE_REFS
VSplinePath(VSplinePath&& splPath) Q_DECL_NOTHROW;
@ -73,10 +73,10 @@ public:
void append(const VSplinePoint &point);
virtual qint32 CountSubSpl() const override;
virtual qint32 CountPoints() const override;
virtual vsizetype CountSubSpl() const override;
virtual vsizetype CountPoints() const override;
virtual void Clear() override;
virtual VSpline GetSpline(qint32 index) const override;
virtual VSpline GetSpline(vsizetype index) const override;
virtual QVector<VSplinePoint> GetSplinePath() const override;
QVector<VFSplinePoint> GetFSplinePath() const;
@ -90,7 +90,7 @@ public:
void UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point);
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const;
const VSplinePoint &at(int indx) const;
const VSplinePoint &at(vsizetype indx) const;
virtual QJsonObject ToJson() const override;

View File

@ -597,7 +597,7 @@ auto AngleBySecondRightAngle(QVector<VRawSAPoint> points, QPointF p1, QPointF p2
// Because artificial loop can lead to wrong clipping we must rollback current seam allowance points
bool success = false;
const int countBefore = points.size();
const auto countBefore = points.size();
QVector<VRawSAPoint> temp = points;
temp.append(VRawSAPoint(bigLine1.p2(), p.CurvePoint(), p.TurnPoint()));
temp = VAbstractPiece::RollbackSeamAllowance(temp, edge, &success);
@ -705,7 +705,7 @@ auto CorrectPathDistortion(QVector<T> path) -> QVector<T>
return path;
}
int prev = -1;
vsizetype prev = -1;
for (qint32 i = 0; i < path.size(); ++i)
{
if (prev == -1)
@ -1159,7 +1159,7 @@ auto VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points) -> qreal
{
// Calculation a polygon area through the sum of the areas of trapezoids
qreal s, res = 0;
const int n = points.size();
const auto n = points.size();
if(n > 2)
{
@ -1564,7 +1564,7 @@ auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QL
*success = false;
QVector<VRawSAPoint> clipped;
clipped.reserve(points.count()+1);
for (int i = points.count()-1; i > 0; --i)
for (auto i = points.count()-1; i > 0; --i)
{
QLineF segment(points.at(i), points.at(i-1));
QPointF crosPoint;
@ -1575,7 +1575,7 @@ auto VAbstractPiece::RollbackSeamAllowance(QVector<VRawSAPoint> points, const QL
&& IsSameDirection(cuttingEdge.p2(), cuttingEdge.p1(), crosPoint))
{
clipped.append(VRawSAPoint(crosPoint, points.at(i).CurvePoint(), points.at(i).TurnPoint()));
for (int j=i-1; j>=0; --j)
for (auto j=i-1; j>=0; --j)
{
clipped.append(points.at(j));
}

View File

@ -229,8 +229,8 @@ inline auto VAbstractPiece::CorrectEquidistantPoints(const QVector<T> &points, b
return buf1;
}
int prev = -1;
int next = -1;
vsizetype prev = -1;
vsizetype next = -1;
QVector<T> buf2;
//Remove point on line

View File

@ -80,9 +80,9 @@ void Insert(QMap<uint, QHash<int, qint64>> &container, uint key, int valKey, qin
//---------------------------------------------------------------------------------------------------------------------
template <typename T>
int CountDetails(const T &container)
vsizetype CountDetails(const T &container)
{
int count = 0;
vsizetype count = 0;
auto i = container.constBegin();
while (i != container.constEnd())
{
@ -424,19 +424,19 @@ void VBank::SetCaseType(Cases caseType)
}
//---------------------------------------------------------------------------------------------------------------------
int VBank::AllDetailsCount() const
vsizetype VBank::AllDetailsCount() const
{
return CountDetails(unsorted) + CountDetails(big) + CountDetails(middle) + CountDetails(small) + CountDetails(desc);
}
//---------------------------------------------------------------------------------------------------------------------
int VBank::LeftToArrange() const
vsizetype VBank::LeftToArrange() const
{
return CountDetails(big) + CountDetails(middle) + CountDetails(small) + CountDetails(desc);
}
//---------------------------------------------------------------------------------------------------------------------
int VBank::FailedToArrange() const
vsizetype VBank::FailedToArrange() const
{
return CountDetails(unsorted);
}

View File

@ -77,9 +77,9 @@ public:
void Reset();
void SetCaseType(Cases caseType);
int AllDetailsCount() const;
int LeftToArrange() const;
int FailedToArrange() const;
vsizetype AllDetailsCount() const;
vsizetype LeftToArrange() const;
vsizetype FailedToArrange() const;
qreal GetBiggestDiagonal() const;

View File

@ -71,9 +71,9 @@ QVector<QPointF> OptimizeCombining(const QVector<QPointF> &contour, const QPoint
QPointF withdrawFirst = ConstLast(contour);
bool optimize = false;
int count = 0;
int cutIndex = -1;
vsizetype cutIndex = -1;
for (int i = contour.size() - 2; i >= 0; --i)
for (auto i = contour.size() - 2; i >= 0; --i)
{
if (not VGObject::IsPointOnLineSegment(contour.at(i), withdrawFirst, withdrawEnd, accuracyPointOnLine*2))
{
@ -259,7 +259,7 @@ QVector<QPointF> VContour::UniteWithContour(const VLayoutPiece &detail, int glob
}
//---------------------------------------------------------------------------------------------------------------------
int VContour::GlobalEdgesCount() const
vsizetype VContour::GlobalEdgesCount() const
{
return d->m_emptySheetEdgesCount;
}
@ -277,7 +277,7 @@ QLineF VContour::GlobalEdge(int i) const
}
const QLineF emptyEdge = EmptySheetEdge();
const qreal nShift = emptyEdge.length()/GlobalEdgesCount();
const qreal nShift = emptyEdge.length() / static_cast<int>(GlobalEdgesCount());
edge = IsPortrait() ? QLineF(nShift*(i-1) + emptyEdge.x1(), emptyEdge.y1(),
nShift*i + emptyEdge.x1(), emptyEdge.y2()) :
QLineF(emptyEdge.x1(), nShift*(i-1) + emptyEdge.y1(),
@ -339,7 +339,7 @@ QVector<QPointF> VContour::CutEdge(const QLineF &edge) const
QVector<QPointF> VContour::CutEmptySheetEdge() const
{
QVector<QPointF> points;
const qreal nShift = EmptySheetEdge().length()/GlobalEdgesCount();
const qreal nShift = EmptySheetEdge().length() / static_cast<int>(GlobalEdgesCount());
for (int i = 1; i <= GlobalEdgesCount()+1; ++i)
{
QLineF l1 = EmptySheetEdge();
@ -359,7 +359,7 @@ const QPointF &VContour::at(int i) const
void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutPiece &detail, int detJ) const
{
int processedEdges = 0;
const int nD = detail.LayoutEdgesCount();
const auto nD = detail.LayoutEdgesCount();
int j = detJ;
contour = OptimizeCombining(contour, detail.LayoutEdge(j).p2());
@ -385,7 +385,7 @@ void VContour::AppendWhole(QVector<QPointF> &contour, const VLayoutPiece &detail
void VContour::InsertDetail(QVector<QPointF> &contour, const VLayoutPiece &detail, int detJ) const
{
int processedEdges = 0;
const int nD = detail.LayoutEdgesCount();
const auto nD = detail.LayoutEdgesCount();
int j = detJ;
contour = OptimizeCombining(contour, detail.LayoutEdge(j).p2());

View File

@ -36,6 +36,7 @@
#include <QtGlobal>
#include "vlayoutdef.h"
#include "../vmisc/defglobal.h"
class VContourData;
class QPointF;
@ -80,7 +81,7 @@ public:
QVector<QPointF> UniteWithContour(const VLayoutPiece &detail, int globalI, int detJ, BestFrom type) const;
QLineF EmptySheetEdge() const;
int GlobalEdgesCount() const;
vsizetype GlobalEdgesCount() const;
QLineF GlobalEdge(int i) const;
QVector<QPointF> CutEdge(const QLineF &edge) const;
QVector<QPointF> CutEmptySheetEdge() const;

View File

@ -81,7 +81,7 @@ public:
qreal layoutWidth{0};
int m_emptySheetEdgesCount{0};
vsizetype m_emptySheetEdgesCount{0};
private:
Q_DISABLE_ASSIGN(VContourData)

View File

@ -96,7 +96,7 @@ void VLayoutGenerator::SetCaseType(Cases caseType)
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
int VLayoutGenerator::DetailsCount()
vsizetype VLayoutGenerator::DetailsCount()
{
return bank->AllDetailsCount();
}
@ -296,6 +296,12 @@ LayoutErrors VLayoutGenerator::State() const
return state;
}
//---------------------------------------------------------------------------------------------------------------------
vsizetype VLayoutGenerator::PapersCount() const
{
return papers.size();
}
//---------------------------------------------------------------------------------------------------------------------
QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
{

View File

@ -57,7 +57,7 @@ public:
void SetDetails(const QVector<VLayoutPiece> &details);
void SetLayoutWidth(qreal width);
void SetCaseType(Cases caseType);
int DetailsCount();
vsizetype DetailsCount();
qreal GetPaperHeight() const;
void SetPaperHeight(qreal value);
@ -85,7 +85,7 @@ public:
LayoutErrors State() const;
int PapersCount() const {return papers.size();}
vsizetype PapersCount() const;
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetPapersItems() const;
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetGlobalContours() const;

View File

@ -269,7 +269,7 @@ bool VLayoutPaper::ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &s
}
//---------------------------------------------------------------------------------------------------------------------
int VLayoutPaper::Count() const
vsizetype VLayoutPaper::Count() const
{
return d->details.count();
}

View File

@ -36,7 +36,7 @@
#include <atomic>
#include <QGraphicsPathItem>
#include "vlayoutdef.h"
#include "../vmisc/defglobal.h"
class VBestSquare;
class VLayoutPaperData;
@ -93,7 +93,7 @@ public:
void SetOriginPaperPortrait(bool portrait);
bool ArrangeDetail(const VLayoutPiece &detail, std::atomic_bool &stop);
int Count() const;
vsizetype Count() const;
Q_REQUIRED_RESULT QGraphicsRectItem *GetPaperItem(bool autoCropLength, bool autoCropWidth, bool textAsPaths) const;
Q_REQUIRED_RESULT QGraphicsPathItem *GetGlobalContour() const;
Q_REQUIRED_RESULT QList<QGraphicsItem *> GetItemDetails(bool textAsPaths) const;

View File

@ -194,7 +194,7 @@ auto PieceLabelText(const QVector<QPointF> &labelShape, const VTextManager &tm)
QStringList text;
if (labelShape.count() > 2)
{
int sourceCount = tm.GetSourceLinesCount();
auto sourceCount = tm.GetSourceLinesCount();
text.reserve(sourceCount);
for (int i = 0; i < sourceCount; ++i)
{
@ -1174,15 +1174,15 @@ void VLayoutPiece::Mirror()
}
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::DetailEdgesCount() const -> int
auto VLayoutPiece::DetailEdgesCount() const -> vsizetype
{
return DetailPath().count();
}
//---------------------------------------------------------------------------------------------------------------------
auto VLayoutPiece::LayoutEdgesCount() const -> int
auto VLayoutPiece::LayoutEdgesCount() const -> vsizetype
{
const int count = d->m_layoutAllowance.count();
const auto count = d->m_layoutAllowance.count();
return count > 2 ? count : 0;
}
@ -1768,7 +1768,7 @@ auto VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const -> QLineF
return {};
}
int i1, i2;
vsizetype i1, i2;
if (i < path.count())
{
i1 = i-1;

View File

@ -161,8 +161,8 @@ public:
void Mirror(const QLineF &edge);
void Mirror();
auto DetailEdgesCount() const -> int;
auto LayoutEdgesCount() const -> int;
auto DetailEdgesCount() const -> vsizetype;
auto LayoutEdgesCount() const -> vsizetype;
auto LayoutEdge(int i) const -> QLineF;
auto LayoutEdgeByPoint(const QPointF &p1) const -> EdgeIndex;

View File

@ -210,7 +210,7 @@ auto VPosition::ArrangeDetail(const VPositionData &data, std::atomic_bool *stop,
}
const VLayoutPiece detail = data.detail;
const int detailEdgesCount = detail.LayoutEdgesCount();
const auto detailEdgesCount = detail.LayoutEdgesCount();
if (detailEdgesCount < 3 || detail.DetailEdgesCount() < 3)
{
return bestResult;//Not enough edges

View File

@ -153,7 +153,7 @@ QVector<PosterData> VPoster::Calc(const QSize &imageRect, int page, PageOrientat
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QGraphicsItem *> VPoster::Tile(QGraphicsItem *parent, const PosterData &img, int sheets,
QVector<QGraphicsItem *> VPoster::Tile(QGraphicsItem *parent, const PosterData &img, vsizetype sheets,
const VWatermarkData &watermarkData, const QString &watermarkPath) const
{
QVector<QGraphicsItem *> data;
@ -180,7 +180,7 @@ QVector<QGraphicsItem *> VPoster::Tile(QGraphicsItem *parent, const PosterData &
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterData &img, int sheets) const
QVector<QGraphicsItem *> VPoster::Borders(QGraphicsItem *parent, const PosterData &img, vsizetype sheets) const
{
SCASSERT(parent != nullptr)

View File

@ -69,7 +69,7 @@ public:
QVector<PosterData> Calc(const QSize &imageRect, int page, PageOrientation orientation) const;
QVector<QGraphicsItem *> Tile(QGraphicsItem *parent, const PosterData &img, int sheets,
QVector<QGraphicsItem *> Tile(QGraphicsItem *parent, const PosterData &img, vsizetype sheets,
const VWatermarkData &watermarkData, const QString &watermarkPath) const;
private:
@ -89,7 +89,7 @@ private:
void Ruler(QVector<QGraphicsItem *> &data, QGraphicsItem *parent, QRect rec) const;
QVector<QGraphicsItem *> Borders(QGraphicsItem *parent, const PosterData &img, int sheets) const;
QVector<QGraphicsItem *> Borders(QGraphicsItem *parent, const PosterData &img, vsizetype sheets) const;
QVector<QGraphicsItem *> TextWatermark(QGraphicsItem *parent, const PosterData &img,
const VWatermarkData &watermarkData) const;

View File

@ -326,7 +326,7 @@ void VPrintLayout::PrintPages(QPrinter *printer)
Qt::RoundCap, Qt::RoundJoin));
painter.setBrush ( QBrush ( Qt::NoBrush ) );
int count = 0;
vsizetype count = 0;
QSharedPointer<QVector<PosterData>> poster;
QSharedPointer<VPoster> posterazor;
@ -363,7 +363,7 @@ void VPrintLayout::PrintPages(QPrinter *printer)
}
// Handle the fromPage(), toPage(), supportsMultipleCopies(), and numCopies() values from QPrinter.
int firstPage = printer->fromPage() - 1;
vsizetype firstPage = printer->fromPage() - 1;
if (firstPage >= count)
{
return;
@ -373,13 +373,13 @@ void VPrintLayout::PrintPages(QPrinter *printer)
firstPage = 0;
}
int lastPage = printer->toPage() - 1;
vsizetype lastPage = printer->toPage() - 1;
if (lastPage == -1 || lastPage >= count)
{
lastPage = count - 1;
}
const int numPages = lastPage - firstPage + 1;
const vsizetype numPages = lastPage - firstPage + 1;
int copyCount = 1;
if (not printer->supportsMultipleCopies())
{
@ -400,7 +400,7 @@ void VPrintLayout::PrintPages(QPrinter *printer)
return;
}
}
int index;
vsizetype index;
if (printer->pageOrder() == QPrinter::FirstPageFirst)
{
index = firstPage + j;
@ -410,7 +410,7 @@ void VPrintLayout::PrintPages(QPrinter *printer)
index = lastPage - j;
}
int paperIndex = -1;
vsizetype paperIndex = -1;
m_isTiled ? paperIndex = static_cast<int>(poster->at(index).index) : paperIndex = index;
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutPapers.at(paperIndex));
@ -610,7 +610,7 @@ auto VPrintLayout::DocName() const -> QString
}
//---------------------------------------------------------------------------------------------------------------------
void VPrintLayout::PreparePaper(int index) const
void VPrintLayout::PreparePaper(vsizetype index) const
{
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutPapers.at(index));
if (paper != nullptr)
@ -635,7 +635,7 @@ void VPrintLayout::PreparePaper(int index) const
}
//---------------------------------------------------------------------------------------------------------------------
void VPrintLayout::RestorePaper(int index) const
void VPrintLayout::RestorePaper(vsizetype index) const
{
auto *paper = qgraphicsitem_cast<QGraphicsRectItem *>(m_layoutPapers.at(index));
if (paper != nullptr)

View File

@ -166,8 +166,8 @@ private:
QString DocName() const;
void PreparePaper(int index) const;
void RestorePaper(int index) const;
void PreparePaper(vsizetype index) const;
void RestorePaper(vsizetype index) const;
bool IsPagesUniform() const;
bool IsPagesFit(QSizeF printPaper) const;

View File

@ -114,7 +114,7 @@ bool VRawLayout::WriteFile(QIODevice *ioDevice, const VRawLayoutData &data)
dataStream.setVersion(QDataStream::Qt_5_4);
// Don't use the << operator for QByteArray. See the note in ReadFile() below.
dataStream.writeRawData(fileHeaderByteArray.constData(), fileHeaderByteArray.size());
dataStream.writeRawData(fileHeaderByteArray.constData(), static_cast<int>(fileHeaderByteArray.size()));
dataStream << fileVersion;
dataStream << data;
@ -158,7 +158,7 @@ bool VRawLayout::ReadFile(QIODevice *ioDevice, VRawLayoutData &data)
// bytes of the stream will be the size of the array, we might end up attempting to allocate
// a large amount of memory if the wrong file type was read. Instead, we'll just read the
// same number of bytes that are in the array we are comparing it to. No size was written.
const int len = fileHeaderByteArray.size();
const int len = static_cast<int>(fileHeaderByteArray.size());
QByteArray actualFileHeaderByteArray( len, '\0' );
dataStream.readRawData( actualFileHeaderByteArray.data(), len );

View File

@ -492,7 +492,7 @@ void VTextManager::SetAllSourceLines(const QVector<TextLine> &lines)
* @brief VTextManager::GetSourceLinesCount returns the number of input text lines
* @return number of text lines that were added to the list by calling AddLine
*/
auto VTextManager::GetSourceLinesCount() const -> int
auto VTextManager::GetSourceLinesCount() const -> vsizetype
{
return m_liLines.count();
}
@ -503,7 +503,7 @@ auto VTextManager::GetSourceLinesCount() const -> int
* @param i index of the requested line
* @return reference to the requested TextLine object
*/
auto VTextManager::GetSourceLine(int i) const -> const TextLine&
auto VTextManager::GetSourceLine(vsizetype i) const -> const TextLine&
{
Q_ASSERT(i >= 0);
Q_ASSERT(i < m_liLines.count());
@ -550,7 +550,7 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
int iFS = 0;
if (GetSourceLinesCount() > 0)
{//division by zero
iFS = 3*qFloor(fH/GetSourceLinesCount())/4;
iFS = 3*qFloor(fH/static_cast<int>(GetSourceLinesCount()))/4;
}
if (iFS < MIN_FONT_SIZE)
@ -563,7 +563,7 @@ void VTextManager::FitFontSize(qreal fW, qreal fH)
int iMaxLen = 0;
TextLine maxLine;
QFont fnt;
for (int i = 0; i < GetSourceLinesCount(); ++i)
for (vsizetype i = 0; i < GetSourceLinesCount(); ++i)
{
const TextLine& tl = GetSourceLine(i);
fnt = m_font;

View File

@ -92,8 +92,8 @@ public:
auto GetAllSourceLines() const -> QVector<TextLine>;
void SetAllSourceLines(const QVector<TextLine> &lines);
auto GetSourceLinesCount() const -> int;
auto GetSourceLine(int i) const -> const TextLine&;
auto GetSourceLinesCount() const -> vsizetype;
auto GetSourceLine(vsizetype i) const -> const TextLine&;
auto MaxLineWidth(int width) const -> int;

View File

@ -205,8 +205,8 @@ inline auto Reverse(const QVector<T> &container) -> QVector<T>
return container;
}
QVector<T> reversed(container.size());
qint32 j = 0;
for (qint32 i = container.size() - 1; i >= 0; --i)
vsizetype j = 0;
for (vsizetype i = container.size() - 1; i >= 0; --i)
{
reversed.replace(j, container.at(i));
++j;

View File

@ -119,4 +119,10 @@ void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
#endif // (defined(Q_CC_GNU) && Q_CC_GNU < 409) && !defined(Q_CC_CLANG)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
using vsizetype = qsizetype;
#else
using vsizetype = int;
#endif
#endif // DEFGLOBAL_H

View File

@ -55,7 +55,7 @@ public:
QList<QStringList> csvData;
QStringList header;
int maxColumn;
vsizetype maxColumn;
QxtCsvModel::QuoteMode quoteMode;
private:
@ -117,7 +117,7 @@ int QxtCsvModel::rowCount(const QModelIndex& parent) const
{
return 0;
}
return qxt_d().csvData.count();
return static_cast<int>(qxt_d().csvData.count());
}
/*!
@ -129,7 +129,7 @@ int QxtCsvModel::columnCount(const QModelIndex& parent) const
{
return 0;
}
return qxt_d().maxColumn;
return static_cast<int>(qxt_d().maxColumn);
}
/*!
@ -325,7 +325,7 @@ void QxtCsvModel::setSource(QIODevice *file, bool withHeader, QChar separator, Q
void QxtCsvModel::setHeaderData(const QStringList& data)
{
qxt_d().header = data;
emit headerDataChanged(Qt::Horizontal, 0, data.count());
emit headerDataChanged(Qt::Horizontal, 0, static_cast<int>(data.count()));
}
/*!

View File

@ -76,7 +76,7 @@ void VTableSearch::Clear()
}
//---------------------------------------------------------------------------------------------------------------------
void VTableSearch::ShowNext(int newIndex)
void VTableSearch::ShowNext(vsizetype newIndex)
{
if (not searchList.isEmpty())
{
@ -210,7 +210,7 @@ void VTableSearch::Find(const QString &term)
//---------------------------------------------------------------------------------------------------------------------
void VTableSearch::FindPrevious()
{
int newIndex = searchIndex - 1;
vsizetype newIndex = searchIndex - 1;
if (newIndex < 0)
{
@ -223,7 +223,7 @@ void VTableSearch::FindPrevious()
//---------------------------------------------------------------------------------------------------------------------
void VTableSearch::FindNext()
{
int newIndex = searchIndex + 1;
vsizetype newIndex = searchIndex + 1;
if (newIndex >= searchList.size())
{
@ -256,7 +256,7 @@ void VTableSearch::RemoveRow(int row)
}
//---------------------------------------------------------------------------------------------------------------------
void VTableSearch::AddRow(int row)
void VTableSearch::AddRow(vsizetype row)
{
if (searchIndex < 0 || searchIndex >= searchList.size())
{
@ -367,13 +367,13 @@ auto VTableSearch::IsUseUnicodePreperties() const -> bool
}
//---------------------------------------------------------------------------------------------------------------------
auto VTableSearch::MatchIndex() const -> int
auto VTableSearch::MatchIndex() const -> vsizetype
{
return searchIndex;
}
//---------------------------------------------------------------------------------------------------------------------
auto VTableSearch::MatchCount() const -> int
auto VTableSearch::MatchCount() const -> vsizetype
{
return searchList.size();
}

View File

@ -47,7 +47,7 @@ public:
void FindPrevious();
void FindNext();
void RemoveRow(int row);
void AddRow(int row);
void AddRow(vsizetype row);
void RefreshList(const QString &term);
void SetMatchCase(bool value);
@ -62,8 +62,8 @@ public:
void SetUseUnicodePreperties(bool value);
auto IsUseUnicodePreperties() const -> bool;
auto MatchIndex() const -> int;
auto MatchCount() const -> int;
auto MatchIndex() const -> vsizetype;
auto MatchCount() const -> vsizetype;
auto SearchPlaceholder() const -> QString;
@ -77,7 +77,7 @@ private:
Q_DISABLE_COPY_MOVE(VTableSearch) // NOLINT
QTableWidget *table;
int searchIndex{-1};
vsizetype searchIndex{-1};
QList<QTableWidgetItem *> searchList{};
bool m_matchCase{false};
@ -86,7 +86,7 @@ private:
bool m_useUnicodePreperties{false};
void Clear();
void ShowNext(int newIndex);
void ShowNext(vsizetype newIndex);
auto FindTableItems(QString term) -> QList<QTableWidgetItem *>;
auto FindCurrentMatchIndex() const -> int;
};

View File

@ -368,7 +368,7 @@ qint64 VObjEngine::Square(const QPolygonF &poly) const
QVector<qreal> x;
QVector<qreal> y;
int n = poly.count();
vsizetype n = poly.count();
qreal s, res = 0;
qint64 sq = 0;

View File

@ -59,7 +59,7 @@ struct VPiecePassmarkData
PassmarkAngleType passmarkAngleType{PassmarkAngleType::Straightforward};
bool isMainPathNode{true};
bool isShowSecondPassmark{true};
int passmarkIndex{-1};
vsizetype passmarkIndex{-1};
vidtype id{NULL_ID};
qreal globalPassmarkLength{0};

View File

@ -103,7 +103,7 @@ bool IsPassmarksPossible(const QVector<VPieceNode> &path)
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VPieceNode> RotatePath(const QVector<VPieceNode> &path, int index)
QVector<VPieceNode> RotatePath(const QVector<VPieceNode> &path, vsizetype index)
{
if (index < 0 || index >= path.size())
{
@ -257,8 +257,8 @@ QVector<VPassmark> VPiece::Passmarks(const VContainer *data) const
continue;// skip node
}
const int previousIndex = VPiecePath::FindInLoopNotExcludedUp(i, unitedPath);
const int nextIndex = VPiecePath::FindInLoopNotExcludedDown(i, unitedPath);
const vsizetype previousIndex = VPiecePath::FindInLoopNotExcludedUp(i, unitedPath);
const vsizetype nextIndex = VPiecePath::FindInLoopNotExcludedDown(i, unitedPath);
passmarks += CreatePassmark(unitedPath, previousIndex, i, nextIndex, data);
}
@ -649,7 +649,7 @@ const VGrainlineData &VPiece::GetGrainlineGeometry() const
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VLayoutPoint> VPiece::SeamAllowancePointsWithRotation(const VContainer *data, int makeFirst) const
QVector<VLayoutPoint> VPiece::SeamAllowancePointsWithRotation(const VContainer *data, vsizetype makeFirst) const
{
SCASSERT(data != nullptr);
@ -881,7 +881,8 @@ QVector<CustomSARecord> VPiece::FilterRecords(QVector<CustomSARecord> records) c
}
//---------------------------------------------------------------------------------------------------------------------
QVector<VSAPoint> VPiece::GetNodeSAPoints(const QVector<VPieceNode> &path, int index, const VContainer *data) const
QVector<VSAPoint> VPiece::GetNodeSAPoints(const QVector<VPieceNode> &path, vsizetype index,
const VContainer *data) const
{
SCASSERT(data != nullptr)
@ -908,7 +909,7 @@ QVector<VSAPoint> VPiece::GetNodeSAPoints(const QVector<VPieceNode> &path, int i
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetPassmarkSAPoint(const QVector<VPieceNode> &path, int index, const VContainer *data,
bool VPiece::GetPassmarkSAPoint(const QVector<VPieceNode> &path, vsizetype index, const VContainer *data,
VSAPoint &point) const
{
SCASSERT(data != nullptr)
@ -925,8 +926,9 @@ bool VPiece::GetPassmarkSAPoint(const QVector<VPieceNode> &path, int index, cons
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, int passmarkIndex) const
bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, vsizetype index,
const VSAPoint &passmarkSAPoint, const VContainer *data, VSAPoint &point,
vsizetype passmarkIndex) const
{
SCASSERT(data != nullptr)
@ -942,7 +944,7 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int in
}
bool found = false;
int nodeIndex = points.size()-1;
auto nodeIndex = points.size()-1;
do
{
const VSAPoint previous = points.at(nodeIndex);
@ -964,8 +966,8 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int in
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, int passmarkIndex) const
bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, vsizetype index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, vsizetype passmarkIndex) const
{
SCASSERT(data != nullptr)
@ -1004,7 +1006,7 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index,
}
//---------------------------------------------------------------------------------------------------------------------
bool VPiece::IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkIndex) const
bool VPiece::IsPassmarkVisible(const QVector<VPieceNode> &path, vsizetype passmarkIndex) const
{
if (passmarkIndex < 0 || passmarkIndex >= path.size())
{
@ -1044,8 +1046,8 @@ bool VPiece::IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkInde
}
//---------------------------------------------------------------------------------------------------------------------
VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex, int nextIndex,
const VContainer *data) const
VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousIndex, vsizetype passmarkIndex,
vsizetype nextIndex, const VContainer *data) const
{
SCASSERT(data != nullptr);

View File

@ -135,7 +135,7 @@ public:
QVector<VPieceNode> GetUnitedPath(const VContainer *data) const;
QVector<VLayoutPoint> SeamAllowancePointsWithRotation(const VContainer *data, int makeFirst) const;
QVector<VLayoutPoint> SeamAllowancePointsWithRotation(const VContainer *data, vsizetype makeFirst) const;
void SetGradationLabel(const QString &label);
auto GetGradationLabel() const -> QString;
@ -153,18 +153,19 @@ private:
QVector<CustomSARecord> GetValidRecords() const;
QVector<CustomSARecord> FilterRecords(QVector<CustomSARecord> records) const;
QVector<VSAPoint> GetNodeSAPoints(const QVector<VPieceNode> &path, int index, const VContainer *data) const;
QVector<VSAPoint> GetNodeSAPoints(const QVector<VPieceNode> &path, vsizetype index, const VContainer *data) const;
bool GetPassmarkSAPoint(const QVector<VPieceNode> &path, int index, const VContainer *data, VSAPoint &point) const;
bool GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, int passmarkIndex) const;
bool GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, int passmarkIndex) const;
bool GetPassmarkSAPoint(const QVector<VPieceNode> &path, vsizetype index, const VContainer *data,
VSAPoint &point) const;
bool GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, vsizetype index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, vsizetype passmarkIndex) const;
bool GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, vsizetype index, const VSAPoint &passmarkSAPoint,
const VContainer *data, VSAPoint &point, vsizetype passmarkIndex) const;
bool IsPassmarkVisible(const QVector<VPieceNode> &path, int passmarkIndex) const;
bool IsPassmarkVisible(const QVector<VPieceNode> &path, vsizetype passmarkIndex) const;
VPassmark CreatePassmark(const QVector<VPieceNode> &path, int previousIndex, int passmarkIndex, int nextIndex,
const VContainer *data) const;
VPassmark CreatePassmark(const QVector<VPieceNode> &path, vsizetype previousIndex, vsizetype passmarkIndex,
vsizetype nextIndex, const VContainer *data) const;
static int IsCSAStart(const QVector<CustomSARecord> &records, quint32 id);

View File

@ -300,19 +300,19 @@ void VPiecePath::Clear()
}
//---------------------------------------------------------------------------------------------------------------------
qint32 VPiecePath::CountNodes() const
vsizetype VPiecePath::CountNodes() const
{
return d->m_nodes.size();
}
//---------------------------------------------------------------------------------------------------------------------
VPieceNode &VPiecePath::operator[](int indx)
VPieceNode &VPiecePath::operator[](vsizetype indx)
{
return d->m_nodes[indx];
}
//---------------------------------------------------------------------------------------------------------------------
const VPieceNode &VPiecePath::at(int indx) const
const VPieceNode &VPiecePath::at(vsizetype indx) const
{
return d->m_nodes.at(indx);
}
@ -591,7 +591,7 @@ QVector<QPainterPath> VPiecePath::CurvesPainterPath(const VContainer *data) cons
}
//---------------------------------------------------------------------------------------------------------------------
VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i)
VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, vsizetype i)
{
if (i < 0 || i > nodes.size()-1)
{
@ -615,7 +615,7 @@ VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector<VPieceNo
if (nodes.size() > 1)
{
const int index = FindInLoopNotExcludedUp(i, nodes);
const vsizetype index = FindInLoopNotExcludedUp(i, nodes);
if (index != i && index != -1)
{
@ -626,7 +626,7 @@ VSAPoint VPiecePath::StartSegment(const VContainer *data, const QVector<VPieceNo
}
//---------------------------------------------------------------------------------------------------------------------
VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i)
VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, vsizetype i)
{
if (i < 0 || i > nodes.size()-1)
{
@ -650,7 +650,7 @@ VSAPoint VPiecePath::EndSegment(const VContainer *data, const QVector<VPieceNode
if (nodes.size() > 2)
{
const int index = FindInLoopNotExcludedDown(i, nodes);
const vsizetype index = FindInLoopNotExcludedDown(i, nodes);
if (index != i && index != -1)
{
@ -775,7 +775,7 @@ bool VPiecePath::OnEdge(quint32 p1, quint32 p2) const
return false;
}
int i = IndexOfNode(list, p1);
int j1 = 0, j2 = 0;
vsizetype j1 = 0, j2 = 0;
if (i == list.size() - 1)
{
@ -811,7 +811,7 @@ bool VPiecePath::OnEdge(quint32 p1, quint32 p2) const
* @param p2 id second point.
* @return edge index or -1 if points don't located on edge
*/
int VPiecePath::Edge(quint32 p1, quint32 p2) const
vsizetype VPiecePath::Edge(quint32 p1, quint32 p2) const
{
if (OnEdge(p1, p2) == false)
{
@ -920,7 +920,7 @@ QPointF VPiecePath::NodePreviousPoint(const VContainer *data, int i) const
if (d->m_nodes.size() > 1)
{
int index = 0;
vsizetype index = 0;
if (i == 0)
{
index = d->m_nodes.size()-1;
@ -1056,14 +1056,14 @@ int VPiecePath::indexOfNode(const QVector<VPieceNode> &nodes, quint32 id)
}
//---------------------------------------------------------------------------------------------------------------------
int VPiecePath::FindInLoopNotExcludedUp(int start, const QVector<VPieceNode> &nodes)
vsizetype VPiecePath::FindInLoopNotExcludedUp(vsizetype start, const QVector<VPieceNode> &nodes)
{
if (start < 0 || start >= nodes.size())
{
return -1;
}
int i = (start == 0) ? nodes.size()-1 : start-1;
vsizetype i = (start == 0) ? nodes.size()-1 : start-1;
if (i < 0 || i >= nodes.size())
{
@ -1092,14 +1092,14 @@ int VPiecePath::FindInLoopNotExcludedUp(int start, const QVector<VPieceNode> &no
}
//---------------------------------------------------------------------------------------------------------------------
int VPiecePath::FindInLoopNotExcludedDown(int start, const QVector<VPieceNode> &nodes)
vsizetype VPiecePath::FindInLoopNotExcludedDown(vsizetype start, const QVector<VPieceNode> &nodes)
{
if (start < 0 || start >= nodes.size())
{
return -1;
}
int i = (start == nodes.size()-1) ? 0 : start+1;
vsizetype i = (start == nodes.size()-1) ? 0 : start+1;
if (i < 0 || i >= nodes.size())
{
@ -1147,7 +1147,7 @@ VSAPoint VPiecePath::PreparePointEkv(const VPieceNode &node, const VContainer *d
//---------------------------------------------------------------------------------------------------------------------
QVector<VSAPoint> VPiecePath::CurveSeamAllowanceSegment(const VContainer *data, const QVector<VPieceNode> &nodes,
const QSharedPointer<VAbstractCurve> &curve, int i,
const QSharedPointer<VAbstractCurve> &curve, vsizetype i,
bool reverse, qreal width, const QString &piece)
{
const VSAPoint begin = StartSegment(data, nodes, i);
@ -1245,7 +1245,7 @@ QVector<VSAPoint> VPiecePath::CurveSeamAllowanceSegment(const VContainer *data,
}
//---------------------------------------------------------------------------------------------------------------------
QString VPiecePath::NodeName(const QVector<VPieceNode> &nodes, int nodeIndex, const VContainer *data)
QString VPiecePath::NodeName(const QVector<VPieceNode> &nodes, vsizetype nodeIndex, const VContainer *data)
{
if (not nodes.isEmpty() && (nodeIndex < 0 || nodeIndex >= nodes.size()))
{

View File

@ -61,10 +61,10 @@ public:
void Append(const VPieceNode &node);
void Clear();
qint32 CountNodes() const;
vsizetype CountNodes() const;
VPieceNode & operator[](int indx);
const VPieceNode & at ( int indx ) const;
VPieceNode & operator[](vsizetype indx);
const VPieceNode & at (vsizetype indx ) const;
QVector<VPieceNode> GetNodes() const;
void SetNodes(const QVector<VPieceNode> &nodes);
@ -108,7 +108,7 @@ public:
void NodeOnEdge(quint32 index, VPieceNode &p1, VPieceNode &p2) const;
bool Contains(quint32 id) const;
bool OnEdge(quint32 p1, quint32 p2) const;
int Edge(quint32 p1, quint32 p2) const;
vsizetype Edge(quint32 p1, quint32 p2) const;
QVector<VPieceNode> ListNodePoint() const;
@ -124,20 +124,20 @@ public:
static int indexOfNode(const QVector<VPieceNode> &nodes, quint32 id);
static int FindInLoopNotExcludedUp(int start, const QVector<VPieceNode> &nodes);
static int FindInLoopNotExcludedDown(int start, const QVector<VPieceNode> &nodes);
static vsizetype FindInLoopNotExcludedUp(vsizetype start, const QVector<VPieceNode> &nodes);
static vsizetype FindInLoopNotExcludedDown(vsizetype start, const QVector<VPieceNode> &nodes);
static VSAPoint StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i);
static VSAPoint EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, int i);
static VSAPoint StartSegment(const VContainer *data, const QVector<VPieceNode> &nodes, vsizetype i);
static VSAPoint EndSegment(const VContainer *data, const QVector<VPieceNode> &nodes, vsizetype i);
static VSAPoint PreparePointEkv(const VPieceNode &node, const VContainer *data);
static QVector<VSAPoint> CurveSeamAllowanceSegment(const VContainer *data, const QVector<VPieceNode> &nodes,
const QSharedPointer<VAbstractCurve> &curve,
int i, bool reverse, qreal width,
vsizetype i, bool reverse, qreal width,
const QString &piece = QString());
static QString NodeName(const QVector<VPieceNode> &nodes, int nodeIndex, const VContainer *data);
static QString NodeName(const QVector<VPieceNode> &nodes, vsizetype nodeIndex, const VContainer *data);
static QVector<VLayoutPoint> NodesToPoints(const VContainer *data, const QVector<VPieceNode> &nodes,
const QString &piece = QString());

View File

@ -56,8 +56,8 @@ VTranslateMeasurements::~VTranslateMeasurements()
* @param bias hold change of length between translated and origin token string
* @return true if was found measurement with same name.
*/
bool VTranslateMeasurements::MeasurementsFromUser(QString &newFormula, int position, const QString &token,
int &bias) const
bool VTranslateMeasurements::MeasurementsFromUser(QString &newFormula, vsizetype position, const QString &token,
vsizetype &bias) const
{
QMap<QString, qmu::QmuTranslation>::const_iterator i = measurements.constBegin();
while (i != measurements.constEnd())

View File

@ -42,7 +42,7 @@ public:
VTranslateMeasurements();
virtual ~VTranslateMeasurements();
bool MeasurementsFromUser(QString &newFormula, int position, const QString &token, int &bias) const;
bool MeasurementsFromUser(QString &newFormula, vsizetype position, const QString &token, vsizetype &bias) const;
QString MFromUser(const QString &measurement) const;
QString MToUser(const QString &measurement) const;

View File

@ -623,8 +623,8 @@ void VTranslateVars::InitSystem(const QString &code, const qmu::QmuTranslation &
* @param tokens all tokens
* @param numbers all numbers
*/
void VTranslateVars::CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens,
QMap<int, QString> &numbers)
void VTranslateVars::CorrectionsPositions(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers)
{
if (bias == 0)
{
@ -636,14 +636,14 @@ void VTranslateVars::CorrectionsPositions(int position, int bias, QMap<int, QStr
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::TranslateVarsFromUser(QString &newFormula, QMap<int, QString> &tokens,
QMap<int, QString> &numbers) const
void VTranslateVars::TranslateVarsFromUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers) const
{
QList<int> tKeys = tokens.keys();// Take all tokens positions
QList<vsizetype> tKeys = tokens.keys();// Take all tokens positions
QList<QString> tValues = tokens.values();
for (int i = 0; i < tKeys.size(); ++i)
for (vsizetype i = 0; i < tKeys.size(); ++i)
{
int bias = 0;
vsizetype bias = 0;
if (MeasurementsFromUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
@ -685,13 +685,13 @@ void VTranslateVars::TranslateVarsFromUser(QString &newFormula, QMap<int, QStrin
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::TranslateNumbersFromUser(QString &newFormula, QMap<int, QString> &tokens,
QMap<int, QString> &numbers, bool osSeparator)
void VTranslateVars::TranslateNumbersFromUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers, bool osSeparator)
{
QLocale loc = QLocale(); // User locale
if (loc != QLocale::c() && osSeparator)
{// User want use Os separator
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
QList<vsizetype> nKeys = numbers.keys();// Positions for all numbers in expression
QList<QString> nValues = numbers.values();
for (int i = 0; i < nKeys.size(); ++i)
{
@ -707,7 +707,7 @@ void VTranslateVars::TranslateNumbersFromUser(QString &newFormula, QMap<int, QSt
loc = QLocale::c();// To internal locale
const QString dStr = loc.toString(d);// Internal look for number
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
const int bias = nValues.at(i).length() - dStr.length();
const auto bias = nValues.at(i).length() - dStr.length();
if (bias != 0)
{// Translated number has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
@ -719,19 +719,19 @@ void VTranslateVars::TranslateNumbersFromUser(QString &newFormula, QMap<int, QSt
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<int, QString> &tokens,
QMap<int, QString> &numbers) const
void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers) const
{
QList<int> tKeys = tokens.keys();
QList<vsizetype> tKeys = tokens.keys();
QList<QString> tValues = tokens.values();
for (int i = 0; i < tKeys.size(); ++i)
for (vsizetype i = 0; i < tKeys.size(); ++i)
{
if (measurements.contains(tValues.at(i)))
{
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
measurements.value(tValues.at(i))
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
int bias = tValues.at(i).length() -
auto bias = tValues.at(i).length() -
measurements.value(tValues.at(i))
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length();
if (bias != 0)
@ -748,7 +748,7 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<int, QString>
newFormula.replace(tKeys.at(i), tValues.at(i).length(),
functions.value(tValues.at(i))
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()));
int bias = tValues.at(i).length() -
auto bias = tValues.at(i).length() -
functions.value(tValues.at(i))
.translate(VAbstractApplication::VApp()->Settings()->GetLocale()).length();
if (bias != 0)
@ -760,7 +760,7 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<int, QString>
continue;
}
int bias = 0;
vsizetype bias = 0;
if (VariablesToUser(newFormula, tKeys.at(i), tValues.at(i), bias))
{
if (bias != 0)
@ -780,13 +780,13 @@ void VTranslateVars::TranslateVarsToUser(QString &newFormula, QMap<int, QString>
}
//---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::TranslateNumbersToUser(QString &newFormula, QMap<int, QString> &tokens,
QMap<int, QString> &numbers, bool osSeparator)
void VTranslateVars::TranslateNumbersToUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers, bool osSeparator)
{
QLocale loc = QLocale();// User locale
if (loc != QLocale::C && osSeparator)
{// User want use Os separator
QList<int> nKeys = numbers.keys();// Positions for all numbers in expression
QList<vsizetype> nKeys = numbers.keys();// Positions for all numbers in expression
QList<QString> nValues = numbers.values();
for (int i = 0; i < nKeys.size(); ++i)
{
@ -806,7 +806,7 @@ void VTranslateVars::TranslateNumbersToUser(QString &newFormula, QMap<int, QStri
dStr.replace(loc.groupSeparator(), QString());
}
newFormula.replace(nKeys.at(i), nValues.at(i).length(), dStr);
const int bias = nValues.at(i).length() - dStr.length();
const auto bias = nValues.at(i).length() - dStr.length();
if (bias != 0)
{// Translated number has different length than original. Position next tokens need to be corrected.
CorrectionsPositions(nKeys.at(i), bias, tokens, numbers);
@ -824,10 +824,10 @@ void VTranslateVars::TranslateNumbersToUser(QString &newFormula, QMap<int, QStri
* @param bias difference between original token length and translated
* @param tokens all tokens
*/
void VTranslateVars::BiasTokens(int position, int bias, QMap<int, QString> &tokens)
void VTranslateVars::BiasTokens(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens)
{
QMap<int, QString> newTokens;
QMap<int, QString>::const_iterator i = tokens.constBegin();
QMap<vsizetype, QString> newTokens;
QMap<vsizetype, QString>::const_iterator i = tokens.constBegin();
while (i != tokens.constEnd())
{
if (i.key()<= position)
@ -854,7 +854,8 @@ void VTranslateVars::BiasTokens(int position, int bias, QMap<int, QString> &toke
* @param bias hold change of length between translated and origin token string
* @return true if was found variable with same name.
*/
auto VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const -> bool
auto VTranslateVars::VariablesFromUser(QString &newFormula, vsizetype position, const QString &token,
vsizetype &bias) const -> bool
{
const QString currentLengthTr =
variables.value(currentLength).translate(VAbstractApplication::VApp()->Settings()->GetLocale());
@ -895,7 +896,8 @@ auto VTranslateVars::VariablesFromUser(QString &newFormula, int position, const
* @param bias hold change of length between translated and origin token string
* @return true if was found function with same name.
*/
auto VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const -> bool
auto VTranslateVars::FunctionsFromUser(QString &newFormula, vsizetype position, const QString &token,
vsizetype &bias) const -> bool
{
QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
while (i != functions.constEnd())
@ -920,7 +922,8 @@ auto VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const
* @param bias hold change of length between translated and origin token string
* @return true if was found variable with same name.
*/
auto VTranslateVars::VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const -> bool
auto VTranslateVars::VariablesToUser(QString &newFormula, vsizetype position, const QString &token,
vsizetype &bias) const -> bool
{
QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
while (i != variables.constEnd())
@ -951,7 +954,7 @@ auto VTranslateVars::VariablesToUser(QString &newFormula, int position, const QS
auto VTranslateVars::InternalVarToUser(const QString &var) const -> QString
{
QString newVar = var;
int bias = 0;
vsizetype bias = 0;
if (VariablesToUser(newVar, 0, var, bias))
{
return newVar;
@ -990,7 +993,7 @@ auto VTranslateVars::VarFromUser(const QString &var) const -> QString
}
QString newVar = var;
int bias = 0;
vsizetype bias = 0;
if (MeasurementsFromUser(newVar, 0, var, bias))
{
return newVar;
@ -1044,8 +1047,8 @@ auto VTranslateVars::FormulaFromUser(const QString &formula, bool osSeparator) c
// Eval formula
QScopedPointer<qmu::QmuTokenParser> cal(
new qmu::QmuTokenParser(formula, osSeparator, true, GetTranslatedFunctions()));
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
QMap<int, QString> numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
QMap<vsizetype, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
QMap<vsizetype, QString> numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
delete cal.take();
QString newFormula = formula;// Local copy for making changes
@ -1087,8 +1090,8 @@ auto VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator) con
QString newFormula = formula;// Local copy for making changes
QMap<int, QString> tokens;
QMap<int, QString> numbers;
QMap<vsizetype, QString> tokens;
QMap<vsizetype, QString> numbers;
try
{
QScopedPointer<qmu::QmuTokenParser> cal(new qmu::QmuTokenParser(formula, false, false));// Eval formula

View File

@ -41,9 +41,11 @@ public:
explicit VTranslateVars();
~VTranslateVars() override = default;
auto VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const -> bool;
auto FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const -> bool;
auto VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const -> bool;
auto VariablesFromUser(QString &newFormula, vsizetype position, const QString &token,
vsizetype &bias) const -> bool;
auto FunctionsFromUser(QString &newFormula, vsizetype position, const QString &token,
vsizetype &bias) const -> bool;
auto VariablesToUser(QString &newFormula, vsizetype position, const QString &token, vsizetype &bias) const -> bool;
auto InternalVarToUser(const QString &var) const -> QString;
@ -67,7 +69,7 @@ public:
auto GetFunctionsDescriptions() const -> QMap<QString, qmu::QmuTranslation>;
auto GetFunctionsArguments() const -> QMap<QString, QString>;
static void BiasTokens(int position, int bias, QMap<int, QString> &tokens);
static void BiasTokens(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens);
private:
// cppcheck-suppress unknownMacro
@ -91,15 +93,18 @@ private:
void InitSystem(const QString &code, const qmu::QmuTranslation &name, const qmu::QmuTranslation &author,
const qmu::QmuTranslation &book);
static void CorrectionsPositions(int position, int bias, QMap<int, QString> &tokens, QMap<int, QString> &numbers);
static void CorrectionsPositions(vsizetype position, vsizetype bias, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers);
void TranslateVarsFromUser(QString &newFormula, QMap<int, QString> &tokens, QMap<int, QString> &numbers) const;
static void TranslateNumbersFromUser(QString &newFormula, QMap<int, QString> &tokens, QMap<int, QString> &numbers,
bool osSeparator);
void TranslateVarsFromUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers) const;
static void TranslateNumbersFromUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers, bool osSeparator);
void TranslateVarsToUser(QString &newFormula, QMap<int, QString> &tokens, QMap<int, QString> &numbers) const;
static void TranslateNumbersToUser(QString &newFormula, QMap<int, QString> &tokens, QMap<int, QString> &numbers,
bool osSeparator);
void TranslateVarsToUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers) const;
static void TranslateNumbersToUser(QString &newFormula, QMap<vsizetype, QString> &tokens,
QMap<vsizetype, QString> &numbers, bool osSeparator);
};
#endif // VTRANSLATEVARS_H

View File

@ -162,7 +162,7 @@ VPE::VProperty *VPE::VLineColorProperty::clone(bool include_children, VProperty
return VProperty::clone(include_children, container ? container : new VLineColorProperty(getName()));
}
int VPE::VLineColorProperty::IndexOfColor(const QMap<QString, QString> &colors, const QString &color)
vpesizetype VPE::VLineColorProperty::IndexOfColor(const QMap<QString, QString> &colors, const QString &color)
{
QVector<QString> indexList;
QMap<QString, QString>::const_iterator i = colors.constBegin();

View File

@ -90,7 +90,7 @@ public:
Q_REQUIRED_RESULT virtual VProperty* clone(bool include_children = true,
VProperty* container = nullptr) const override;
static int IndexOfColor(const QMap<QString, QString> &colors, const QString &color);
static vpesizetype IndexOfColor(const QMap<QString, QString> &colors, const QString &color);
public slots:
void currentIndexChanged(int index);

View File

@ -155,7 +155,7 @@ VPE::VProperty *VPE::VLineTypeProperty::clone(bool include_children, VProperty *
return VProperty::clone(include_children, container ? container : new VLineTypeProperty(getName()));
}
int VPE::VLineTypeProperty::IndexOfStyle(const QMap<QString, QIcon> &styles, const QString &style)
vpesizetype VPE::VLineTypeProperty::IndexOfStyle(const QMap<QString, QIcon> &styles, const QString &style)
{
QVector<QString> indexList;
QMap<QString, QIcon>::const_iterator i = styles.constBegin();

View File

@ -91,7 +91,7 @@ public:
Q_REQUIRED_RESULT virtual VProperty* clone(bool include_children = true,
VProperty* container = nullptr) const override;
static int IndexOfStyle(const QMap<QString, QIcon> &styles, const QString &style);
static vpesizetype IndexOfStyle(const QMap<QString, QIcon> &styles, const QString &style);
public slots:
void currentIndexChanged(int index);

View File

@ -249,7 +249,7 @@ VPE::VProperty* VPE::VProperty::getChild(int row) const
}
//! Gets the number of children
int VPE::VProperty::getRowCount() const
vpesizetype VPE::VProperty::getRowCount() const
{
return d_ptr->Children.count();
}
@ -282,7 +282,7 @@ void VPE::VProperty::setParent(VProperty* parent)
}
}
int VPE::VProperty::addChild(VProperty *child)
vpesizetype VPE::VProperty::addChild(VProperty *child)
{
if (child && child->getParent() != this)
{
@ -312,7 +312,7 @@ void VPE::VProperty::removeChild(VProperty* child)
}
//! Returns the row the child has
int VPE::VProperty::getChildRow(VProperty* child) const
vpesizetype VPE::VProperty::getChildRow(VProperty* child) const
{
return d_ptr->Children.indexOf(child);
}

View File

@ -152,7 +152,7 @@ public:
virtual QString getDescription() const;
//! Adds a child to this property
virtual int addChild(VProperty* child);
virtual vpesizetype addChild(VProperty* child);
//! Returns a reference to the list of children
virtual QList<VProperty*>& getChildren();
@ -164,7 +164,7 @@ public:
virtual VProperty* getChild(int row) const;
//! Gets the number of children
virtual int getRowCount() const;
virtual vpesizetype getRowCount() const;
//! Gets the parent of this property
virtual VProperty* getParent() const;
@ -176,7 +176,7 @@ public:
virtual void removeChild(VProperty* child);
//! Returns the row the child has
virtual int getChildRow(VProperty* child) const;
virtual vpesizetype getChildRow(VProperty* child) const;
//! Returns whether the views have to update the parent of this property if it changes
virtual bool getUpdateParent() const;

View File

@ -0,0 +1,38 @@
/************************************************************************
**
** @file vpropertydef.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 1 2, 2023
**
** @brief
** @copyright
** This source code is part of the Valentina project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2023 Valentina project
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#ifndef VPROPERTYDEF_H
#define VPROPERTYDEF_H
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtGlobal>
using vpesizetype = qsizetype;
#else
using vpesizetype = int;
#endif
#endif // VPROPERTYDEF_H

View File

@ -7,6 +7,7 @@ VDynamicLib {
version: "1.0.0"
files: [
"vproperty.cpp",
"vpropertydef.h",
"vpropertydelegate.cpp",
"vpropertyfactorymanager.cpp",
"vpropertyformview.cpp",

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