Use auto.
This commit is contained in:
parent
d6fa5ddac0
commit
faab23b0af
|
@ -1663,7 +1663,7 @@ void QmuParserBase::ClearVar()
|
||||||
*/
|
*/
|
||||||
void QmuParserBase::RemoveVar(const QString &a_strVarName)
|
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())
|
if (item != m_VarDef.end())
|
||||||
{
|
{
|
||||||
m_VarDef.erase(item);
|
m_VarDef.erase(item);
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
#include "qmuparsertest.h"
|
#include "qmuparsertest.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <QChar>
|
#include <QChar>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QMessageLogger>
|
#include <QMessageLogger>
|
||||||
|
@ -33,13 +32,14 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "../vmisc/vmath.h"
|
||||||
#include "qmudef.h"
|
#include "qmudef.h"
|
||||||
#include "qmuparser.h"
|
#include "qmuparser.h"
|
||||||
#include "qmuparsererror.h"
|
#include "qmuparsererror.h"
|
||||||
#include "../vmisc/vmath.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
|
@ -54,7 +54,8 @@ int QmuParserTester::c_iCount = 0;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QmuParserTester::QmuParserTester(QObject *parent)
|
QmuParserTester::QmuParserTester(QObject *parent)
|
||||||
: QObject(parent), m_vTestFun()
|
: QObject(parent),
|
||||||
|
m_vTestFun()
|
||||||
{
|
{
|
||||||
AddTest(&QmuParserTester::TestNames);
|
AddTest(&QmuParserTester::TestNames);
|
||||||
AddTest(&QmuParserTester::TestSyntax);
|
AddTest(&QmuParserTester::TestSyntax);
|
||||||
|
@ -292,8 +293,7 @@ auto QmuParserTester::TestBinOprt() -> int
|
||||||
/** @brief Check muParser name restriction enforcement. */
|
/** @brief Check muParser name restriction enforcement. */
|
||||||
auto QmuParserTester::TestNames() -> int
|
auto QmuParserTester::TestNames() -> int
|
||||||
{
|
{
|
||||||
int iStat = 0,
|
int iStat = 0, iErr = 0;
|
||||||
iErr = 0;
|
|
||||||
|
|
||||||
qWarning() << "testing name restriction enforcement...";
|
qWarning() << "testing name restriction enforcement...";
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ auto QmuParserTester::TestVarConst() -> int
|
||||||
throw false;
|
throw false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qmu::varmap_type::const_iterator item = UsedVar.begin();
|
auto item = UsedVar.begin();
|
||||||
for (idx = 0; item != UsedVar.end(); ++item)
|
for (idx = 0; item != UsedVar.end(); ++item)
|
||||||
{
|
{
|
||||||
if (&vVarVal[idx++] != item->second)
|
if (&vVarVal[idx++] != item->second)
|
||||||
|
@ -568,7 +568,6 @@ auto QmuParserTester::TestVarConst() -> int
|
||||||
throw false;
|
throw false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
@ -685,7 +684,6 @@ auto QmuParserTester::TestMultiArg() -> int
|
||||||
return iStat;
|
return iStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto QmuParserTester::TestInfixOprt() -> int
|
auto QmuParserTester::TestInfixOprt() -> int
|
||||||
{
|
{
|
||||||
|
@ -754,7 +752,6 @@ auto QmuParserTester::TestInfixOprt() -> int
|
||||||
return iStat;
|
return iStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto QmuParserTester::TestPostFix() -> int
|
auto QmuParserTester::TestPostFix() -> int
|
||||||
{
|
{
|
||||||
|
@ -878,12 +875,14 @@ auto QmuParserTester::TestExpression() -> int
|
||||||
"((e+(-2)+(-e)*((((-3)*9+(-e)))+(-9)))))))-((((e-7+(((5/pi-(3/1+pi)))))/e)/(-5))/(sqrt((((((1+(-7))))+((((-"
|
"((e+(-2)+(-e)*((((-3)*9+(-e)))+(-9)))))))-((((e-7+(((5/pi-(3/1+pi)))))/e)/(-5))/(sqrt((((((1+(-7))))+((((-"
|
||||||
"e)*(-e)))-8))*(-5)/((-e)))*(-6)-((((((-2)-(-9)-(-e)-1)/3))))/(sqrt((8+(e-((-6))+(9*(-9))))*(((3+2-8))*(7+6"
|
"e)*(-e)))-8))*(-5)/((-e)))*(-6)-((((((-2)-(-9)-(-e)-1)/3))))/(sqrt((8+(e-((-6))+(9*(-9))))*(((3+2-8))*(7+6"
|
||||||
"+(-5))+((0/(-e)*(-pi))+7)))+(((((-e)/e/e)+((-6)*5)*e+(3+(-5)/pi))))+pi))/sqrt((((9))+((((pi))-8+2))+pi))/e"
|
"+(-5))+((0/(-e)*(-pi))+7)))+(((((-e)/e/e)+((-6)*5)*e+(3+(-5)/pi))))+pi))/sqrt((((9))+((((pi))-8+2))+pi))/e"
|
||||||
"*4)*((-5)/(((-pi))*(sqrt(e)))))-(((((((-e)*(e)-pi))/4+(pi)*(-9)))))))+(-pi)", -12.23016549, true );
|
"*4)*((-5)/(((-pi))*(sqrt(e)))))-(((((((-e)*(e)-pi))/4+(pi)*(-9)))))))+(-pi)",
|
||||||
|
-12.23016549, true);
|
||||||
|
|
||||||
// long formula (Reference: Matlab)
|
// long formula (Reference: Matlab)
|
||||||
iStat += EqnTest(
|
iStat += EqnTest(
|
||||||
"(atan(sin((((((((((((((((pi/cos((a/((((0.53-b)-pi)*e)/b))))+2.51)+a)-0.54)/0.98)+b)*b)+e)/a)+b)+a)+b)+pi)/e"
|
"(atan(sin((((((((((((((((pi/cos((a/((((0.53-b)-pi)*e)/b))))+2.51)+a)-0.54)/0.98)+b)*b)+e)/a)+b)+a)+b)+pi)/e"
|
||||||
")+a)))*2.77)", -2.16995656, true );
|
")+a)))*2.77)",
|
||||||
|
-2.16995656, true);
|
||||||
|
|
||||||
// long formula (Reference: Matlab)
|
// long formula (Reference: Matlab)
|
||||||
iStat += EqnTest("1+2-3*4/5^6*(2*(1-5+(3*7^9)*(4+6*7-3)))+12", -7995810.09926, true);
|
iStat += EqnTest("1+2-3*4/5^6*(2*(1-5+(3*7^9)*(4+6*7-3)))+12", -7995810.09926, true);
|
||||||
|
@ -1108,7 +1107,6 @@ auto QmuParserTester::TestException() -> int
|
||||||
return iStat;
|
return iStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void QmuParserTester::AddTest(testfun_type a_pFun)
|
void QmuParserTester::AddTest(testfun_type a_pFun)
|
||||||
{
|
{
|
||||||
|
@ -1156,9 +1154,7 @@ void QmuParserTester::Run()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning() << "Test failed with " << iStat
|
qWarning() << "Test failed with " << iStat << " errors (" << QmuParserTester::c_iCount << " expressions)";
|
||||||
<< " errors (" << QmuParserTester::c_iCount
|
|
||||||
<< " expressions)";
|
|
||||||
}
|
}
|
||||||
QCoreApplication::exit(iStat);
|
QCoreApplication::exit(iStat);
|
||||||
QmuParserTester::c_iCount = 0;
|
QmuParserTester::c_iCount = 0;
|
||||||
|
@ -1167,7 +1163,6 @@ void QmuParserTester::Run()
|
||||||
qWarning() << "-----------------------------------------------------------";
|
qWarning() << "-----------------------------------------------------------";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail) -> int
|
auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail) -> int
|
||||||
{
|
{
|
||||||
|
@ -1196,7 +1191,8 @@ auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail)
|
||||||
// output the formula in case of an failed test
|
// output the formula in case of an failed test
|
||||||
if (a_bFail == false || (a_bFail == true && a_iErrc != e.GetCode()))
|
if (a_bFail == false || (a_bFail == true && a_iErrc != e.GetCode()))
|
||||||
{
|
{
|
||||||
qWarning() << "\n " << "Expression: " << a_str << " Code:" << e.GetCode() << "(" << e.GetMsg() << ")"
|
qWarning() << "\n "
|
||||||
|
<< "Expression: " << a_str << " Code:" << e.GetCode() << "(" << e.GetMsg() << ")"
|
||||||
<< " Expected:" << a_iErrc;
|
<< " Expected:" << a_iErrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1208,8 +1204,7 @@ auto QmuParserTester::ThrowTest(const QString &a_str, int a_iErrc, bool a_bFail)
|
||||||
if (bRet == 1)
|
if (bRet == 1)
|
||||||
{
|
{
|
||||||
qWarning() << "\n "
|
qWarning() << "\n "
|
||||||
<< "Expression: " << a_str
|
<< "Expression: " << a_str << " did evaluate; Expected error:" << a_iErrc;
|
||||||
<< " did evaluate; Expected error:" << a_iErrc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return bRet;
|
return bRet;
|
||||||
|
@ -1415,22 +1410,17 @@ QT_WARNING_DISABLE_MSVC(4127)
|
||||||
if (std::numeric_limits<qreal>::has_infinity)
|
if (std::numeric_limits<qreal>::has_infinity)
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
{
|
{
|
||||||
bCloseEnough &= (not QmuFuzzyComparePossibleNulls( fabs ( fVal[i] ),
|
bCloseEnough &=
|
||||||
std::numeric_limits<qreal>::infinity()) );
|
(not QmuFuzzyComparePossibleNulls(fabs(fVal[i]), std::numeric_limits<qreal>::infinity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iRet = ((bCloseEnough && a_fPass) || (bCloseEnough == false && a_fPass == false)) ? 0 : 1;
|
iRet = ((bCloseEnough && a_fPass) || (bCloseEnough == false && a_fPass == false)) ? 0 : 1;
|
||||||
|
|
||||||
|
|
||||||
if (iRet == 1)
|
if (iRet == 1)
|
||||||
{
|
{
|
||||||
qWarning() << "\n fail: " << a_str
|
qWarning() << "\n fail: " << a_str << " (incorrect result; expected: " << a_fRes
|
||||||
<< " (incorrect result; expected: " << a_fRes
|
<< " ;calculated: " << fVal[0] << "," << fVal[1] << "," << fVal[2] << "," << fVal[3] << ","
|
||||||
<< " ;calculated: " << fVal[0] << ","
|
|
||||||
<< fVal[1] << ","
|
|
||||||
<< fVal[2] << ","
|
|
||||||
<< fVal[3] << ","
|
|
||||||
<< fVal[4] << ").";
|
<< fVal[4] << ").";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1438,8 +1428,7 @@ QT_WARNING_POP
|
||||||
{
|
{
|
||||||
if (a_fPass)
|
if (a_fPass)
|
||||||
{
|
{
|
||||||
if ( not QmuFuzzyComparePossibleNulls(fVal[0], fVal[2]) &&
|
if (not QmuFuzzyComparePossibleNulls(fVal[0], fVal[2]) && not QmuFuzzyComparePossibleNulls(fVal[0], -999) &&
|
||||||
not QmuFuzzyComparePossibleNulls(fVal[0], -999) &&
|
|
||||||
not QmuFuzzyComparePossibleNulls(fVal[1], -998))
|
not QmuFuzzyComparePossibleNulls(fVal[1], -998))
|
||||||
{
|
{
|
||||||
qWarning() << "\n fail: " << a_str << " (copy construction)";
|
qWarning() << "\n fail: " << a_str << " (copy construction)";
|
||||||
|
@ -1500,9 +1489,10 @@ auto QmuParserTester::EqnTestBulk(const QString &a_str, double a_fRes[4], bool a
|
||||||
iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1;
|
iRet = ((bCloseEnough && a_fPass) || (!bCloseEnough && !a_fPass)) ? 0 : 1;
|
||||||
if (iRet == 1)
|
if (iRet == 1)
|
||||||
{
|
{
|
||||||
qWarning() << "\n fail: " << a_str << " (incorrect result; expected: {" << a_fRes[0] << ","
|
qWarning() << "\n fail: " << a_str << " (incorrect result; expected: {" << a_fRes[0] << "," << a_fRes[1]
|
||||||
<< a_fRes[1] << "," << a_fRes[2] << "," << a_fRes[3] << "}" << " ;calculated: " << vResults[0]
|
<< "," << a_fRes[2] << "," << a_fRes[3] << "}"
|
||||||
<< "," << vResults[1] << "," << vResults[2] << "," << vResults[3] << "}";
|
<< " ;calculated: " << vResults[0] << "," << vResults[1] << "," << vResults[2] << ","
|
||||||
|
<< vResults[3] << "}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (QmuParserError &e)
|
catch (QmuParserError &e)
|
||||||
|
@ -1529,8 +1519,9 @@ auto QmuParserTester::EqnTestBulk(const QString &a_str, double a_fRes[4], bool a
|
||||||
void QmuParserTester::Abort()
|
void QmuParserTester::Abort()
|
||||||
{
|
{
|
||||||
qWarning() << "Test failed (internal error in test class)";
|
qWarning() << "Test failed (internal error in test class)";
|
||||||
while ( getchar() == false);
|
while (getchar() == false)
|
||||||
|
;
|
||||||
QCoreApplication::exit(-1);
|
QCoreApplication::exit(-1);
|
||||||
}
|
}
|
||||||
} // namespace test
|
} // namespace Test
|
||||||
} // namespace qmu
|
} // namespace qmu
|
||||||
|
|
|
@ -144,7 +144,7 @@ void dx_iface::writeBlocks()
|
||||||
|
|
||||||
void dx_iface::writeBlockRecords()
|
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);
|
dxfW->writeBlockRecord((*it)->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,31 +156,31 @@ void dx_iface::writeEntities()
|
||||||
|
|
||||||
void dx_iface::writeLTypes()
|
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));
|
dxfW->writeLineType(&(*it));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dx_iface::writeLayers()
|
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));
|
dxfW->writeLayer(&(*it));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dx_iface::writeTextstyles()
|
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));
|
dxfW->writeTextstyle(&(*it));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dx_iface::writeVports()
|
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));
|
dxfW->writeVport(&(*it));
|
||||||
}
|
}
|
||||||
|
|
||||||
void dx_iface::writeDimstyles()
|
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));
|
dxfW->writeDimstyle(&(*it));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public:
|
||||||
extAxisY(),
|
extAxisY(),
|
||||||
curr(nullptr /*e.curr*/)
|
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)));
|
extData.push_back(new DRW_Variant(*(*it)));
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ public:
|
||||||
|
|
||||||
virtual ~DRW_Entity()
|
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;
|
delete *it;
|
||||||
|
|
||||||
extData.clear();
|
extData.clear();
|
||||||
|
@ -175,7 +175,7 @@ public:
|
||||||
|
|
||||||
void reset()
|
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;
|
delete *it;
|
||||||
extData.clear();
|
extData.clear();
|
||||||
}
|
}
|
||||||
|
@ -666,7 +666,7 @@ public:
|
||||||
void applyExtrusion() override;
|
void applyExtrusion() override;
|
||||||
void addVertex(DRW_Vertex2D v)
|
void addVertex(DRW_Vertex2D v)
|
||||||
{
|
{
|
||||||
DRW_Vertex2D *vert = new DRW_Vertex2D();
|
auto *vert = new DRW_Vertex2D();
|
||||||
vert->x = v.x;
|
vert->x = v.x;
|
||||||
vert->y = v.y;
|
vert->y = v.y;
|
||||||
vert->stawidth = v.stawidth;
|
vert->stawidth = v.stawidth;
|
||||||
|
@ -676,7 +676,7 @@ public:
|
||||||
}
|
}
|
||||||
auto addVertex() -> DRW_Vertex2D *
|
auto addVertex() -> DRW_Vertex2D *
|
||||||
{
|
{
|
||||||
DRW_Vertex2D *vert = new DRW_Vertex2D();
|
auto *vert = new DRW_Vertex2D();
|
||||||
vert->stawidth = 0;
|
vert->stawidth = 0;
|
||||||
vert->endwidth = 0;
|
vert->endwidth = 0;
|
||||||
vert->bulge = 0;
|
vert->bulge = 0;
|
||||||
|
@ -919,7 +919,7 @@ public:
|
||||||
}
|
}
|
||||||
void addVertex(DRW_Vertex v)
|
void addVertex(DRW_Vertex v)
|
||||||
{
|
{
|
||||||
DRW_Vertex *vert = new DRW_Vertex();
|
auto *vert = new DRW_Vertex();
|
||||||
vert->basePoint.x = v.basePoint.x;
|
vert->basePoint.x = v.basePoint.x;
|
||||||
vert->basePoint.y = v.basePoint.y;
|
vert->basePoint.y = v.basePoint.y;
|
||||||
vert->basePoint.z = v.basePoint.z;
|
vert->basePoint.z = v.basePoint.z;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
|
|
||||||
virtual ~DRW_TableEntry()
|
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;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ protected:
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
flags = 0;
|
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;
|
delete *it;
|
||||||
}
|
}
|
||||||
|
|
|
@ -639,7 +639,7 @@ auto DRW_Conv932Table::toUtf8(const std::string &s) -> std::string
|
||||||
}
|
}
|
||||||
if (end > 0)
|
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)
|
if (DRW_DoubleTable932[k][0] == code)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1260,7 +1260,7 @@ auto dxfRW::writeHatch(DRW_Hatch *ent) -> bool
|
||||||
case DRW::LINE:
|
case DRW::LINE:
|
||||||
{
|
{
|
||||||
writer->writeInt16(72, 1);
|
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(10, l->basePoint.x);
|
||||||
writer->writeDouble(20, l->basePoint.y);
|
writer->writeDouble(20, l->basePoint.y);
|
||||||
writer->writeDouble(11, l->secPoint.x);
|
writer->writeDouble(11, l->secPoint.x);
|
||||||
|
@ -1270,7 +1270,7 @@ auto dxfRW::writeHatch(DRW_Hatch *ent) -> bool
|
||||||
case DRW::ARC:
|
case DRW::ARC:
|
||||||
{
|
{
|
||||||
writer->writeInt16(72, 2);
|
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(10, a->basePoint.x);
|
||||||
writer->writeDouble(20, a->basePoint.y);
|
writer->writeDouble(20, a->basePoint.y);
|
||||||
writer->writeDouble(40, a->radious);
|
writer->writeDouble(40, a->radious);
|
||||||
|
@ -1282,7 +1282,7 @@ auto dxfRW::writeHatch(DRW_Hatch *ent) -> bool
|
||||||
case DRW::ELLIPSE:
|
case DRW::ELLIPSE:
|
||||||
{
|
{
|
||||||
writer->writeInt16(72, 3);
|
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();
|
a->correctAxis();
|
||||||
writer->writeDouble(10, a->basePoint.x);
|
writer->writeDouble(10, a->basePoint.x);
|
||||||
writer->writeDouble(20, a->basePoint.y);
|
writer->writeDouble(20, a->basePoint.y);
|
||||||
|
@ -1398,7 +1398,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
|
||||||
case DRW::DIMALIGNED:
|
case DRW::DIMALIGNED:
|
||||||
case DRW::DIMLINEAR:
|
case DRW::DIMLINEAR:
|
||||||
{
|
{
|
||||||
DRW_DimAligned *dd = static_cast<DRW_DimAligned *>(ent);
|
auto *dd = static_cast<DRW_DimAligned *>(ent);
|
||||||
writer->writeString(100, "AcDbAlignedDimension");
|
writer->writeString(100, "AcDbAlignedDimension");
|
||||||
DRW_Coord const crd = dd->getClonepoint();
|
DRW_Coord const crd = dd->getClonepoint();
|
||||||
if (not qFuzzyIsNull(crd.x) || not qFuzzyIsNull(crd.y) || not qFuzzyIsNull(crd.z))
|
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);
|
writer->writeDouble(34, dd->getDef2Point().z);
|
||||||
if (ent->eType == DRW::DIMLINEAR)
|
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()))
|
if (not qFuzzyIsNull(dl->getAngle()))
|
||||||
writer->writeDouble(50, dl->getAngle());
|
writer->writeDouble(50, dl->getAngle());
|
||||||
if (not qFuzzyIsNull(dl->getOblique()))
|
if (not qFuzzyIsNull(dl->getOblique()))
|
||||||
|
@ -1426,7 +1426,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
|
||||||
}
|
}
|
||||||
case DRW::DIMRADIAL:
|
case DRW::DIMRADIAL:
|
||||||
{
|
{
|
||||||
DRW_DimRadial *dd = static_cast<DRW_DimRadial *>(ent);
|
auto *dd = static_cast<DRW_DimRadial *>(ent);
|
||||||
writer->writeString(100, "AcDbRadialDimension");
|
writer->writeString(100, "AcDbRadialDimension");
|
||||||
writer->writeDouble(15, dd->getDiameterPoint().x);
|
writer->writeDouble(15, dd->getDiameterPoint().x);
|
||||||
writer->writeDouble(25, dd->getDiameterPoint().y);
|
writer->writeDouble(25, dd->getDiameterPoint().y);
|
||||||
|
@ -1436,7 +1436,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
|
||||||
}
|
}
|
||||||
case DRW::DIMDIAMETRIC:
|
case DRW::DIMDIAMETRIC:
|
||||||
{
|
{
|
||||||
DRW_DimDiametric *dd = static_cast<DRW_DimDiametric *>(ent);
|
auto *dd = static_cast<DRW_DimDiametric *>(ent);
|
||||||
writer->writeString(100, "AcDbDiametricDimension");
|
writer->writeString(100, "AcDbDiametricDimension");
|
||||||
writer->writeDouble(15, dd->getDiameter1Point().x);
|
writer->writeDouble(15, dd->getDiameter1Point().x);
|
||||||
writer->writeDouble(25, dd->getDiameter1Point().y);
|
writer->writeDouble(25, dd->getDiameter1Point().y);
|
||||||
|
@ -1446,7 +1446,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
|
||||||
}
|
}
|
||||||
case DRW::DIMANGULAR:
|
case DRW::DIMANGULAR:
|
||||||
{
|
{
|
||||||
DRW_DimAngular *dd = static_cast<DRW_DimAngular *>(ent);
|
auto *dd = static_cast<DRW_DimAngular *>(ent);
|
||||||
writer->writeString(100, "AcDb2LineAngularDimension");
|
writer->writeString(100, "AcDb2LineAngularDimension");
|
||||||
writer->writeDouble(13, dd->getFirstLine1().x);
|
writer->writeDouble(13, dd->getFirstLine1().x);
|
||||||
writer->writeDouble(23, dd->getFirstLine1().y);
|
writer->writeDouble(23, dd->getFirstLine1().y);
|
||||||
|
@ -1464,7 +1464,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
|
||||||
}
|
}
|
||||||
case DRW::DIMANGULAR3P:
|
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(13, dd->getFirstLine().x);
|
||||||
writer->writeDouble(23, dd->getFirstLine().y);
|
writer->writeDouble(23, dd->getFirstLine().y);
|
||||||
writer->writeDouble(33, dd->getFirstLine().z);
|
writer->writeDouble(33, dd->getFirstLine().z);
|
||||||
|
@ -1478,7 +1478,7 @@ auto dxfRW::writeDimension(DRW_Dimension *ent) -> bool
|
||||||
}
|
}
|
||||||
case DRW::DIMORDINATE:
|
case DRW::DIMORDINATE:
|
||||||
{
|
{
|
||||||
DRW_DimOrdinate *dd = static_cast<DRW_DimOrdinate *>(ent);
|
auto *dd = static_cast<DRW_DimOrdinate *>(ent);
|
||||||
writer->writeString(100, "AcDbOrdinateDimension");
|
writer->writeString(100, "AcDbOrdinateDimension");
|
||||||
writer->writeDouble(13, dd->getFirstLine().x);
|
writer->writeDouble(13, dd->getFirstLine().x);
|
||||||
writer->writeDouble(23, dd->getFirstLine().y);
|
writer->writeDouble(23, dd->getFirstLine().y);
|
||||||
|
@ -2271,7 +2271,7 @@ auto dxfRW::writeObjects() -> bool
|
||||||
|
|
||||||
auto dxfRW::writeExtData(const std::vector<DRW_Variant *> &ed) -> 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)
|
switch ((*it)->code)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,19 +26,17 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vfileproperty_p.h"
|
#include "../vfileproperty_p.h"
|
||||||
#include "vfilepropertyeditor.h"
|
|
||||||
#include "../vproperty_p.h"
|
#include "../vproperty_p.h"
|
||||||
|
#include "vfilepropertyeditor.h"
|
||||||
|
|
||||||
VPE::VFileProperty::VFileProperty(const QString &name)
|
VPE::VFileProperty::VFileProperty(const QString &name)
|
||||||
: VProperty(
|
: VProperty(new VFilePropertyPrivate(name,
|
||||||
new VFilePropertyPrivate(name,
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
QMetaType::QString))
|
QMetaType::QString))
|
||||||
#else
|
#else
|
||||||
QVariant::String))
|
QVariant::String))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VFileProperty::~VFileProperty()
|
VPE::VFileProperty::~VFileProperty()
|
||||||
|
@ -46,7 +44,6 @@ 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;
|
||||||
|
@ -57,7 +54,6 @@ 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);
|
d_ptr->VariantValue.setValue(file);
|
||||||
|
@ -84,11 +80,10 @@ auto VPE::VFileProperty::createEditor(QWidget *parent, const QStyleOptionViewIte
|
||||||
{
|
{
|
||||||
Q_UNUSED(options)
|
Q_UNUSED(options)
|
||||||
|
|
||||||
VFileEditWidget* tmpWidget = new VFileEditWidget(parent);
|
auto *tmpWidget = new VFileEditWidget(parent);
|
||||||
if (delegate)
|
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->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
|
||||||
|
@ -99,7 +94,7 @@ auto VPE::VFileProperty::createEditor(QWidget *parent, const QStyleOptionViewIte
|
||||||
|
|
||||||
auto VPE::VFileProperty::setEditorData(QWidget *editor) -> bool
|
auto VPE::VFileProperty::setEditorData(QWidget *editor) -> bool
|
||||||
{
|
{
|
||||||
VFileEditWidget* tmpWidget = qobject_cast<VFileEditWidget*>(editor);
|
auto *tmpWidget = qobject_cast<VFileEditWidget *>(editor);
|
||||||
if (tmpWidget)
|
if (tmpWidget)
|
||||||
{
|
{
|
||||||
tmpWidget->setFile(d_ptr->VariantValue.toString());
|
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
|
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)
|
if (tmpWidget)
|
||||||
{
|
{
|
||||||
return tmpWidget->getFile();
|
return tmpWidget->getFile();
|
||||||
|
@ -167,7 +162,6 @@ 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)
|
void VPE::VFileProperty::setDirectory(bool is_directory)
|
||||||
{
|
{
|
||||||
static_cast<VFilePropertyPrivate *>(d_ptr)->Directory = is_directory;
|
static_cast<VFilePropertyPrivate *>(d_ptr)->Directory = is_directory;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user