Use auto.

This commit is contained in:
Roman Telezhynskyi 2024-02-20 09:27:52 +02:00
parent d6fa5ddac0
commit faab23b0af
8 changed files with 771 additions and 786 deletions

View File

@ -1663,7 +1663,7 @@ void QmuParserBase::ClearVar()
*/
void QmuParserBase::RemoveVar(const QString &a_strVarName)
{
varmap_type::iterator const item = m_VarDef.find(a_strVarName);
auto const item = m_VarDef.find(a_strVarName);
if (item != m_VarDef.end())
{
m_VarDef.erase(item);

File diff suppressed because it is too large Load Diff

View File

@ -144,7 +144,7 @@ void dx_iface::writeBlocks()
void dx_iface::writeBlockRecords()
{
for (std::list<dx_ifaceBlock *>::iterator it = cData.blocks.begin(); it != cData.blocks.end(); ++it)
for (auto it = cData.blocks.begin(); it != cData.blocks.end(); ++it)
dxfW->writeBlockRecord((*it)->name);
}
@ -156,31 +156,31 @@ void dx_iface::writeEntities()
void dx_iface::writeLTypes()
{
for (std::list<DRW_LType>::iterator it = cData.lineTypes.begin(); it != cData.lineTypes.end(); ++it)
for (auto it = cData.lineTypes.begin(); it != cData.lineTypes.end(); ++it)
dxfW->writeLineType(&(*it));
}
void dx_iface::writeLayers()
{
for (std::list<DRW_Layer>::iterator it = cData.layers.begin(); it != cData.layers.end(); ++it)
for (auto it = cData.layers.begin(); it != cData.layers.end(); ++it)
dxfW->writeLayer(&(*it));
}
void dx_iface::writeTextstyles()
{
for (std::list<DRW_Textstyle>::iterator it = cData.textStyles.begin(); it != cData.textStyles.end(); ++it)
for (auto it = cData.textStyles.begin(); it != cData.textStyles.end(); ++it)
dxfW->writeTextstyle(&(*it));
}
void dx_iface::writeVports()
{
for (std::list<DRW_Vport>::iterator it = cData.VPorts.begin(); it != cData.VPorts.end(); ++it)
for (auto it = cData.VPorts.begin(); it != cData.VPorts.end(); ++it)
dxfW->writeVport(&(*it));
}
void dx_iface::writeDimstyles()
{
for (std::list<DRW_Dimstyle>::iterator it = cData.dimStyles.begin(); it != cData.dimStyles.end(); ++it)
for (auto it = cData.dimStyles.begin(); it != cData.dimStyles.end(); ++it)
dxfW->writeDimstyle(&(*it));
}

View File

@ -159,7 +159,7 @@ public:
extAxisY(),
curr(nullptr /*e.curr*/)
{
for (std::vector<DRW_Variant *>::const_iterator it = e.extData.begin(); it != e.extData.end(); ++it)
for (auto it = e.extData.begin(); it != e.extData.end(); ++it)
{
extData.push_back(new DRW_Variant(*(*it)));
}
@ -167,7 +167,7 @@ public:
virtual ~DRW_Entity()
{
for (std::vector<DRW_Variant *>::iterator it = extData.begin(); it != extData.end(); ++it)
for (auto it = extData.begin(); it != extData.end(); ++it)
delete *it;
extData.clear();
@ -175,7 +175,7 @@ public:
void reset()
{
for (std::vector<DRW_Variant *>::iterator it = extData.begin(); it != extData.end(); ++it)
for (auto it = extData.begin(); it != extData.end(); ++it)
delete *it;
extData.clear();
}
@ -666,7 +666,7 @@ public:
void applyExtrusion() override;
void addVertex(DRW_Vertex2D v)
{
DRW_Vertex2D *vert = new DRW_Vertex2D();
auto *vert = new DRW_Vertex2D();
vert->x = v.x;
vert->y = v.y;
vert->stawidth = v.stawidth;
@ -676,7 +676,7 @@ public:
}
auto addVertex() -> DRW_Vertex2D *
{
DRW_Vertex2D *vert = new DRW_Vertex2D();
auto *vert = new DRW_Vertex2D();
vert->stawidth = 0;
vert->endwidth = 0;
vert->bulge = 0;
@ -919,7 +919,7 @@ public:
}
void addVertex(DRW_Vertex v)
{
DRW_Vertex *vert = new DRW_Vertex();
auto *vert = new DRW_Vertex();
vert->basePoint.x = v.basePoint.x;
vert->basePoint.y = v.basePoint.y;
vert->basePoint.z = v.basePoint.z;

View File

@ -63,7 +63,7 @@ public:
virtual ~DRW_TableEntry()
{
for (std::vector<DRW_Variant *>::iterator it = extData.begin(); it != extData.end(); ++it)
for (auto it = extData.begin(); it != extData.end(); ++it)
{
delete *it;
}
@ -97,7 +97,7 @@ protected:
void reset()
{
flags = 0;
for (std::vector<DRW_Variant *>::iterator it = extData.begin(); it != extData.end(); ++it)
for (auto it = extData.begin(); it != extData.end(); ++it)
{
delete *it;
}

View File

@ -639,7 +639,7 @@ auto DRW_Conv932Table::toUtf8(const std::string &s) -> std::string
}
if (end > 0)
{
for (size_t k = static_cast<size_t>(sta); k < static_cast<size_t>(end); k++)
for (auto k = static_cast<size_t>(sta); k < static_cast<size_t>(end); k++)
{
if (DRW_DoubleTable932[k][0] == code)
{

View File

@ -1260,7 +1260,7 @@ auto dxfRW::writeHatch(DRW_Hatch *ent) -> bool
case DRW::LINE:
{
writer->writeInt16(72, 1);
DRW_Line *l = static_cast<DRW_Line *>(loop->objlist.at(static_cast<size_t>(j)));
auto *l = static_cast<DRW_Line *>(loop->objlist.at(static_cast<size_t>(j)));
writer->writeDouble(10, l->basePoint.x);
writer->writeDouble(20, l->basePoint.y);
writer->writeDouble(11, l->secPoint.x);
@ -1270,7 +1270,7 @@ auto dxfRW::writeHatch(DRW_Hatch *ent) -> bool
case DRW::ARC:
{
writer->writeInt16(72, 2);
DRW_Arc *a = static_cast<DRW_Arc *>(loop->objlist.at(static_cast<size_t>(j)));
auto *a = static_cast<DRW_Arc *>(loop->objlist.at(static_cast<size_t>(j)));
writer->writeDouble(10, a->basePoint.x);
writer->writeDouble(20, a->basePoint.y);
writer->writeDouble(40, a->radious);
@ -1282,7 +1282,7 @@ auto dxfRW::writeHatch(DRW_Hatch *ent) -> bool
case DRW::ELLIPSE:
{
writer->writeInt16(72, 3);
DRW_Ellipse *a = static_cast<DRW_Ellipse *>(loop->objlist.at(static_cast<size_t>(j)));
auto *a = static_cast<DRW_Ellipse *>(loop->objlist.at(static_cast<size_t>(j)));
a->correctAxis();
writer->writeDouble(10, a->basePoint.x);
writer->writeDouble(20, a->basePoint.y);
@ -1398,7 +1398,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
case DRW::DIMALIGNED:
case DRW::DIMLINEAR:
{
DRW_DimAligned *dd = static_cast<DRW_DimAligned *>(ent);
auto *dd = static_cast<DRW_DimAligned *>(ent);
writer->writeString(100, "AcDbAlignedDimension");
DRW_Coord const crd = dd->getClonepoint();
if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not qFuzzyIsNull(crd.z))
@ -1415,7 +1415,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
writer->writeDouble(34, dd->getDef2Point().z);
if (ent->eType == DRW::DIMLINEAR)
{
DRW_DimLinear *dl = static_cast<DRW_DimLinear *>(ent);
auto *dl = static_cast<DRW_DimLinear *>(ent);
if (not qFuzzyIsNull(dl->getAngle()))
writer->writeDouble(50, dl->getAngle());
if (not qFuzzyIsNull(dl->getOblique()))
@ -1426,7 +1426,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
}
case DRW::DIMRADIAL:
{
DRW_DimRadial *dd = static_cast<DRW_DimRadial *>(ent);
auto *dd = static_cast<DRW_DimRadial *>(ent);
writer->writeString(100, "AcDbRadialDimension");
writer->writeDouble(15, dd->getDiameterPoint().x);
writer->writeDouble(25, dd->getDiameterPoint().y);
@ -1436,7 +1436,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
}
case DRW::DIMDIAMETRIC:
{
DRW_DimDiametric *dd = static_cast<DRW_DimDiametric *>(ent);
auto *dd = static_cast<DRW_DimDiametric *>(ent);
writer->writeString(100, "AcDbDiametricDimension");
writer->writeDouble(15, dd->getDiameter1Point().x);
writer->writeDouble(25, dd->getDiameter1Point().y);
@ -1446,7 +1446,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
}
case DRW::DIMANGULAR:
{
DRW_DimAngular *dd = static_cast<DRW_DimAngular *>(ent);
auto *dd = static_cast<DRW_DimAngular *>(ent);
writer->writeString(100, "AcDb2LineAngularDimension");
writer->writeDouble(13, dd->getFirstLine1().x);
writer->writeDouble(23, dd->getFirstLine1().y);
@ -1464,7 +1464,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
}
case DRW::DIMANGULAR3P:
{
DRW_DimAngular3p *dd = static_cast<DRW_DimAngular3p *>(ent);
auto *dd = static_cast<DRW_DimAngular3p *>(ent);
writer->writeDouble(13, dd->getFirstLine().x);
writer->writeDouble(23, dd->getFirstLine().y);
writer->writeDouble(33, dd->getFirstLine().z);
@ -1478,7 +1478,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
}
case DRW::DIMORDINATE:
{
DRW_DimOrdinate *dd = static_cast<DRW_DimOrdinate *>(ent);
auto *dd = static_cast<DRW_DimOrdinate *>(ent);
writer->writeString(100, "AcDbOrdinateDimension");
writer->writeDouble(13, dd->getFirstLine().x);
writer->writeDouble(23, dd->getFirstLine().y);
@ -2271,7 +2271,7 @@ auto dxfRW::writeObjects() -> bool
auto dxfRW::writeExtData(const std::vector<DRW_Variant *> &ed) -> bool
{
for (std::vector<DRW_Variant *>::const_iterator it = ed.begin(); it != ed.end(); ++it)
for (auto it = ed.begin(); it != ed.end(); ++it)
{
switch ((*it)->code)
{

View File

@ -26,19 +26,17 @@
#include <QWidget>
#include "../vfileproperty_p.h"
#include "vfilepropertyeditor.h"
#include "../vproperty_p.h"
#include "vfilepropertyeditor.h"
VPE::VFileProperty::VFileProperty(const QString& name)
: VProperty(
new VFilePropertyPrivate(name,
VPE::VFileProperty::VFileProperty(const QString &name)
: VProperty(new VFilePropertyPrivate(name,
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMetaType::QString))
QMetaType::QString))
#else
QVariant::String))
QVariant::String))
#endif
{
}
VPE::VFileProperty::~VFileProperty()
@ -46,19 +44,17 @@ VPE::VFileProperty::~VFileProperty()
//
}
void VPE::VFileProperty::setFileFilters(const QString& filefilters)
void VPE::VFileProperty::setFileFilters(const QString &filefilters)
{
static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters = filefilters;
static_cast<VFilePropertyPrivate *>(d_ptr)->FileFilters = filefilters;
}
auto VPE::VFileProperty::getFileFilters() const -> QString
{
return static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters;
return static_cast<VFilePropertyPrivate *>(d_ptr)->FileFilters;
}
void VPE::VFileProperty::setFile(const QString& file)
void VPE::VFileProperty::setFile(const QString &file)
{
d_ptr->VariantValue.setValue(file);
}
@ -84,22 +80,21 @@ auto VPE::VFileProperty::createEditor(QWidget *parent, const QStyleOptionViewIte
{
Q_UNUSED(options)
VFileEditWidget* tmpWidget = new VFileEditWidget(parent);
auto *tmpWidget = new VFileEditWidget(parent);
if (delegate)
{
VFileEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget*)), delegate, SIGNAL(commitData(QWidget*)));
VFileEditWidget::connect(tmpWidget, SIGNAL(commitData(QWidget *)), delegate, SIGNAL(commitData(QWidget *)));
}
tmpWidget->setLocale(parent->locale());
tmpWidget->setFilter(static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters); // todo: parse this string
tmpWidget->setFilter(static_cast<VFilePropertyPrivate *>(d_ptr)->FileFilters); // todo: parse this string
tmpWidget->setFile(d_ptr->VariantValue.toString());
tmpWidget->setDirectory(static_cast<VFilePropertyPrivate*>(d_ptr)->Directory);
tmpWidget->setDirectory(static_cast<VFilePropertyPrivate *>(d_ptr)->Directory);
return tmpWidget;
}
auto VPE::VFileProperty::setEditorData(QWidget *editor) -> bool
{
VFileEditWidget* tmpWidget = qobject_cast<VFileEditWidget*>(editor);
auto *tmpWidget = qobject_cast<VFileEditWidget *>(editor);
if (tmpWidget)
{
tmpWidget->setFile(d_ptr->VariantValue.toString());
@ -112,7 +107,7 @@ auto VPE::VFileProperty::setEditorData(QWidget *editor) -> bool
auto VPE::VFileProperty::getEditorData(const QWidget *editor) const -> QVariant
{
const VFileEditWidget* tmpWidget = qobject_cast<const VFileEditWidget*>(editor);
const auto *tmpWidget = qobject_cast<const VFileEditWidget *>(editor);
if (tmpWidget)
{
return tmpWidget->getFile();
@ -121,7 +116,7 @@ auto VPE::VFileProperty::getEditorData(const QWidget *editor) const -> QVariant
return QVariant();
}
void VPE::VFileProperty::setSetting(const QString& key, const QVariant& value)
void VPE::VFileProperty::setSetting(const QString &key, const QVariant &value)
{
if (key == "FileFilters")
{
@ -164,11 +159,10 @@ auto VPE::VFileProperty::clone(bool include_children, VProperty *container) cons
auto VPE::VFileProperty::isDirectory() const -> bool
{
return static_cast<VFilePropertyPrivate*>(d_ptr)->Directory;
return static_cast<VFilePropertyPrivate *>(d_ptr)->Directory;
}
void VPE::VFileProperty::setDirectory(bool is_directory)
{
static_cast<VFilePropertyPrivate*>(d_ptr)->Directory = is_directory;
static_cast<VFilePropertyPrivate *>(d_ptr)->Directory = is_directory;
}