Clang warnings.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-19 16:21:06 +03:00
parent 03b6ce08cc
commit 4d90589f01
33 changed files with 923 additions and 760 deletions

View File

@ -288,7 +288,7 @@ CLANG_DEBUG_CXXFLAGS += \
-Wdeprecated-register \ -Wdeprecated-register \
-Wdeprecated-writable-strings \ -Wdeprecated-writable-strings \
-Wdirect-ivar-access \ -Wdirect-ivar-access \
-Wdisabled-macro-expansion \ # -Wdisabled-macro-expansion \ Disabled
-Wdisabled-optimization \ -Wdisabled-optimization \
-Wdiscard-qual \ -Wdiscard-qual \
-Wdistributed-object-modifiers \ -Wdistributed-object-modifiers \
@ -414,6 +414,7 @@ CLANG_DEBUG_CXXFLAGS += \
-Wnon-virtual-dtor \ -Wnon-virtual-dtor \
-Wnonnull \ -Wnonnull \
-Wnonportable-cfstrings \ -Wnonportable-cfstrings \
-Wno-c++98-compat \
-WNSObject-attribute \ -WNSObject-attribute \
-Wnull-arithmetic \ -Wnull-arithmetic \
-Wnull-character \ -Wnull-character \

View File

@ -51,8 +51,17 @@
#include <QSpacerItem> #include <QSpacerItem>
#include <QThread> #include <QThread>
#ifdef Q_CC_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#endif
Q_LOGGING_CATEGORY(mApp, "m.application") Q_LOGGING_CATEGORY(mApp, "m.application")
#ifdef Q_CC_CLANG
#pragma clang diagnostic pop
#endif
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
# include "../vmisc/backport/qcommandlineparser.h" # include "../vmisc/backport/qcommandlineparser.h"
#else #else

View File

@ -93,12 +93,18 @@ CONFIG(debug, debug|release){
} }
} }
clang*{ clang*{
QMAKE_CXXFLAGS += \ QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers. # Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${UI_DIR}" \ -isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \ -isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wundefined-reinterpret-cast \
-Wmissing-prototypes # rcc folder
} }
} else { } else {
*-g++{ *-g++{

View File

@ -53,8 +53,17 @@
#define DIALOG_MAX_FORMULA_HEIGHT 64 #define DIALOG_MAX_FORMULA_HEIGHT 64
#ifdef Q_CC_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#endif
Q_LOGGING_CATEGORY(tMainWindow, "t.mainwindow") Q_LOGGING_CATEGORY(tMainWindow, "t.mainwindow")
#ifdef Q_CC_CLANG
#pragma clang diagnostic pop
#endif
// We need this enum in case we will add or delete a column. And also make code more readable. // We need this enum in case we will add or delete a column. And also make code more readable.
enum {ColumnName = 0, ColumnFullName, ColumnCalcValue, ColumnFormula, ColumnBaseValue, ColumnInSizes, ColumnInHeights}; enum {ColumnName = 0, ColumnFullName, ColumnCalcValue, ColumnFormula, ColumnBaseValue, ColumnInSizes, ColumnInHeights};

View File

@ -309,12 +309,12 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
if (parser.isSet(*optionsUsed.value(LONG_OPTION_SHIFTLENGTH))) if (parser.isSet(*optionsUsed.value(LONG_OPTION_SHIFTLENGTH)))
{ {
diag.SetShift(Lo2Px(parser.value(*optionsUsed.value(LONG_OPTION_SHIFTLENGTH)), diag)); diag.SetShift(static_cast<quint32>(Lo2Px(parser.value(*optionsUsed.value(LONG_OPTION_SHIFTLENGTH)), diag)));
} }
if (parser.isSet(*optionsUsed.value(LONG_OPTION_GAPWIDTH))) if (parser.isSet(*optionsUsed.value(LONG_OPTION_GAPWIDTH)))
{ {
diag.SetLayoutWidth(Lo2Px(parser.value(*optionsUsed.value(LONG_OPTION_GAPWIDTH)), diag)); diag.SetLayoutWidth(static_cast<quint32>(Lo2Px(parser.value(*optionsUsed.value(LONG_OPTION_GAPWIDTH)), diag)));
} }
diag.SetAutoCrop(parser.isSet(*optionsUsed.value(LONG_OPTION_CROP))); diag.SetAutoCrop(parser.isSet(*optionsUsed.value(LONG_OPTION_CROP)));

View File

@ -316,13 +316,13 @@ bool DialogLayoutSettings::SelectLayoutUnit(const QString &units)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::LayoutToPixels(qreal value) const int DialogLayoutSettings::LayoutToPixels(qreal value) const
{ {
return static_cast<quint32>(qFloor(UnitConvertor(value, LayoutUnit(), Unit::Px))); return qFloor(UnitConvertor(value, LayoutUnit(), Unit::Px));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int DialogLayoutSettings::PageToPixels(qreal value) const int DialogLayoutSettings::PageToPixels(qreal value) const
{ {
return static_cast<quint32>(qFloor(UnitConvertor(value, PaperUnit(), Unit::Px))); return qFloor(UnitConvertor(value, PaperUnit(), Unit::Px));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -3707,7 +3707,7 @@ void MainWindow::DoExport(const VCommandLinePtr &expParams)
{ {
DialogSaveLayout dialog(scenes.size(), expParams->OptBaseName(), this); DialogSaveLayout dialog(scenes.size(), expParams->OptBaseName(), this);
dialog.SetDestinationPath(expParams->OptDestinationPath()); dialog.SetDestinationPath(expParams->OptDestinationPath());
dialog.SelectFormate(expParams->OptExportType()); dialog.SelectFormate(static_cast<quint32>(expParams->OptExportType()));
ExportLayout(dialog); ExportLayout(dialog);
} }
catch (const VException &e) catch (const VException &e)

View File

@ -92,20 +92,20 @@ CONFIG(debug, debug|release){
} }
} }
clang*{ clang*{
QMAKE_CXXFLAGS += \ QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers. # Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${UI_DIR}" \ -isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \ -isystem "$${OUT_PWD}/$${RCC_DIR}" \
-isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files -isystem "$${OUT_PWD}/../../libs/vtools/$${UI_DIR}" \ # For VTools UI files
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list. # want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \ QMAKE_CXXFLAGS -= \
-Wmissing-prototypes \ -Wmissing-prototypes \
-Wundefined-reinterpret-cast -Wundefined-reinterpret-cast
} }
} else { } else {
*-g++{ *-g++{
QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details. QMAKE_CXXFLAGS += $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.

View File

@ -2052,6 +2052,7 @@ qreal VPattern::EvalFormula(VContainer *data, const QString &formula, bool *ok)
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
Q_UNUSED(e)
*ok = false; *ok = false;
return 0; return 0;
} }
@ -2247,7 +2248,8 @@ void VPattern::ParseIncrementsElement(const QDomNode &node)
bool ok = false; bool ok = false;
const qreal value = EvalFormula(data, formula, &ok); const qreal value = EvalFormula(data, formula, &ok);
data->AddVariable(name, new VIncrement(data, name, index, value, formula, ok, desc)); data->AddVariable(name, new VIncrement(data, name, static_cast<quint32>(index), value, formula, ok,
desc));
++index; ++index;
} }
} }

View File

