Refactoring.
Replace declarations by a structured binding declaration.
This commit is contained in:
parent
e5295c0665
commit
5e56f30fb1
|
@ -101,9 +101,9 @@ DialogSaveManualLayout::DialogSaveManualLayout(vsizetype count, bool consoleExpo
|
|||
}
|
||||
}
|
||||
|
||||
for (auto &v : InitFormats())
|
||||
for (auto &[first, second] : InitFormats())
|
||||
{
|
||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||
ui->comboBoxFormat->addItem(first, QVariant(static_cast<int>(second)));
|
||||
}
|
||||
#ifdef V_NO_ASSERT // Temporarily unavailable
|
||||
RemoveFormatFromList(LayoutExportFormats::OBJ);
|
||||
|
|
|
@ -244,8 +244,8 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
|||
|
||||
painter->save();
|
||||
|
||||
const QPair<qreal, qreal> scale = VPrintLayout::PrinterScaleDiff(printer);
|
||||
painter->scale(scale.first, scale.second);
|
||||
const auto [xscale, yscale] = VPrintLayout::PrinterScaleDiff(printer);
|
||||
painter->scale(xscale, yscale);
|
||||
|
||||
if (row > 0)
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ void VPTileFactory::drawTile(QPainter *painter, QPrinter *printer, const VPSheet
|
|||
DrawSolidBottomLine(painter, col, nbCol);
|
||||
}
|
||||
|
||||
DrawRuler(painter, scale.first);
|
||||
DrawRuler(painter, xscale);
|
||||
DrawWatermark(painter);
|
||||
|
||||
if (col < nbCol - 1)
|
||||
|
|
|
@ -715,11 +715,11 @@ auto DialogIncrements::IncrementUsed(const QString &name) const -> bool
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogIncrements::CacheRename(const QString &name, const QString &newName)
|
||||
{
|
||||
for (auto &i : m_renameList)
|
||||
for (auto &[first, second] : m_renameList)
|
||||
{
|
||||
if (i.second == name)
|
||||
if (second == name)
|
||||
{
|
||||
i.second = newName;
|
||||
second = newName;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1354,9 +1354,9 @@ void DialogIncrements::RefreshPattern()
|
|||
if (m_hasChanges)
|
||||
{
|
||||
QVector<VFormulaField> expressions = m_doc->ListExpressions();
|
||||
for (auto &item : m_renameList)
|
||||
for (auto &[first, second] : m_renameList)
|
||||
{
|
||||
m_doc->ReplaceNameInFormula(expressions, item.first, item.second);
|
||||
m_doc->ReplaceNameInFormula(expressions, first, second);
|
||||
}
|
||||
m_renameList.clear();
|
||||
|
||||
|
|
|
@ -105,9 +105,9 @@ DialogSaveLayout::DialogSaveLayout(int count, Draw mode, const QString &fileName
|
|||
}
|
||||
}
|
||||
|
||||
for (auto &v : InitFormats())
|
||||
for (auto &[first, second] : InitFormats())
|
||||
{
|
||||
ui->comboBoxFormat->addItem(v.first, QVariant(static_cast<int>(v.second)));
|
||||
ui->comboBoxFormat->addItem(first, QVariant(static_cast<int>(second)));
|
||||
}
|
||||
#ifdef V_NO_ASSERT // Temporarily unavailable
|
||||
RemoveFormatFromList(LayoutExportFormats::OBJ);
|
||||
|
|
|
@ -500,8 +500,8 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement)
|
|||
{
|
||||
VContainer::UpdateId(GetParametrUInt(domElement, AttrId, NULL_ID_STR), valentinaNamespace);
|
||||
|
||||
const QPair<bool, QMap<quint32, quint32>> groupData = ParseItemElement(domElement);
|
||||
const QMap<quint32, quint32> group = groupData.second;
|
||||
const auto [groupDataFirst, groupDataSecond] = ParseItemElement(domElement);
|
||||
const QMap<quint32, quint32> group = groupDataSecond;
|
||||
auto i = group.constBegin();
|
||||
while (i != group.constEnd())
|
||||
{
|
||||
|
@ -511,7 +511,7 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement)
|
|||
}
|
||||
|
||||
const bool previous = itemVisibility.value(i.key(), false);
|
||||
itemVisibility.insert(i.key(), previous || groupData.first);
|
||||
itemVisibility.insert(i.key(), previous || groupDataFirst);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,12 +81,12 @@ void DRW_TextCodec::setVersion(DRW::Version v, bool dxfFormat)
|
|||
void DRW_TextCodec::setVersion(const std::string &v, bool dxfFormat)
|
||||
{
|
||||
version = DRW::UNKNOWNV;
|
||||
for (auto dwgVersionString : DRW::dwgVersionStrings)
|
||||
for (auto [first, second] : DRW::dwgVersionStrings)
|
||||
{
|
||||
if (std::strcmp(v.c_str(), dwgVersionString.first) == 0)
|
||||
if (std::strcmp(v.c_str(), first) == 0)
|
||||
{
|
||||
version = dwgVersionString.second;
|
||||
setVersion(dwgVersionString.second, dxfFormat);
|
||||
version = second;
|
||||
setVersion(second, dxfFormat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -611,18 +611,18 @@ auto VAbstractCurve::ShowDirection(const QVector<DirectionArrow> &arrows, qreal
|
|||
{
|
||||
QPainterPath path;
|
||||
|
||||
for (const auto &arrow : arrows)
|
||||
for (const auto &[first, second] : arrows)
|
||||
{
|
||||
if (not arrow.first.isNull() && not arrow.second.isNull())
|
||||
if (not first.isNull() && not second.isNull())
|
||||
{
|
||||
QPainterPath arrowPath;
|
||||
|
||||
QLineF line = arrow.first;
|
||||
QLineF line = first;
|
||||
line.setLength(width);
|
||||
arrowPath.moveTo(line.p1());
|
||||
arrowPath.lineTo(line.p2());
|
||||
|
||||
line = arrow.second;
|
||||
line = second;
|
||||
line.setLength(width);
|
||||
arrowPath.moveTo(line.p1());
|
||||
arrowPath.lineTo(line.p2());
|
||||
|
|
|
@ -758,9 +758,9 @@ auto VPrintLayout::SceneTargetRect(QPrinter *printer, const QRectF &source) -> Q
|
|||
y = 0;
|
||||
}
|
||||
|
||||
QPair<qreal, qreal> const scaleDiff = PrinterScaleDiff(printer);
|
||||
const double xscale = scaleDiff.first;
|
||||
const double yscale = scaleDiff.second;
|
||||
auto const [scaleDiffFirst, scaleDiffSecond] = PrinterScaleDiff(printer);
|
||||
const double xscale = scaleDiffFirst;
|
||||
const double yscale = scaleDiffSecond;
|
||||
|
||||
return {x * xscale, y * yscale, source.width() * xscale, source.height() * yscale};
|
||||
}
|
||||
|
|
|
@ -381,11 +381,11 @@ void DialogCurveIntersectAxis::ValidateAlias()
|
|||
QRegularExpression const rx(NameRegExp());
|
||||
|
||||
const QSharedPointer<VAbstractCurve> curve = data->GeometricObject<VAbstractCurve>(getCurveId());
|
||||
QPair<QString, QString> const alias = SegmentAliases(curve->getType(), GetAliasSuffix1(), GetAliasSuffix2());
|
||||
auto const [aliasFirst, aliasSecond] = SegmentAliases(curve->getType(), GetAliasSuffix1(), GetAliasSuffix2());
|
||||
|
||||
if (not GetAliasSuffix1().isEmpty() &&
|
||||
(not rx.match(alias.first).hasMatch() ||
|
||||
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(alias.first)) || alias.first == alias.second))
|
||||
(not rx.match(aliasFirst).hasMatch() ||
|
||||
(originAliasSuffix1 != GetAliasSuffix1() && not data->IsUnique(aliasFirst)) || aliasFirst == aliasSecond))
|
||||
{
|
||||
flagAlias1 = false;
|
||||
ChangeColor(ui->labelAlias1, errorColor);
|
||||
|
@ -397,8 +397,8 @@ void DialogCurveIntersectAxis::ValidateAlias()
|
|||
}
|
||||
|
||||
if (not GetAliasSuffix2().isEmpty() &&
|
||||
(not rx.match(alias.second).hasMatch() ||
|
||||
(originAliasSuffix2 != GetAliasSuffix2() && not data->IsUnique(alias.second)) || alias.first == alias.second))
|
||||
(not rx.match(aliasSecond).hasMatch() ||
|
||||
(originAliasSuffix2 != GetAliasSuffix2() && not data->IsUnique(aliasSecond)) || aliasFirst == aliasSecond))
|
||||
{
|
||||
flagAlias2 = false;
|
||||
ChangeColor(ui->labelAlias2, errorColor);
|
||||
|
|
|
@ -255,11 +255,11 @@ void DialogPointOfIntersectionCurves::ValidateAlias()
|
|||
QRegularExpression const rx(NameRegExp());
|
||||
|
||||
const QSharedPointer<VAbstractCurve> curve1 = data->GeometricObject<VAbstractCurve>(GetFirstCurveId());
|
||||
QPair<QString, QString> const curve1Alias =
|
||||
auto const [curve1AliasFirst, curve1AliasSecond] =
|
||||
SegmentAliases(curve1->getType(), GetCurve1AliasSuffix1(), GetCurve1AliasSuffix2());
|
||||
|
||||
const QSharedPointer<VAbstractCurve> curve2 = data->GeometricObject<VAbstractCurve>(GetSecondCurveId());
|
||||
QPair<QString, QString> const curve2Alias =
|
||||
auto const [curve2AliasFirst, curve2AliasSecond] =
|
||||
SegmentAliases(curve2->getType(), GetCurve2AliasSuffix1(), GetCurve2AliasSuffix2());
|
||||
|
||||
QSet<QString> uniqueAliases;
|
||||
|
@ -274,10 +274,10 @@ void DialogPointOfIntersectionCurves::ValidateAlias()
|
|||
}
|
||||
};
|
||||
|
||||
CountUniqueAliases(curve1Alias.first);
|
||||
CountUniqueAliases(curve1Alias.second);
|
||||
CountUniqueAliases(curve2Alias.first);
|
||||
CountUniqueAliases(curve2Alias.second);
|
||||
CountUniqueAliases(curve1AliasFirst);
|
||||
CountUniqueAliases(curve1AliasSecond);
|
||||
CountUniqueAliases(curve2AliasFirst);
|
||||
CountUniqueAliases(curve2AliasSecond);
|
||||
|
||||
auto Validate = [countAliases, uniqueAliases, rx, this](const QString &originalSuffix, const QString &suffix,
|
||||
const QString &alias, bool &flagAlias, QLabel *label)
|
||||
|
@ -296,13 +296,13 @@ void DialogPointOfIntersectionCurves::ValidateAlias()
|
|||
}
|
||||
};
|
||||
|
||||
Validate(originCurve1AliasSuffix1, GetCurve1AliasSuffix1(), curve1Alias.first, flagCurve1Alias1,
|
||||
Validate(originCurve1AliasSuffix1, GetCurve1AliasSuffix1(), curve1AliasFirst, flagCurve1Alias1,
|
||||
ui->labelCurve1Alias1);
|
||||
Validate(originCurve1AliasSuffix2, GetCurve1AliasSuffix2(), curve1Alias.second, flagCurve1Alias2,
|
||||
Validate(originCurve1AliasSuffix2, GetCurve1AliasSuffix2(), curve1AliasSecond, flagCurve1Alias2,
|
||||
ui->labelCurve1Alias2);
|
||||
Validate(originCurve2AliasSuffix1, GetCurve2AliasSuffix1(), curve2Alias.first, flagCurve2Alias1,
|
||||
Validate(originCurve2AliasSuffix1, GetCurve2AliasSuffix1(), curve2AliasFirst, flagCurve2Alias1,
|
||||
ui->labelCurve2Alias1);
|
||||
Validate(originCurve2AliasSuffix2, GetCurve2AliasSuffix2(), curve2Alias.second, flagCurve2Alias2,
|
||||
Validate(originCurve2AliasSuffix2, GetCurve2AliasSuffix2(), curve2AliasSecond, flagCurve2Alias2,
|
||||
ui->labelCurve2Alias2);
|
||||
|
||||
CheckState();
|
||||
|
|
|
@ -4974,8 +4974,8 @@ void DialogSeamAllowance::InitGradationPlaceholdersMenu()
|
|||
auto i = m_gradationPlaceholders.constBegin();
|
||||
while (i != m_gradationPlaceholders.constEnd())
|
||||
{
|
||||
auto value = i.value();
|
||||
QAction *action = m_placeholdersMenu->addAction(value.first);
|
||||
auto [first, second] = i.value();
|
||||
QAction *action = m_placeholdersMenu->addAction(first);
|
||||
action->setData(per + i.key() + per);
|
||||
connect(action, &QAction::triggered, this, &DialogSeamAllowance::InsertGradationPlaceholder);
|
||||
++i;
|
||||
|
|
|
@ -1120,15 +1120,15 @@ void CreateUnitedNodes(VPiece &newDetail, const VPiece &d1, const VPiece &d2, co
|
|||
QVector<quint32> children;
|
||||
VPiecePath newPath;
|
||||
|
||||
for (const auto &path : unitedPath)
|
||||
for (const auto &[first, second] : unitedPath)
|
||||
{
|
||||
if (path.first)
|
||||
if (first)
|
||||
{ // first piece
|
||||
AddNodeToNewPath(initData, newPath, path.second, children, drawName);
|
||||
AddNodeToNewPath(initData, newPath, second, children, drawName);
|
||||
}
|
||||
else
|
||||
{ // second piece
|
||||
AddNodeToNewPath(initData, newPath, path.second, children, drawName, dx, dy, pRotate, angle);
|
||||
AddNodeToNewPath(initData, newPath, second, children, drawName, dx, dy, pRotate, angle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1325,15 +1325,15 @@ void UpdateUnitedNodes(const VToolUnionDetailsInitData &initData, qreal dx, qrea
|
|||
{
|
||||
const auto unitedPath = VToolUnionDetails::CalcUnitedPath(d1REPath, d2REPath, initData.indexD2, pRotate);
|
||||
|
||||
for (const auto &path : unitedPath)
|
||||
for (const auto &[first, second] : unitedPath)
|
||||
{
|
||||
if (path.first)
|
||||
if (first)
|
||||
{ // first piece
|
||||
UpdatePathNode(initData.data, path.second, children);
|
||||
UpdatePathNode(initData.data, second, children);
|
||||
}
|
||||
else
|
||||
{ // second piece
|
||||
UpdatePathNode(initData.data, path.second, children, dx, dy, pRotate, angle);
|
||||
UpdatePathNode(initData.data, second, children, dx, dy, pRotate, angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,9 +145,9 @@ void DelTool::UpdateGroups(const QMap<quint32, VGroupData> &groups) const
|
|||
while (i != groups.constEnd())
|
||||
{
|
||||
QMap<vidtype, vidtype> groupMap;
|
||||
for (auto record : i.value().items)
|
||||
for (auto [first, second] : i.value().items)
|
||||
{
|
||||
groupMap.insert(record.first, record.second);
|
||||
groupMap.insert(first, second);
|
||||
}
|
||||
|
||||
QDomElement group = doc->CreateGroup(i.key(), i.value().name, i.value().tags, groupMap, i.value().tool);
|
||||
|
|
|
@ -322,12 +322,11 @@ void TST_TSLocaleTranslation::TestHTMLTags()
|
|||
std::make_pair(QRegularExpression(QStringLiteral("<body{1}.*>"), patternOption),
|
||||
QRegularExpression(QStringLiteral("</body{1}.*>"), patternOption))};
|
||||
|
||||
for (const auto ®ex : regexes)
|
||||
for (const auto &[start, end] : regexes)
|
||||
{
|
||||
if (source.contains(regex.first) &&
|
||||
(not translation.contains(regex.second) || translation.count(regex.second) != source.count(regex.first)))
|
||||
if (source.contains(start) && (not translation.contains(end) || translation.count(end) != source.count(start)))
|
||||
{
|
||||
const QString message = u"Tag mismatch. Pattern: '<%1>'. "_s.arg(regex.first.pattern()) +
|
||||
const QString message = u"Tag mismatch. Pattern: '<%1>'. "_s.arg(start.pattern()) +
|
||||
u"Original name:'%1'"_s.arg(source) + u", translated name:'%1'"_s.arg(translation);
|
||||
QFAIL(qUtf8Printable(message));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user