@ -82,7 +82,8 @@ CONFIG(debug, debug|release){
# -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and # -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and
# want them in global list. Compromise decision delete them from local list. # want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \ QMAKE_CXXFLAGS -= \
-Wmissing-prototypes -Wmissing-prototypes \
-Wundefined-reinterpret-cast
} }
} else { } else {
*-g++{ *-g++{

View File

@ -40,7 +40,7 @@ class DXFLIB_EXPORT DL_CreationAdapter : public DL_CreationInterface
{ {
public: public:
DL_CreationAdapter() {} DL_CreationAdapter() {}
virtual ~DL_CreationAdapter() {} virtual ~DL_CreationAdapter();
virtual void processCodeValuePair(unsigned int, const std::string&) {} virtual void processCodeValuePair(unsigned int, const std::string&) {}
virtual void endSection() {} virtual void endSection() {}
virtual void addLayer(const DL_LayerData&) {} virtual void addLayer(const DL_LayerData&) {}
@ -135,4 +135,7 @@ public:
virtual void endSequence() {} virtual void endSequence() {}
}; };
DL_CreationAdapter::~DL_CreationAdapter()
{}
#endif #endif

View File

@ -50,10 +50,8 @@ public:
DL_CreationInterface() : extrusion(new DL_Extrusion), attributes() DL_CreationInterface() : extrusion(new DL_Extrusion), attributes()
{ {
} }
virtual ~DL_CreationInterface()
{ virtual ~DL_CreationInterface();
delete extrusion;
}
/** /**
* Called for every code / value tuple of the DXF file. The complete DXF file * Called for every code / value tuple of the DXF file. The complete DXF file
@ -372,4 +370,9 @@ protected:
DL_Attributes attributes; DL_Attributes attributes;
}; };
DL_CreationInterface::~DL_CreationInterface()
{
delete extrusion;
}
#endif #endif

View File

@ -196,7 +196,7 @@ bool DL_Dxf::readDxfGroups(FILE *fp, DL_CreationInterface* creationInterface)
groupCode = static_cast<unsigned int>(toInt(groupCodeTmp)); groupCode = static_cast<unsigned int>(toInt(groupCodeTmp));
creationInterface->processCodeValuePair(groupCode, groupValue); creationInterface->processCodeValuePair(groupCode, groupValue);
processDXFGroup(creationInterface, groupCode, groupValue); processDXFGroup(creationInterface, static_cast<int>(groupCode), groupValue);
} }
return !feof(fp); return !feof(fp);
@ -216,7 +216,7 @@ bool DL_Dxf::readDxfGroups(std::stringstream& stream,
{ {
groupCode = static_cast<unsigned int>(toInt(groupCodeTmp)); groupCode = static_cast<unsigned int>(toInt(groupCodeTmp));
processDXFGroup(creationInterface, groupCode, groupValue); processDXFGroup(creationInterface, static_cast<int>(groupCode), groupValue);
} }
return !stream.eof(); return !stream.eof();
} }
@ -249,7 +249,7 @@ bool DL_Dxf::getStrippedLine(std::string& s, unsigned int size, FILE *fp)
// Only the useful part of the line // Only the useful part of the line
char* line; char* line;
line = fgets(wholeLine, size, fp); line = fgets(wholeLine, static_cast<int>(size), fp);
if (line!=NULL && line[0] != '\0') // Evaluates to fgets() retval if (line!=NULL && line[0] != '\0') // Evaluates to fgets() retval
{ {
@ -288,7 +288,7 @@ bool DL_Dxf::getStrippedLine(std::string &s, unsigned int size,
// Only the useful part of the line // Only the useful part of the line
char* line = new char[size+1]; char* line = new char[size+1];
char* oriLine = line; char* oriLine = line;
stream.getline(line, size); stream.getline(line, static_cast<int>(size));
stripWhiteSpace(&line); stripWhiteSpace(&line);
s = line; s = line;
assert(size > s.length()); assert(size > s.length());
@ -1497,28 +1497,32 @@ bool DL_Dxf::handleXRecordData(DL_CreationInterface* creationInterface)
(groupCode>=1000 && groupCode<=1009)) (groupCode>=1000 && groupCode<=1009))
{ {
creationInterface->addXRecordString(groupCode, groupValue); creationInterface->addXRecordString(static_cast<int>(groupCode), groupValue);
return true; return true;
} }
// int: // int:
else if ((groupCode>=60 && groupCode<=99) || (groupCode>=160 && groupCode<=179) || (groupCode>=270 && groupCode<=289)) else if ((groupCode>=60 && groupCode<=99) ||
(groupCode>=160 && groupCode<=179) ||
(groupCode>=270 && groupCode<=289))
{ {
creationInterface->addXRecordInt(groupCode, toInt(groupValue)); creationInterface->addXRecordInt(static_cast<int>(groupCode), toInt(groupValue));
return true; return true;
} }
// bool: // bool:
else if (groupCode>=290 && groupCode<=299) else if (groupCode>=290 && groupCode<=299)
{ {
creationInterface->addXRecordBool(groupCode, toBool(groupValue)); creationInterface->addXRecordBool(static_cast<int>(groupCode), toBool(groupValue));
return true; return true;
} }
// double: // double:
else if ((groupCode>=10 && groupCode<=59) || (groupCode>=110 && groupCode<=149) || (groupCode>=210 && groupCode<=239)) else if ((groupCode>=10 && groupCode<=59) ||
(groupCode>=110 && groupCode<=149) ||
(groupCode>=210 && groupCode<=239))
{ {
creationInterface->addXRecordReal(groupCode, toReal(groupValue)); creationInterface->addXRecordReal(static_cast<int>(groupCode), toReal(groupValue));
return true; return true;
} }
@ -1563,22 +1567,22 @@ bool DL_Dxf::handleXData(DL_CreationInterface* creationInterface)
} }
else if (groupCode>=1000 && groupCode<=1009) else if (groupCode>=1000 && groupCode<=1009)
{ {
creationInterface->addXDataString(groupCode, groupValue); creationInterface->addXDataString(static_cast<int>(groupCode), groupValue);
return true; return true;
} }
else if (groupCode>=1010 && groupCode<=1059) else if (groupCode>=1010 && groupCode<=1059)
{ {
creationInterface->addXDataReal(groupCode, toReal(groupValue)); creationInterface->addXDataReal(static_cast<int>(groupCode), toReal(groupValue));
return true; return true;
} }
else if (groupCode>=1060 && groupCode<=1070) else if (groupCode>=1060 && groupCode<=1070)
{ {
creationInterface->addXDataInt(groupCode, toInt(groupValue)); creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
return true; return true;
} }
else if (groupCode==1071) else if (groupCode==1071)
{ {
creationInterface->addXDataInt(groupCode, toInt(groupValue)); creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
return true; return true;
} }
@ -1644,7 +1648,7 @@ bool DL_Dxf::handleLWPolylineData(DL_CreationInterface* /*creationInterface*/)
{ {
if (vertexIndex>=0 && vertexIndex<maxVertices) if (vertexIndex>=0 && vertexIndex<maxVertices)
{ {
vertices[4*vertexIndex + (groupCode/10-1)] = toReal(groupValue); vertices[4*static_cast<unsigned int>(vertexIndex) + (groupCode/10-1)] = toReal(groupValue);
} }
} }
else if (groupCode==42 && vertexIndex<maxVertices) else if (groupCode==42 && vertexIndex<maxVertices)
@ -1757,7 +1761,7 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
if (controlPointIndex>=0 && controlPointIndex<maxControlPoints) if (controlPointIndex>=0 && controlPointIndex<maxControlPoints)
{ {
controlPoints[3*controlPointIndex + (groupCode/10-1)] = toReal(groupValue); controlPoints[3*static_cast<unsigned int>(controlPointIndex) + (groupCode/10-1)] = toReal(groupValue);
} }
return true; return true;
} }
@ -1772,7 +1776,7 @@ bool DL_Dxf::handleSplineData(DL_CreationInterface* /*creationInterface*/)
if (fitPointIndex>=0 && fitPointIndex<maxFitPoints) if (fitPointIndex>=0 && fitPointIndex<maxFitPoints)
{ {
fitPoints[3*fitPointIndex + ((groupCode-1)/10-1)] = toReal(groupValue); fitPoints[3*static_cast<unsigned int>(fitPointIndex) + ((groupCode-1)/10-1)] = toReal(groupValue);
} }
return true; return true;
} }
@ -1838,7 +1842,7 @@ bool DL_Dxf::handleLeaderData(DL_CreationInterface* /*creationInterface*/)
if (leaderVertexIndex>=0 && if (leaderVertexIndex>=0 &&
leaderVertexIndex<maxLeaderVertices) leaderVertexIndex<maxLeaderVertices)
{ {
leaderVertices[3*leaderVertexIndex + (groupCode/10-1)] leaderVertices[3*static_cast<unsigned int>(leaderVertexIndex) + (groupCode/10-1)]
= toReal(groupValue); = toReal(groupValue);
} }
} }
@ -2177,7 +2181,7 @@ void DL_Dxf::addHatch(DL_CreationInterface* creationInterface)
for (unsigned int i=0; i<hatchEdges.size(); i++) for (unsigned int i=0; i<hatchEdges.size(); i++)
{ {
creationInterface->addHatchLoop(DL_HatchLoopData(static_cast<unsigned int>(hatchEdges[i].size()))); creationInterface->addHatchLoop(DL_HatchLoopData(static_cast<int>(hatchEdges[i].size())));
for (unsigned int k=0; k<hatchEdges[i].size(); k++) for (unsigned int k=0; k<hatchEdges[i].size(); k++)
{ {
creationInterface->addHatchEdge(DL_HatchEdgeData(hatchEdges[i][k])); creationInterface->addHatchEdge(DL_HatchEdgeData(hatchEdges[i][k]));
@ -2373,7 +2377,7 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface)
switch (groupCode) switch (groupCode)
{ {
case 94: case 94:
hatchEdge.degree = toInt(groupValue); hatchEdge.degree = static_cast<unsigned int>(toInt(groupValue));
return true; return true;
case 73: case 73:
hatchEdge.rational = toBool(groupValue); hatchEdge.rational = toBool(groupValue);
@ -2382,13 +2386,13 @@ bool DL_Dxf::handleHatchData(DL_CreationInterface* creationInterface)
hatchEdge.periodic = toBool(groupValue); hatchEdge.periodic = toBool(groupValue);
return true; return true;
case 95: case 95:
hatchEdge.nKnots = toInt(groupValue); hatchEdge.nKnots = static_cast<unsigned int>(toInt(groupValue));
return true; return true;
case 96: case 96:
hatchEdge.nControl = toInt(groupValue); hatchEdge.nControl = static_cast<unsigned int>(toInt(groupValue));
return true; return true;
case 97: case 97:
hatchEdge.nFit = toInt(groupValue); hatchEdge.nFit = static_cast<unsigned int>(toInt(groupValue));
return true; return true;
case 40: case 40:
if (hatchEdge.knots.size() < hatchEdge.nKnots) if (hatchEdge.knots.size() < hatchEdge.nKnots)
@ -2761,7 +2765,6 @@ void DL_Dxf::writePolyline(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data from the file * @param data Entity data from the file
* @param attrib Attributes
*/ */
void DL_Dxf::writeVertex(DL_WriterA& dw, void DL_Dxf::writeVertex(DL_WriterA& dw,
const DL_VertexData& data) const DL_VertexData& data)
@ -2829,10 +2832,10 @@ void DL_Dxf::writeSpline(DL_WriterA& dw,
dw.dxfString(100, "AcDbSpline"); dw.dxfString(100, "AcDbSpline");
} }
dw.dxfInt(70, data.flags); dw.dxfInt(70, data.flags);
dw.dxfInt(71, data.degree); dw.dxfInt(71, static_cast<int>(data.degree));
dw.dxfInt(72, data.nKnots); // number of knots dw.dxfInt(72, static_cast<int>(data.nKnots)); // number of knots
dw.dxfInt(73, data.nControl); // number of control points dw.dxfInt(73, static_cast<int>(data.nControl)); // number of control points
dw.dxfInt(74, data.nFit); // number of fit points dw.dxfInt(74, static_cast<int>(data.nFit)); // number of fit points
} }
@ -2842,7 +2845,6 @@ void DL_Dxf::writeSpline(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data from the file * @param data Entity data from the file
* @param attrib Attributes
*/ */
void DL_Dxf::writeControlPoint(DL_WriterA& dw, void DL_Dxf::writeControlPoint(DL_WriterA& dw,
const DL_ControlPointData& data) const DL_ControlPointData& data)
@ -2860,7 +2862,6 @@ void DL_Dxf::writeControlPoint(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data from the file * @param data Entity data from the file
* @param attrib Attributes
*/ */
void DL_Dxf::writeFitPoint(DL_WriterA& dw, void DL_Dxf::writeFitPoint(DL_WriterA& dw,
const DL_FitPointData& data) const DL_FitPointData& data)
@ -2878,7 +2879,6 @@ void DL_Dxf::writeFitPoint(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data from the file * @param data Entity data from the file
* @param attrib Attributes
*/ */
void DL_Dxf::writeKnot(DL_WriterA& dw, void DL_Dxf::writeKnot(DL_WriterA& dw,
const DL_KnotData& data) const DL_KnotData& data)
@ -3264,7 +3264,7 @@ void DL_Dxf::writeDimStyleOverrides(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific aligned dimension data from the file * @param edata Specific aligned dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimAligned(DL_WriterA& dw, void DL_Dxf::writeDimAligned(DL_WriterA& dw,
@ -3330,7 +3330,7 @@ void DL_Dxf::writeDimAligned(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific linear dimension data from the file * @param edata Specific linear dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimLinear(DL_WriterA& dw, void DL_Dxf::writeDimLinear(DL_WriterA& dw,
@ -3403,7 +3403,7 @@ void DL_Dxf::writeDimLinear(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific radial dimension data from the file * @param edata Specific radial dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimRadial(DL_WriterA& dw, void DL_Dxf::writeDimRadial(DL_WriterA& dw,
@ -3467,7 +3467,7 @@ void DL_Dxf::writeDimRadial(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific diametric dimension data from the file * @param edata Specific diametric dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimDiametric(DL_WriterA& dw, void DL_Dxf::writeDimDiametric(DL_WriterA& dw,
@ -3531,7 +3531,7 @@ void DL_Dxf::writeDimDiametric(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific angular dimension data from the file * @param edata Specific angular dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimAngular(DL_WriterA& dw, void DL_Dxf::writeDimAngular(DL_WriterA& dw,
@ -3603,7 +3603,7 @@ void DL_Dxf::writeDimAngular(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific angular dimension data from the file * @param edata Specific angular dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimAngular3P(DL_WriterA& dw, void DL_Dxf::writeDimAngular3P(DL_WriterA& dw,
@ -3672,7 +3672,7 @@ void DL_Dxf::writeDimAngular3P(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Generic dimension data for from the file * @param data Generic dimension data for from the file
* @param data Specific ordinate dimension data from the file * @param edata Specific ordinate dimension data from the file
* @param attrib Attributes * @param attrib Attributes
*/ */
void DL_Dxf::writeDimOrdinate(DL_WriterA& dw, void DL_Dxf::writeDimOrdinate(DL_WriterA& dw,
@ -3839,9 +3839,11 @@ void DL_Dxf::writeHatch1(DL_WriterA& dw,
*/ */
void DL_Dxf::writeHatch2(DL_WriterA& dw, void DL_Dxf::writeHatch2(DL_WriterA& dw,
const DL_HatchData& data, const DL_HatchData& data,
const DL_Attributes& /*attrib*/) const const DL_Attributes& attrib) const
{ {
Q_UNUSED(attrib);
dw.dxfInt(75, 0); // odd parity dw.dxfInt(75, 0); // odd parity
dw.dxfInt(76, 1); // pattern type dw.dxfInt(76, 1); // pattern type
if (data.solid==false) if (data.solid==false)
@ -3877,7 +3879,6 @@ void DL_Dxf::writeHatch2(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data. * @param data Entity data.
* @param attrib Attributes
*/ */
void DL_Dxf::writeHatchLoop1(DL_WriterA& dw, void DL_Dxf::writeHatchLoop1(DL_WriterA& dw,
const DL_HatchLoopData& data) const DL_HatchLoopData& data)
@ -3895,12 +3896,11 @@ void DL_Dxf::writeHatchLoop1(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data. * @param data Entity data.
* @param attrib Attributes
*/ */
void DL_Dxf::writeHatchLoop2(DL_WriterA& dw, void DL_Dxf::writeHatchLoop2(DL_WriterA& dw,
const DL_HatchLoopData& /*data*/) const DL_HatchLoopData& data)
{ {
Q_UNUSED(data);
dw.dxfInt(97, 0); dw.dxfInt(97, 0);
} }
@ -3910,7 +3910,6 @@ void DL_Dxf::writeHatchLoop2(DL_WriterA& dw,
* *
* @param dw DXF writer * @param dw DXF writer
* @param data Entity data. * @param data Entity data.
* @param attrib Attributes
*/ */
void DL_Dxf::writeHatchEdge(DL_WriterA& dw, void DL_Dxf::writeHatchEdge(DL_WriterA& dw,
const DL_HatchEdgeData& data) const DL_HatchEdgeData& data)
@ -3957,11 +3956,11 @@ void DL_Dxf::writeHatchEdge(DL_WriterA& dw,
// spline: // spline:
case 4: case 4:
dw.dxfInt(94, data.degree); dw.dxfInt(94, static_cast<int>(data.degree));
dw.dxfBool(73, data.rational); dw.dxfBool(73, data.rational);
dw.dxfBool(74, data.periodic); dw.dxfBool(74, data.periodic);
dw.dxfInt(95, data.nKnots); dw.dxfInt(95, static_cast<int>(data.nKnots));
dw.dxfInt(96, data.nControl); dw.dxfInt(96, static_cast<int>(data.nControl));
for (unsigned int i=0; i<data.knots.size(); i++) for (unsigned int i=0; i<data.knots.size(); i++)
{ {
dw.dxfReal(40, data.knots[i]); dw.dxfReal(40, data.knots[i]);
@ -3977,7 +3976,7 @@ void DL_Dxf::writeHatchEdge(DL_WriterA& dw,
} }
if (data.nFit>0) if (data.nFit>0)
{ {
dw.dxfInt(97, data.nFit); dw.dxfInt(97, static_cast<int>(data.nFit));
for (unsigned int i=0; i<data.fitPoints.size(); i++) for (unsigned int i=0; i<data.fitPoints.size(); i++)
{ {
dw.dxfReal(11, data.fitPoints[i][0]); dw.dxfReal(11, data.fitPoints[i][0]);
@ -5816,7 +5815,7 @@ int DL_Dxf::getLibVersion(const std::string& str)
{ {
if (str[i]=='.') if (str[i]=='.')
{ {
d[idx] = i; d[idx] = static_cast<int>(i);
idx++; idx++;
} }
} }
@ -5827,12 +5826,12 @@ int DL_Dxf::getLibVersion(const std::string& str)
std::string v[4]; std::string v[4];
v[0] = str.substr(0, d[0]); v[0] = str.substr(0, static_cast<unsigned int>(d[0]));
v[1] = str.substr(d[0]+1, d[1]-d[0]-1); v[1] = str.substr(static_cast<unsigned int>(d[0]+1), static_cast<unsigned int>(d[1]-d[0]-1));
v[2] = str.substr(d[1]+1, d[2]-d[1]-1); v[2] = str.substr(static_cast<unsigned int>(d[1]+1), static_cast<unsigned int>(d[2]-d[1]-1));
if (idx>=3) if (idx>=3)
{ {
v[3] = str.substr(d[2]+1, d[3]-d[2]-1); v[3] = str.substr(static_cast<unsigned int>(d[2]+1), static_cast<unsigned int>(d[3]-d[2]-1));
} }
else else
{ {

View File

@ -390,7 +390,9 @@ struct DXFLIB_EXPORT DL_PolylineData
* Parameters: see member variables. * Parameters: see member variables.
*/ */
DL_PolylineData(int pNumber, int pMVerteces, int pNVerteces, int pFlags) DL_PolylineData(int pNumber, int pMVerteces, int pNVerteces, int pFlags)
: number(pNumber), m(pMVerteces), n(pNVerteces), flags(pFlags) : number(static_cast<unsigned int>(pNumber)),
m(static_cast<unsigned int>(pMVerteces)),
n(static_cast<unsigned int>(pNVerteces)), flags(pFlags)
{ {
} }
@ -519,10 +521,10 @@ struct DXFLIB_EXPORT DL_SplineData
int nControl, int nControl,
int nFit, int nFit,
int flags) : int flags) :
degree(degree), degree(static_cast<unsigned int>(degree)),
nKnots(nKnots), nKnots(static_cast<unsigned int>(nKnots)),
nControl(nControl), nControl(static_cast<unsigned int>(nControl)),
nFit(nFit), nFit(static_cast<unsigned int>(nFit)),
flags(flags), flags(flags),
tangentStartX(0.0), tangentStartX(0.0),
tangentStartY(0.0), tangentStartY(0.0),
@ -837,10 +839,22 @@ struct DXFLIB_EXPORT DL_TextData
text(text), text(text),
style(style), style(style),
angle(angle) angle(angle)
{ {}
}
virtual ~DL_TextData(){} ~DL_TextData()
{}
DL_TextData(const DL_TextData &data)
:ipx(data.ipx), ipy(data.ipy), ipz(data.ipz),
apx(data.apx), apy(data.apy), apz(data.apz),
height(data.height), xScaleFactor(data.xScaleFactor),
textGenerationFlags(data.textGenerationFlags),
hJustification(data.hJustification),
vJustification(data.vJustification),
text(data.text),
style(data.style),
angle(data.angle)
{}
/*! X Coordinate of insertion point. */ /*! X Coordinate of insertion point. */
double ipx; double ipx;
@ -892,8 +906,7 @@ struct DXFLIB_EXPORT DL_AttributeData : public DL_TextData
{ {
DL_AttributeData(const DL_TextData& tData, const std::string& tag) DL_AttributeData(const DL_TextData& tData, const std::string& tag)
: DL_TextData(tData), tag(tag) : DL_TextData(tData), tag(tag)
{ {}
}
/** /**
* Constructor. * Constructor.
@ -919,14 +932,15 @@ struct DXFLIB_EXPORT DL_AttributeData : public DL_TextData
style, style,
angle), angle),
tag(tag) tag(tag)
{ {}
}
~DL_AttributeData()
{}
/*! Tag. */ /*! Tag. */
std::string tag; std::string tag;
}; };
/** /**
* Generic Dimension Data. * Generic Dimension Data.
*/ */

View File

@ -65,12 +65,7 @@ public:
} }
/** /**
* Constructor for DXF extrusion. * @brief DL_Extrusion Constructor for DXF extrusion.
*
* @param direction Vector of axis along which the entity shall be extruded
* this is also the Z axis of the Entity coordinate system
* @param elevation Distance of the entities XY plane from the origin of the
* world coordinate system
*/ */
DL_Extrusion(double dx, double dy, double dz, double elevation) DL_Extrusion(double dx, double dy, double dz, double elevation)
: direction(new double[3]), elevation(elevation) : direction(new double[3]), elevation(elevation)
@ -81,7 +76,7 @@ public:
/** /**
* Sets the direction vector. * @brief setDirection Sets the direction vector.
*/ */
void setDirection(double dx, double dy, double dz) void setDirection(double dx, double dy, double dz)
{ {
@ -100,11 +95,6 @@ public:
return direction; return direction;
} }
/**
* @return direction vector.
*/
void getDirection(double dir[]) const void getDirection(double dir[]) const
{ {
dir[0]=direction[0]; dir[0]=direction[0];
@ -152,7 +142,14 @@ public:
private: private:
/**
* @brief direction Vector of axis along which the entity shall be extruded this is also the Z axis of the Entity
* coordinate system
*/
double *direction; double *direction;
/**
* @brief elevation Distance of the entities XY plane from the origin of the world coordinate system
*/
double elevation; double elevation;
}; };

View File

@ -0,0 +1,638 @@
/****************************************************************************
** Copyright (C) 2015 Roman Telezhynskyi <dismine(at)gmail.com>
** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
** Copyright (C) 2001 Robert J. Campbell Jr.
**
** This file is part of the dxflib project.
**
** This file 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 2 of the License, or
** (at your option) any later version.
**
** Licensees holding valid dxflib Professional Edition licenses may use
** this file in accordance with the dxflib Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
**********************************************************************/
#include "dl_writer.h"
/**
* @param version DXF version. Defaults to DL_VERSION_2002.
*/
DL_Writer::DL_Writer(DL_Codes::version version)
: m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version)
{}
DL_Writer::~DL_Writer()
{}
/** Generic section for section 'name'.
*
* <pre>
* 0
* SECTION
* 2
* name
* </pre>
*/
void DL_Writer::section(const char *name) const
{
dxfString(0, "SECTION");
dxfString(2, name);
}
/**
* Section HEADER
*
* <pre>
* 0
* SECTION
* 2
* HEADER
* </pre>
*/
void DL_Writer::sectionHeader() const
{
section("HEADER");
}
/**
* Section TABLES
*
* <pre>
* 0
* SECTION
* 2
* TABLES
* </pre>
*/
void DL_Writer::sectionTables() const
{
section("TABLES");
}
/**
* Section BLOCKS
*
* <pre>
* 0
* SECTION
* 2
* BLOCKS
* </pre>
*/
void DL_Writer::sectionBlocks() const
{
section("BLOCKS");
}
/**
* Section ENTITIES
*
* <pre>
* 0
* SECTION
* 2
* ENTITIES
* </pre>
*/
void DL_Writer::sectionEntities() const
{
section("ENTITIES");
}
/**
* Section CLASSES
*
* <pre>
* 0
* SECTION
* 2
* CLASSES
* </pre>
*/
void DL_Writer::sectionClasses() const
{
section("CLASSES");
}
/**
* Section OBJECTS
*
* <pre>
* 0
* SECTION
* 2
* OBJECTS
* </pre>
*/
void DL_Writer::sectionObjects() const
{
section("OBJECTS");
}
/**
* End of a section.
*
* <pre>
* 0
* ENDSEC
* </pre>
*/
void DL_Writer::sectionEnd() const
{
dxfString(0, "ENDSEC");
}
/**
* Generic table for table 'name' with 'num' entries:
*
* <pre>
* 0
* TABLE
* 2
* name
* 70
* num
* </pre>
*/
void DL_Writer::table(const char *name, int num, int h) const
{
dxfString(0, "TABLE");
dxfString(2, name);
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, h);
}
dxfString(100, "AcDbSymbolTable");
}
dxfInt(70, num);
}
/** Table for layers.
*
* @param num Number of layers in total.
*
* <pre>
* 0
* TABLE
* 2
* LAYER
* 70
* num
* </pre>
*/
void DL_Writer::tableLayers(int num) const
{
table("LAYER", num, 2);
}
/** Table for line types.
*
* @param num Number of line types in total.
*
* <pre>
* 0
* TABLE
* 2
* LTYPE
* 70
* num
* </pre>
*/
void DL_Writer::tableLinetypes(int num) const
{
//linetypeHandle = 5;
table("LTYPE", num, 5);
}
/** Table for application id.
*
* @param num Number of registered applications in total.
*
* <pre>
* 0
* TABLE
* 2
* APPID
* 70
* num
* </pre>
*/
void DL_Writer::tableAppid(int num) const
{
table("APPID", num, 9);
}
/** Table for text style.
*
* @param num Number of text styles.
*
* <pre>
* 0
* TABLE
* 2
* STYLE
* 70
* num
* </pre>
*/
void DL_Writer::tableStyle(int num) const
{
table("STYLE", num, 3);
}
/**
* End of a table.
*
* <pre>
* 0
* ENDTAB
* </pre>
*/
void DL_Writer::tableEnd() const
{
dxfString(0, "ENDTAB");
}
/**
* End of the DXF file.
*
* <pre>
* 0
* EOF
* </pre>
*/
void DL_Writer::dxfEOF() const
{
dxfString(0, "EOF");
}
/**
* Comment.
*
* <pre>
* 999
* text
* </pre>
*/
void DL_Writer::comment(const char *text) const
{
dxfString(999, text);
}
/**
* Entity.
*
* <pre>
* 0
* entTypeName
* </pre>
*
*/
void DL_Writer::entity(const char *entTypeName) const
{
dxfString(0, entTypeName);
if (version>=DL_VERSION_2000)
{
handle();
}
}
/**
* Attributes of an entity.
*
* <pre>
* 8
* layer
* 62
* color
* 39
* width
* 6
* linetype
* </pre>
*/
void DL_Writer::entityAttributes(const DL_Attributes &attrib) const
{
// layer name:
dxfString(8, attrib.getLayer());
// R12 doesn't accept BYLAYER values. The value has to be missing
// in that case.
if (version>=DL_VERSION_2000 || attrib.getColor()!=256)
{
dxfInt(62, attrib.getColor());
}
if (version>=DL_VERSION_2000 && attrib.getColor24()!=-1)
{
dxfInt(420, attrib.getColor24());
}
if (version>=DL_VERSION_2000)
{
dxfInt(370, attrib.getWidth());
}
if (version>=DL_VERSION_2000)
{
dxfReal(48, attrib.getLinetypeScale());
}
std::string linetype = attrib.getLinetype();
std::transform(linetype.begin(), linetype.end(), linetype.begin(), ::toupper);
if (version>=DL_VERSION_2000 || linetype=="BYLAYER")
{
dxfString(6, attrib.getLinetype());
}
}
/**
* Subclass.
*/
void DL_Writer::subClass(const char *sub) const
{
dxfString(100, sub);
}
/**
* Layer (must be in the TABLES section LAYER).
*
* <pre>
* 0
* LAYER
* </pre>
*/
void DL_Writer::tableLayerEntry(unsigned long h) const
{
dxfString(0, "LAYER");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
dxfString(100, "AcDbSymbolTableRecord");
dxfString(100, "AcDbLayerTableRecord");
}
}
/**
* Line type (must be in the TABLES section LTYPE).
*
* <pre>
* 0
* LTYPE
* </pre>
*/
void DL_Writer::tableLinetypeEntry(unsigned long h) const
{
dxfString(0, "LTYPE");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, 0x5);
dxfString(100, "AcDbSymbolTableRecord");
dxfString(100, "AcDbLinetypeTableRecord");
}
}
/**
* Appid (must be in the TABLES section APPID).
*
* <pre>
* 0
* APPID
* </pre>
*/
void DL_Writer::tableAppidEntry(unsigned long h) const
{
dxfString(0, "APPID");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, 0x9);
dxfString(100, "AcDbSymbolTableRecord");
dxfString(100, "AcDbRegAppTableRecord");
}
}
/**
* Block (must be in the section BLOCKS).
*
* <pre>
* 0
* BLOCK
* </pre>
*/
void DL_Writer::sectionBlockEntry(unsigned long h) const
{
dxfString(0, "BLOCK");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, blockHandle);
dxfString(100, "AcDbEntity");
if (h==0x1C)
{
dxfInt(67, 1);
}
dxfString(8, "0"); // TODO: Layer for block
dxfString(100, "AcDbBlockBegin");
}
}
/**
* End of Block (must be in the section BLOCKS).
*
* <pre>
* 0
* ENDBLK
* </pre>
*/
void DL_Writer::sectionBlockEntryEnd(unsigned long h) const
{
dxfString(0, "ENDBLK");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, blockHandle);
dxfString(100, "AcDbEntity");
if (h==0x1D)
{
dxfInt(67, 1);
}
dxfString(8, "0"); // TODO: Layer for block
dxfString(100, "AcDbBlockEnd");
}
}
void DL_Writer::color(int col) const
{
dxfInt(62, col);
}
void DL_Writer::linetype(const char *lt) const
{
dxfString(6, lt);
}
void DL_Writer::linetypeScale(double scale) const
{
dxfReal(48, scale);
}
void DL_Writer::lineWeight(int lw) const
{
dxfInt(370, lw);
}
void DL_Writer::coord(int gc, double x, double y, double z) const
{
dxfReal(gc, x);
dxfReal(gc+10, y);
dxfReal(gc+20, z);
}
void DL_Writer::coordTriplet(int gc, const double *value) const
{
if (value)
{
dxfReal(gc, *value++);
dxfReal(gc+10, *value++);
dxfReal(gc+20, *value++);
}
}
void DL_Writer::resetHandle() const
{
m_handle = 1;
}
/**
* Writes a unique handle and returns it.
*/
unsigned long DL_Writer::handle(int gc) const
{
// handle has to be hex
dxfHex(gc, static_cast<int>(m_handle));
return m_handle++;
}
/**
* @return Next handle that will be written.
*/
unsigned long DL_Writer::getNextHandle() const
{
return m_handle;
}
/**
* Increases handle, so that the handle returned remains available.
*/
unsigned long DL_Writer::incHandle() const
{
return m_handle++;
}
/**
* Sets the handle of the model space. Entities refer to
* this handle.
*/
void DL_Writer::setModelSpaceHandle(unsigned long h) const
{
modelSpaceHandle = h;
}
unsigned long DL_Writer::getModelSpaceHandle() const
{
return modelSpaceHandle;
}
/**
* Sets the handle of the paper space. Some special blocks refer to
* this handle.
*/
void DL_Writer::setPaperSpaceHandle(unsigned long h) const
{
paperSpaceHandle = h;
}
unsigned long DL_Writer::getPaperSpaceHandle() const
{
return paperSpaceHandle;
}
/**
* Sets the handle of the paper space 0. Some special blocks refer to
* this handle.
*/
void DL_Writer::setPaperSpace0Handle(unsigned long h) const
{
paperSpace0Handle = h;
}
/**
* Sets the handle of the paper space 0. Some special blocks refer to
* this handle.
*/
unsigned long DL_Writer::getPaperSpace0Handle() const
{
return paperSpace0Handle;
}
/**
* Can be overwritten by the implementing class to write a
* bool value to the file.
*
* @param gc Group code.
* @param value The bool value.
*/
void DL_Writer::dxfBool(int gc, bool value) const
{
dxfInt(gc, static_cast<int>(value));
}

View File

@ -1,4 +1,5 @@
/**************************************************************************** /****************************************************************************
** Copyright (C) 2015 Roman Telezhynskyi <dismine(at)gmail.com>
** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved. ** Copyright (C) 2001-2013 RibbonSoft, GmbH. All rights reserved.
** Copyright (C) 2001 Robert J. Campbell Jr. ** Copyright (C) 2001 Robert J. Campbell Jr.
** **
@ -59,604 +60,53 @@
class DXFLIB_EXPORT DL_Writer class DXFLIB_EXPORT DL_Writer
{ {
public: public:
/** explicit DL_Writer(DL_Codes::version version);
* @param version DXF version. Defaults to DL_VERSION_2002. virtual ~DL_Writer();
*/
explicit DL_Writer(DL_Codes::version version)
: m_handle(0x30), modelSpaceHandle(0), paperSpaceHandle(0), paperSpace0Handle(0), version(version)
{
}
virtual ~DL_Writer() {} void section(const char* name) const;
; void sectionHeader() const;
void sectionTables() const;
void sectionBlocks() const;
void sectionEntities() const;
void sectionClasses() const;
void sectionObjects() const;
void sectionEnd() const;
void table(const char* name, int num, int h=0) const;
void tableLayers(int num) const;
void tableLinetypes(int num) const;
void tableAppid(int num) const;
void tableStyle(int num) const;
void tableEnd() const;
void dxfEOF() const;
void comment(const char* text) const;
void entity(const char* entTypeName) const;
void entityAttributes(const DL_Attributes& attrib) const;
void subClass(const char* sub) const;
void tableLayerEntry(unsigned long int h=0) const;
void tableLinetypeEntry(unsigned long int h=0) const;
void tableAppidEntry(unsigned long int h=0) const;
void sectionBlockEntry(unsigned long int h=0) const;
void sectionBlockEntryEnd(unsigned long int h=0) const;
void color(int col=256) const;
void linetype(const char *lt) const;
void linetypeScale(double scale) const;
void lineWeight(int lw) const;
void coord(int gc, double x, double y, double z=0) const;
void coordTriplet(int gc, const double* value) const;
void resetHandle() const;
/** Generic section for section 'name'. unsigned long handle(int gc=5) const;
* unsigned long getNextHandle() const;
* <pre> unsigned long incHandle() const;
* 0
* SECTION
* 2
* name
* </pre>
*/
void section(const char* name) const
{
dxfString(0, "SECTION");
dxfString(2, name);
}
/** void setModelSpaceHandle(unsigned long h) const;
* Section HEADER unsigned long getModelSpaceHandle() const;
*
* <pre>
* 0
* SECTION
* 2
* HEADER
* </pre>
*/
void sectionHeader() const
{
section("HEADER");
}
/** void setPaperSpaceHandle(unsigned long h) const;
* Section TABLES unsigned long getPaperSpaceHandle() const;
*
* <pre>
* 0
* SECTION
* 2
* TABLES
* </pre>
*/
void sectionTables() const
{
section("TABLES");
}
/** void setPaperSpace0Handle(unsigned long h) const;
* Section BLOCKS unsigned long getPaperSpace0Handle() const;
*
* <pre>
* 0
* SECTION
* 2
* BLOCKS
* </pre>
*/
void sectionBlocks() const
{
section("BLOCKS");
}
/**
* Section ENTITIES
*
* <pre>
* 0
* SECTION
* 2
* ENTITIES
* </pre>
*/
void sectionEntities() const
{
section("ENTITIES");
}
/**
* Section CLASSES
*
* <pre>
* 0
* SECTION
* 2
* CLASSES
* </pre>
*/
void sectionClasses() const
{
section("CLASSES");
}
/**
* Section OBJECTS
*
* <pre>
* 0
* SECTION
* 2
* OBJECTS
* </pre>
*/
void sectionObjects() const
{
section("OBJECTS");
}
/**
* End of a section.
*
* <pre>
* 0
* ENDSEC
* </pre>
*/
void sectionEnd() const
{
dxfString(0, "ENDSEC");
}
/**
* Generic table for table 'name' with 'num' entries:
*
* <pre>
* 0
* TABLE
* 2
* name
* 70
* num
* </pre>
*/
void table(const char* name, int num, int h=0) const
{
dxfString(0, "TABLE");
dxfString(2, name);
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, h);
}
dxfString(100, "AcDbSymbolTable");
}
dxfInt(70, num);
}
/** Table for layers.
*
* @param num Number of layers in total.
*
* <pre>
* 0
* TABLE
* 2
* LAYER
* 70
* num
* </pre>
*/
void tableLayers(int num) const
{
table("LAYER", num, 2);
}
/** Table for line types.
*
* @param num Number of line types in total.
*
* <pre>
* 0
* TABLE
* 2
* LTYPE
* 70
* num
* </pre>
*/
void tableLinetypes(int num) const
{
//linetypeHandle = 5;
table("LTYPE", num, 5);
}
/** Table for application id.
*
* @param num Number of registered applications in total.
*
* <pre>
* 0
* TABLE
* 2
* APPID
* 70
* num
* </pre>
*/
void tableAppid(int num) const
{
table("APPID", num, 9);
}
/** Table for text style.
*
* @param num Number of text styles.
*
* <pre>
* 0
* TABLE
* 2
* STYLE
* 70
* num
* </pre>
*/
void tableStyle(int num) const
{
table("STYLE", num, 3);
}
/**
* End of a table.
*
* <pre>
* 0
* ENDTAB
* </pre>
*/
void tableEnd() const
{
dxfString(0, "ENDTAB");
}
/**
* End of the DXF file.
*
* <pre>
* 0
* EOF
* </pre>
*/
void dxfEOF() const
{
dxfString(0, "EOF");
}
/**
* Comment.
*
* <pre>
* 999
* text
* </pre>
*/
void comment(const char* text) const
{
dxfString(999, text);
}
/**
* Entity.
*
* <pre>
* 0
* entTypeName
* </pre>
*
* @return Unique handle or 0.
*/
void entity(const char* entTypeName) const
{
dxfString(0, entTypeName);
if (version>=DL_VERSION_2000)
{
handle();
}
}
/**
* Attributes of an entity.
*
* <pre>
* 8
* layer
* 62
* color
* 39
* width
* 6
* linetype
* </pre>
*/
void entityAttributes(const DL_Attributes& attrib) const
{
// layer name:
dxfString(8, attrib.getLayer());
// R12 doesn't accept BYLAYER values. The value has to be missing
// in that case.
if (version>=DL_VERSION_2000 || attrib.getColor()!=256)
{
dxfInt(62, attrib.getColor());
}
if (version>=DL_VERSION_2000 && attrib.getColor24()!=-1)
{
dxfInt(420, attrib.getColor24());
}
if (version>=DL_VERSION_2000)
{
dxfInt(370, attrib.getWidth());
}
if (version>=DL_VERSION_2000)
{
dxfReal(48, attrib.getLinetypeScale());
}
std::string linetype = attrib.getLinetype();
std::transform(linetype.begin(), linetype.end(), linetype.begin(), ::toupper);
if (version>=DL_VERSION_2000 || linetype=="BYLAYER")
{
dxfString(6, attrib.getLinetype());
}
}
/**
* Subclass.
*/
void subClass(const char* sub) const
{
dxfString(100, sub);
}
/**
* Layer (must be in the TABLES section LAYER).
*
* <pre>
* 0
* LAYER
* </pre>
*/
void tableLayerEntry(unsigned long int h=0) const
{
dxfString(0, "LAYER");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
dxfString(100, "AcDbSymbolTableRecord");
dxfString(100, "AcDbLayerTableRecord");
}
}
/**
* Line type (must be in the TABLES section LTYPE).
*
* <pre>
* 0
* LTYPE
* </pre>
*/
void tableLinetypeEntry(unsigned long int h=0) const
{
dxfString(0, "LTYPE");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, 0x5);
dxfString(100, "AcDbSymbolTableRecord");
dxfString(100, "AcDbLinetypeTableRecord");
}
}
/**
* Appid (must be in the TABLES section APPID).
*
* <pre>
* 0
* APPID
* </pre>
*/
void tableAppidEntry(unsigned long int h=0) const
{
dxfString(0, "APPID");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, 0x9);
dxfString(100, "AcDbSymbolTableRecord");
dxfString(100, "AcDbRegAppTableRecord");
}
}
/**
* Block (must be in the section BLOCKS).
*
* <pre>
* 0
* BLOCK
* </pre>
*/
void sectionBlockEntry(unsigned long int h=0) const
{
dxfString(0, "BLOCK");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, blockHandle);
dxfString(100, "AcDbEntity");
if (h==0x1C)
{
dxfInt(67, 1);
}
dxfString(8, "0"); // TODO: Layer for block
dxfString(100, "AcDbBlockBegin");
}
}
/**
* End of Block (must be in the section BLOCKS).
*
* <pre>
* 0
* ENDBLK
* </pre>
*/
void sectionBlockEntryEnd(unsigned long int h=0) const
{
dxfString(0, "ENDBLK");
if (version>=DL_VERSION_2000)
{
if (h==0)
{
handle();
}
else
{
dxfHex(5, static_cast<int>(h));
}
//dxfHex(330, blockHandle);
dxfString(100, "AcDbEntity");
if (h==0x1D)
{
dxfInt(67, 1);
}
dxfString(8, "0"); // TODO: Layer for block
dxfString(100, "AcDbBlockEnd");
}
}
void color(int col=256) const
{
dxfInt(62, col);
}
void linetype(const char *lt) const
{
dxfString(6, lt);
}
void linetypeScale(double scale) const
{
dxfReal(48, scale);
}
void lineWeight(int lw) const
{
dxfInt(370, lw);
}
void coord(int gc, double x, double y, double z=0) const
{
dxfReal(gc, x);
dxfReal(gc+10, y);
dxfReal(gc+20, z);
}
void coordTriplet(int gc, const double* value) const
{
if (value)
{
dxfReal(gc, *value++);
dxfReal(gc+10, *value++);
dxfReal(gc+20, *value++);
}
}
void resetHandle() const
{
m_handle = 1;
}
/**
* Writes a unique handle and returns it.
*/
unsigned long handle(int gc=5) const
{
// handle has to be hex
dxfHex(gc, static_cast<int>(m_handle));
return m_handle++;
}
/**
* @return Next handle that will be written.
*/
unsigned long getNextHandle() const
{
return m_handle;
}
/**
* Increases handle, so that the handle returned remains available.
*/
unsigned long incHandle() const
{
return m_handle++;
}
/**
* Sets the handle of the model space. Entities refer to
* this handle.
*/
// cppcheck-suppress functionConst
void setModelSpaceHandle(unsigned long h)
{
modelSpaceHandle = h;
}
unsigned long getModelSpaceHandle() const
{
return modelSpaceHandle;
}
/**
* Sets the handle of the paper space. Some special blocks refer to
* this handle.
*/
// cppcheck-suppress functionConst
void setPaperSpaceHandle(unsigned long h)
{
paperSpaceHandle = h;
}
unsigned long getPaperSpaceHandle() const
{
return paperSpaceHandle;
}
/**
* Sets the handle of the paper space 0. Some special blocks refer to
* this handle.
*/
// cppcheck-suppress functionConst
void setPaperSpace0Handle(unsigned long h)
{
paperSpace0Handle = h;
}
unsigned long getPaperSpace0Handle() const
{
return paperSpace0Handle;
}
/** /**
* Must be overwritten by the implementing class to write a * Must be overwritten by the implementing class to write a
@ -676,17 +126,8 @@ public:
*/ */
virtual void dxfInt(int gc, int value) const = 0; virtual void dxfInt(int gc, int value) const = 0;
/**
* Can be overwritten by the implementing class to write a virtual void dxfBool(int gc, bool value) const;
* bool value to the file.
*
* @param gc Group code.
* @param value The bool value.
*/
virtual void dxfBool(int gc, bool value) const
{
dxfInt(gc, static_cast<int>(value));
}
/** /**
* Must be overwritten by the implementing class to write an * Must be overwritten by the implementing class to write an
@ -725,7 +166,6 @@ protected:
* DXF version to be created. * DXF version to be created.
*/ */
DL_Codes::version version; DL_Codes::version version;
private:
}; };
#endif #endif

View File

@ -76,12 +76,12 @@ void DL_WriterA::dxfReal(int gc, double value) const
if (str[i]=='.') if (str[i]=='.')
{ {
dot = true; dot = true;
end = i+2; end = static_cast<int>(i)+2;
continue; continue;
} }
else if (dot && str[i]!='0') else if (dot && str[i]!='0')
{ {
end = i+1; end = static_cast<int>(i)+1;
} }
} }
if (end>0 && end<static_cast<int>(strlen(str))) if (end>0 && end<static_cast<int>(strlen(str)))

View File

@ -41,16 +41,17 @@
/** /**
* Implements functions defined in DL_Writer for writing low * Implements functions defined in DL_Writer for writing low
* level DXF constructs to an ASCII format DXF file. * level DXF constructs to an ASCII format DXF file.
*
* @para fname File name of the file to be created.
* @para version DXF version. Defaults to DL_VERSION_2002.
*
* @todo What if \c fname is NULL? Or \c fname can't be opened for
* another reason?
*/ */
class DXFLIB_EXPORT DL_WriterA : public DL_Writer class DXFLIB_EXPORT DL_WriterA : public DL_Writer
{ {
public: public:
/**
* @param fname fname File name of the file to be created.
* @param version version DXF version. Defaults to DL_VERSION_2002.
*
* @todo What if \c fname is NULL? Or \c fname can't be opened for
* another reason?
*/
DL_WriterA(const char* fname, DL_Codes::version version=DL_VERSION_2000) DL_WriterA(const char* fname, DL_Codes::version version=DL_VERSION_2000)
: DL_Writer(version), m_ofile(fname) {} : DL_Writer(version), m_ofile(fname) {}
virtual ~DL_WriterA() {} virtual ~DL_WriterA() {}

View File

@ -5,7 +5,8 @@ SOURCES += \
$$PWD/dxflib/dl_dxf.cpp \ $$PWD/dxflib/dl_dxf.cpp \
$$PWD/dxflib/dl_writer_ascii.cpp \ $$PWD/dxflib/dl_writer_ascii.cpp \
$$PWD/vdxfengine.cpp \ $$PWD/vdxfengine.cpp \
$$PWD/vdxfpaintdevice.cpp $$PWD/vdxfpaintdevice.cpp \
$$PWD/dxflib/dl_writer.cpp
win32-msvc*:SOURCES += $$PWD/stable.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp

View File

@ -253,7 +253,8 @@ void VMeasurements::ReadMeasurements() const
qreal ksize = GetParametrDouble(dom, AttrSizeIncrease, "0"); qreal ksize = GetParametrDouble(dom, AttrSizeIncrease, "0");
qreal kheight = GetParametrDouble(dom, AttrHeightIncrease, "0"); qreal kheight = GetParametrDouble(dom, AttrHeightIncrease, "0");
tempMeash = new VMeasurement(i, name, BaseSize(), BaseHeight(), base, ksize, kheight); tempMeash = new VMeasurement(static_cast<unsigned int>(i), name, BaseSize(), BaseHeight(), base, ksize,
kheight);
base = UnitConvertor(base, MUnit(), *data->GetPatternUnit()); base = UnitConvertor(base, MUnit(), *data->GetPatternUnit());
ksize = UnitConvertor(ksize, MUnit(), *data->GetPatternUnit()); ksize = UnitConvertor(ksize, MUnit(), *data->GetPatternUnit());
@ -262,7 +263,8 @@ void VMeasurements::ReadMeasurements() const
const qreal baseSize = UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit()); const qreal baseSize = UnitConvertor(BaseSize(), MUnit(), *data->GetPatternUnit());
const qreal baseHeight = UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit()); const qreal baseHeight = UnitConvertor(BaseHeight(), MUnit(), *data->GetPatternUnit());
meash = new VMeasurement(i, name, baseSize, baseHeight, base, ksize, kheight, fullName, description); meash = new VMeasurement(static_cast<unsigned int>(i), name, baseSize, baseHeight, base, ksize, kheight,
fullName, description);
} }
else else
{ {
@ -270,10 +272,11 @@ void VMeasurements::ReadMeasurements() const
bool ok = false; bool ok = false;
qreal value = EvalFormula(tempData, formula, &ok); qreal value = EvalFormula(tempData, formula, &ok);
tempMeash = new VMeasurement(tempData, i, name, value, formula, ok); tempMeash = new VMeasurement(tempData, static_cast<unsigned int>(i), name, value, formula, ok);
value = UnitConvertor(value, MUnit(), *data->GetPatternUnit()); value = UnitConvertor(value, MUnit(), *data->GetPatternUnit());
meash = new VMeasurement(data, i, name, value, formula, ok, fullName, description); meash = new VMeasurement(data, static_cast<unsigned int>(i), name, value, formula, ok, fullName,
description);
} }
tempData->AddVariable(name, tempMeash); tempData->AddVariable(name, tempMeash);
data->AddVariable(name, meash); data->AddVariable(name, meash);
@ -883,6 +886,7 @@ qreal VMeasurements::EvalFormula(VContainer *data, const QString &formula, bool
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
Q_UNUSED(e)
*ok = false; *ok = false;
return 0; return 0;
} }

View File

@ -39,6 +39,9 @@ MOC_DIR = moc
# objecs files # objecs files
OBJECTS_DIR = obj OBJECTS_DIR = obj
# Directory for files created rcc
RCC_DIR = rcc
# Set using ccache. Function enable_ccache() defined in common.pri. # Set using ccache. Function enable_ccache() defined in common.pri.
$$enable_ccache() $$enable_ccache()
@ -53,6 +56,7 @@ CONFIG(debug, debug|release){
QMAKE_CXXFLAGS += \ QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers. # Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$GCC_DEBUG_CXXFLAGS # See common.pri for more details. $$GCC_DEBUG_CXXFLAGS # See common.pri for more details.
noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer noAddressSanitizer{ # For enable run qmake with CONFIG+=noAddressSanitizer
@ -66,15 +70,17 @@ CONFIG(debug, debug|release){
} }
} }
clang*{ clang*{
QMAKE_CXXFLAGS += \ QMAKE_CXXFLAGS += \
# Key -isystem disable checking errors in system headers. # Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. -isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and # -isystem key works only for headers. In some cases it's not enough. But we can't delete this warnings and
# want them in global list. Compromise decision delete them from local list. # want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \ QMAKE_CXXFLAGS -= \
-Wundefined-reinterpret-cast -Wundefined-reinterpret-cast \
-Wmissing-prototypes # rcc folder
} }
} else { } else {
*-g++{ *-g++{

View File

@ -40,7 +40,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPoster::VPoster(const QPrinter *printer) VPoster::VPoster(const QPrinter *printer)
:printer(printer), allowence(qRound(10./25.4*printer->resolution()))//1 cm :printer(printer), allowence(static_cast<unsigned int>(qRound(10./25.4*printer->resolution())))//1 cm
{ {
} }
@ -109,13 +109,14 @@ int VPoster::CountRows(int height) const
// Calculate how many pages will be after using allowence. // Calculate how many pages will be after using allowence.
// We know start pages count. This number not enought because // We know start pages count. This number not enought because
// each n-1 pages add (n-1)*allowence length to page (1). // each n-1 pages add (n-1)*allowence length to page (1).
const qreal addionalLength = (pCount-1)*allowence; const qreal addionalLength = (pCount-1)*static_cast<int>(allowence);
// Calculate additional length form pages that will cover this length (2). // Calculate additional length form pages that will cover this length (2).
// In the end add page length (3). // In the end add page length (3).
// Bottom page have mandatory border (4) // Bottom page have mandatory border (4)
return qCeil((addionalLength + return qCeil((addionalLength +
qCeil(addionalLength/pageLength)*allowence + allowence + imgLength)/pageLength); qCeil(addionalLength/pageLength)*static_cast<int>(allowence) + static_cast<int>(allowence) +
imgLength)/pageLength);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -138,18 +139,19 @@ int VPoster::CountColomns(int width) const
// Calculate how many pages will be after using allowence. // Calculate how many pages will be after using allowence.
// We know start pages count. This number not enought because // We know start pages count. This number not enought because
// each n-1 pages add (n-1)*allowence length to page (1). // each n-1 pages add (n-1)*allowence length to page (1).
const qreal addionalLength = (pCount-1)*allowence; const qreal addionalLength = (pCount-1)*static_cast<int>(allowence);
// Calculate additional length form pages that will cover this length (2). // Calculate additional length form pages that will cover this length (2).
// In the end add page length (3). // In the end add page length (3).
return qCeil((addionalLength + qCeil(addionalLength/pageLength)*allowence + imgLength)/pageLength); return qCeil((addionalLength + qCeil(addionalLength/pageLength)*static_cast<int>(allowence) +
imgLength)/pageLength);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QImage VPoster::Cut(int i, int j, const QImage &image) const QImage VPoster::Cut(int i, int j, const QImage &image) const
{ {
const int x = j*PageRect().width() - j*allowence; const int x = j*PageRect().width() - j*static_cast<int>(allowence);
const int y = i*PageRect().height() - i*allowence; const int y = i*PageRect().height() - i*static_cast<int>(allowence);
SCASSERT(x <= image.rect().width()); SCASSERT(x <= image.rect().width());
SCASSERT(y <= image.rect().height()); SCASSERT(y <= image.rect().height());
@ -191,29 +193,32 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
if (j != 0 && PageRect().x() > 0) if (j != 0 && PageRect().x() > 0)
{// Left border {// Left border
painter.drawLine(QLine(0, 0, 0, image.rect().height())); painter.drawLine(QLine(0, 0, 0, image.rect().height()));
painter.drawImage(QPoint(0, image.rect().height()-allowence), QImage("://scissors_vertical.png")); painter.drawImage(QPoint(0, image.rect().height()-static_cast<int>(allowence)),
QImage("://scissors_vertical.png"));
} }
if (j != colomns-1) if (j != colomns-1)
{// Right border {// Right border
painter.drawLine(QLine(image.rect().width()-allowence, 0, painter.drawLine(QLine(image.rect().width()-static_cast<int>(allowence), 0,
image.rect().width()-allowence, image.rect().height())); image.rect().width()-static_cast<int>(allowence), image.rect().height()));
} }
if (i != 0 && PageRect().y() > 0) if (i != 0 && PageRect().y() > 0)
{// Top border {// Top border
painter.drawLine(QLine(0, 0, image.rect().width(), 0)); painter.drawLine(QLine(0, 0, image.rect().width(), 0));
painter.drawImage(QPoint(image.rect().width()-allowence, 0), QImage("://scissors_horizontal.png")); painter.drawImage(QPoint(image.rect().width()-static_cast<int>(allowence), 0),
QImage("://scissors_horizontal.png"));
} }
if (rows*colomns > 1) if (rows*colomns > 1)
{ // Don't show bottom border if only one page need { // Don't show bottom border if only one page need
// Bottom border (mandatory) // Bottom border (mandatory)
painter.drawLine(QLine(0, image.rect().height()-allowence, painter.drawLine(QLine(0, image.rect().height()-static_cast<int>(allowence),
image.rect().width(), image.rect().height()-allowence)); image.rect().width(), image.rect().height()-static_cast<int>(allowence)));
if (i == rows-1) if (i == rows-1)
{ {
painter.drawImage(QPoint(image.rect().width()-allowence, image.rect().height()-allowence), painter.drawImage(QPoint(image.rect().width()-static_cast<int>(allowence),
image.rect().height()-static_cast<int>(allowence)),
QImage("://scissors_horizontal.png")); QImage("://scissors_horizontal.png"));
} }
} }
@ -221,8 +226,8 @@ QImage VPoster::Borders(int rows, int colomns, int i, int j, QImage &image, int
// Labels // Labels
const int layoutX = 15; const int layoutX = 15;
const int layoutY = 5; const int layoutY = 5;
QRect labels(layoutX, image.rect().height()-allowence+layoutY, QRect labels(layoutX, image.rect().height()-static_cast<int>(allowence)+layoutY,
image.rect().width()-(allowence+layoutX), allowence-layoutY); image.rect().width()-(static_cast<int>(allowence)+layoutX), static_cast<int>(allowence)-layoutY);
painter.drawText(labels, Qt::AlignLeft, tr("Grid ( %1 , %2 )").arg(i+1).arg(j+1)); painter.drawText(labels, Qt::AlignLeft, tr("Grid ( %1 , %2 )").arg(i+1).arg(j+1));
painter.drawText(labels, Qt::AlignHCenter, tr("Page %1 of %2").arg(i*(colomns)+j+1).arg(rows*colomns)); painter.drawText(labels, Qt::AlignHCenter, tr("Page %1 of %2").arg(i*(colomns)+j+1).arg(rows*colomns));
if (sheets > 1) if (sheets > 1)

View File

@ -216,7 +216,7 @@ void VObjEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawM
for (int i = 0; i < pointCount; ++i) for (int i = 0; i < pointCount; ++i)
{ {
*stream << QString(" %1").arg(globalPointsCount - static_cast<unsigned int>(pointCount) + i + 1); *stream << QString(" %1").arg(static_cast<int>(globalPointsCount) - pointCount + i + 1);
} }
*stream << endl; *stream << endl;
} }

View File

@ -46,7 +46,6 @@ using namespace qmu;
* const qreal result = cal->EvalFormula(data->PlainVariables(), formula); * const qreal result = cal->EvalFormula(data->PlainVariables(), formula);
* delete cal; * delete cal;
* *
* @param data pointer to a variable container.
*/ */
Calculator::Calculator() Calculator::Calculator()
:QmuFormulaBase() :QmuFormulaBase()

View File

@ -43,7 +43,6 @@ VIncrement::VIncrement()
/** /**
* @brief VIncrementTableRow create increment * @brief VIncrementTableRow create increment
* @param name increment's name * @param name increment's name
* @param id id
* @param base value * @param base value
* @param description description of increment * @param description description of increment
*/ */

View File

@ -277,7 +277,7 @@ bool VMeasurement::IsCustom() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VMeasurement::Index() const int VMeasurement::Index() const
{ {
return d->index; return static_cast<int>(d->index);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -37,8 +37,17 @@
#include <QtAlgorithms> #include <QtAlgorithms>
#include <QDebug> #include <QDebug>
#ifdef Q_CC_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#endif
Q_LOGGING_CATEGORY(vCon, "v.container") Q_LOGGING_CATEGORY(vCon, "v.container")
#ifdef Q_CC_CLANG
#pragma clang diagnostic pop
#endif
quint32 VContainer::_id = NULL_ID; quint32 VContainer::_id = NULL_ID;
qreal VContainer::_size = 50; qreal VContainer::_size = 50;
qreal VContainer::_height = 176; qreal VContainer::_height = 176;

View File

@ -446,7 +446,6 @@ void DialogTool::setCurrentArcId(QComboBox *box, const quint32 &value, FillCombo
* @brief setCurrentSplinePathId set current splinePath id in combobox * @brief setCurrentSplinePathId set current splinePath id in combobox
* @param box combobox * @param box combobox
* @param value splinePath id * @param value splinePath id
* @param cut if set to ComboMode::CutSpline don't show id+1 and id+2
*/ */
void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, FillComboBox rule, void DialogTool::setCurrentSplinePathId(QComboBox *box, const quint32 &value, FillComboBox rule,
const quint32 &ch1, const quint32 &ch2) const const quint32 &ch1, const quint32 &ch2) const

View File

@ -34,8 +34,17 @@
#include <QKeyEvent> #include <QKeyEvent>
#ifdef Q_CC_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#endif
Q_LOGGING_CATEGORY(vToolSinglePoint, "v.toolSinglePoint") Q_LOGGING_CATEGORY(vToolSinglePoint, "v.toolSinglePoint")
#ifdef Q_CC_CLANG
#pragma clang diagnostic pop
#endif
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief VToolSinglePoint constructor. * @brief VToolSinglePoint constructor.
@ -109,8 +118,6 @@ void VToolSinglePoint::NameChangePosition(const QPointF &pos)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief UpdateNamePosition save new position label to the pattern file. * @brief UpdateNamePosition save new position label to the pattern file.
* @param mx label bias x axis.
* @param my label bias y axis.
*/ */
void VToolSinglePoint::UpdateNamePosition(quint32 id) void VToolSinglePoint::UpdateNamePosition(quint32 id)
{ {

View File

@ -80,6 +80,11 @@ CONFIG(debug, debug|release){
# Key -isystem disable checking errors in system headers. # Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wundefined-reinterpret-cast
} }
} else { } else {
*-g++{ *-g++{

View File

@ -70,6 +70,11 @@ CONFIG(debug, debug|release){
# Key -isystem disable checking errors in system headers. # Key -isystem disable checking errors in system headers.
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. $$CLANG_DEBUG_CXXFLAGS # See common.pri for more details.
# -isystem key works only for headers. In some cases it's not enough. But we can't delete these warnings and
# want them in global list. Compromise decision delete them from local list.
QMAKE_CXXFLAGS -= \
-Wundefined-reinterpret-cast
} }
} else { } else {
*-g++{ *-g++{

View File

@ -100,7 +100,8 @@ CONFIG(debug, debug|release){
-isystem "$${OUT_PWD}/$${UI_DIR}" \ -isystem "$${OUT_PWD}/$${UI_DIR}" \
-isystem "$${OUT_PWD}/$${MOC_DIR}" \ -isystem "$${OUT_PWD}/$${MOC_DIR}" \
-isystem "$${OUT_PWD}/$${RCC_DIR}" \ -isystem "$${OUT_PWD}/$${RCC_DIR}" \
$$CLANG_DEBUG_CXXFLAGS # See common.pri for more details. $$CLANG_DEBUG_CXXFLAGS \ # See common.pri for more details.
-Wno-gnu-zero-variadic-macro-arguments\ # See macros QSKIP
} }
} else { } else {
*-g++{ *-g++{