From 9fdedf85fc40c0e853c0b85191e3deba0c76bf2b Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 19 Jun 2014 12:31:56 +0300 Subject: [PATCH] Replace Q_ASSERT by SCASSERT. --HG-- branch : feature --- src/app/container/vcontainer.cpp | 18 +++++++++--------- src/app/dialogs/app/dialogpatternxmledit.cpp | 18 +++++++++--------- src/app/dialogs/tools/dialogtool.cpp | 2 +- src/app/geometry/vequidistant.cpp | 8 ++++---- src/app/undocommands/addpatternpiece.cpp | 6 +++--- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/app/container/vcontainer.cpp b/src/app/container/vcontainer.cpp index 4f8b81778..fbc2d10f7 100644 --- a/src/app/container/vcontainer.cpp +++ b/src/app/container/vcontainer.cpp @@ -188,7 +188,7 @@ val VContainer::GetVariable(const QHash &obj, key id) const */ const VMeasurement VContainer::GetMeasurement(const QString &name) const { - Q_ASSERT(name.isEmpty()==false); + SCASSERT(name.isEmpty()==false); return GetVariable(measurements, name); } @@ -200,7 +200,7 @@ const VMeasurement VContainer::GetMeasurement(const QString &name) const */ const VIncrement VContainer::GetIncrement(const QString& name) const { - Q_ASSERT(name.isEmpty()==false); + SCASSERT(name.isEmpty()==false); return GetVariable(increments, name); } @@ -212,7 +212,7 @@ const VIncrement VContainer::GetIncrement(const QString& name) const */ qreal VContainer::GetLine(const QString &name) const { - Q_ASSERT(name.isEmpty()==false); + SCASSERT(name.isEmpty()==false); return GetVariable(lengthLines, name); } @@ -224,7 +224,7 @@ qreal VContainer::GetLine(const QString &name) const */ qreal VContainer::GetLengthArc(const QString &name) const { - Q_ASSERT(name.isEmpty()==false); + SCASSERT(name.isEmpty()==false); return GetVariable(lengthArcs, name); } @@ -236,7 +236,7 @@ qreal VContainer::GetLengthArc(const QString &name) const */ qreal VContainer::GetLengthSpline(const QString &name) const { - Q_ASSERT(name.isEmpty()==false); + SCASSERT(name.isEmpty()==false); return GetVariable(lengthSplines, name); } @@ -248,7 +248,7 @@ qreal VContainer::GetLengthSpline(const QString &name) const */ qreal VContainer::GetLineAngle(const QString &name) const { - Q_ASSERT(name.isEmpty()==false); + SCASSERT(name.isEmpty()==false); return GetVariable(lineAngles, name); } @@ -352,7 +352,7 @@ void VContainer::UpdateObject(QHash &obj, const quint32 &id, val p */ void VContainer::AddLengthSpline(const QString &name, const qreal &value) { - Q_ASSERT(name.isEmpty() == false); + SCASSERT(name.isEmpty() == false); lengthSplines[name] = value; } @@ -375,7 +375,7 @@ void VContainer::AddLengthArc(const quint32 &id) */ void VContainer::AddLineAngle(const QString &name, const qreal &value) { - Q_ASSERT(name.isEmpty() == false); + SCASSERT(name.isEmpty() == false); lineAngles[name] = value; } @@ -560,6 +560,6 @@ void VContainer::UpdateDetail(quint32 id, const VDetail &detail) */ void VContainer::AddLengthLine(const QString &name, const qreal &value) { - Q_ASSERT(name.isEmpty() == false); + SCASSERT(name.isEmpty() == false); lengthLines[name] = value; } diff --git a/src/app/dialogs/app/dialogpatternxmledit.cpp b/src/app/dialogs/app/dialogpatternxmledit.cpp index 521ed0792..04f619278 100644 --- a/src/app/dialogs/app/dialogpatternxmledit.cpp +++ b/src/app/dialogs/app/dialogpatternxmledit.cpp @@ -127,7 +127,7 @@ bool DialogPatternXmlEdit::ApplyNodeChange(QDomNode domElement, QString name, QS bool DialogPatternXmlEdit::ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value) { QDomElement newnode = domElement.ownerDocument().createElement(name); - //Q_ASSERT(newnode != nullptr); + //SCASSERT(newnode != nullptr); newnode.setNodeValue(value); domElement.appendChild(newnode); treeElement->SetDocNode(newnode); @@ -282,7 +282,7 @@ bool DialogPatternXmlEdit::DeleteNodeAndSons(VXMLTreeElement * currentNode, bool } if (index < 0) { - Q_ASSERT(index==0); + SCASSERT(index==0); return false; } parent->removeRow(index); @@ -318,7 +318,7 @@ DialogPatternXmlEdit::ChangesStackElement* DialogPatternXmlEdit::CreateStackElem //--------------------------------------------------------------------------------------------------------------------- bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* current) { - Q_ASSERT(current != nullptr); + SCASSERT(current != nullptr); VXMLTreeElement * currentNode = current->element; @@ -371,7 +371,7 @@ bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* } if (index < 0) { - Q_ASSERT(index==0); + SCASSERT(index==0); return false; } parent->removeRow(index); @@ -621,7 +621,7 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt) } if (index->next == nullptr) { - Q_ASSERT(index->next != nullptr); + SCASSERT(index->next != nullptr); return; } if (index->next->newText != nullptr) @@ -834,7 +834,7 @@ void DialogPatternXmlEdit::ButtonSetClicked() { // If node was created or edited previously, rewrite if (this->currentNodeEditedStatus == DialogPatternXmlEdit::ChangeTypeDelete) { // You shouldn't be able to edit a deleted node... - Q_ASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete); + SCASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete); ClearEditData(); return; } @@ -958,7 +958,7 @@ void DialogPatternXmlEdit::BaseSelectionChanged(int value) ui->pushButton_Apply_Changes->setEnabled(false); index = ui->comboBox_Base_Selection->itemData(value).toInt(); //.convert(QVariant::Int); - Q_ASSERT(value < rootBasesNum); + SCASSERT(value < rootBasesNum); // QMessageBox::information(this, "test", QString("%1:%2").arg(value).arg(index)); // Clear all tree info and nodes @@ -1169,7 +1169,7 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt) current = new TreeElementchain; if (current == nullptr) { - Q_ASSERT(current != nullptr); + SCASSERT(current != nullptr); // TODO : throw exception } current->elmt=elmt; @@ -1180,7 +1180,7 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt) TreeElementchain* temp= new TreeElementchain; if (temp == nullptr) { - Q_ASSERT(temp != nullptr); + SCASSERT(temp != nullptr); // TODO : throw exception } temp->elmt=elmt; diff --git a/src/app/dialogs/tools/dialogtool.cpp b/src/app/dialogs/tools/dialogtool.cpp index 5efafebf4..e6698ea66 100644 --- a/src/app/dialogs/tools/dialogtool.cpp +++ b/src/app/dialogs/tools/dialogtool.cpp @@ -569,7 +569,7 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const { SCASSERT(box != nullptr); qint32 index = box->currentIndex(); - Q_ASSERT(index != -1); + SCASSERT(index != -1); if (index != -1) { return qvariant_cast(box->itemData(index)); diff --git a/src/app/geometry/vequidistant.cpp b/src/app/geometry/vequidistant.cpp index b50faff69..9ee6c10f0 100644 --- a/src/app/geometry/vequidistant.cpp +++ b/src/app/geometry/vequidistant.cpp @@ -374,7 +374,7 @@ QVector VEquidistant::CheckLoops(const QVector &points) //--------------------------------------------------------------------------------------------------------------------- QVector VEquidistant::GetReversePoint(const QVector &points) { - Q_ASSERT(points.size() > 0); + SCASSERT(points.size() > 0); QVector reversePoints; for (qint32 i = points.size() - 1; i >= 0; --i) { @@ -386,7 +386,7 @@ QVector VEquidistant::GetReversePoint(const QVector &points) //--------------------------------------------------------------------------------------------------------------------- QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) { - Q_ASSERT(width > 0); + SCASSERT(width > 0); QVector points; if (line1.p2() != line2.p2()) { @@ -436,7 +436,7 @@ QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2 //--------------------------------------------------------------------------------------------------------------------- QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) { - Q_ASSERT(width > 0); + SCASSERT(width > 0); QLineF paralel = QLineF (SingleParallelPoint(line, 90, width), SingleParallelPoint(QLineF(line.p2(), line.p1()), -90, width)); return paralel; @@ -445,7 +445,7 @@ QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) //--------------------------------------------------------------------------------------------------------------------- QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width) { - Q_ASSERT(width > 0); + SCASSERT(width > 0); QLineF pLine = line; pLine.setAngle( pLine.angle() + angle ); pLine.setLength( width ); diff --git a/src/app/undocommands/addpatternpiece.cpp b/src/app/undocommands/addpatternpiece.cpp index 915e72b11..f77d91ec7 100644 --- a/src/app/undocommands/addpatternpiece.cpp +++ b/src/app/undocommands/addpatternpiece.cpp @@ -34,9 +34,9 @@ AddPatternPiece::AddPatternPiece(const QDomElement &xml, VPattern *doc, const QS QUndoCommand *parent) : QObject(), QUndoCommand(parent), xml(xml), doc(doc), namePP(namePP), redoFlag(false), mPath(mPath) { - Q_ASSERT(xml.isNull() == false); - Q_ASSERT(namePP.isEmpty() == false); - Q_ASSERT(mPath.isEmpty() == false); + SCASSERT(xml.isNull() == false); + SCASSERT(namePP.isEmpty() == false); + SCASSERT(mPath.isEmpty() == false); setText(tr("Add pattern piece %1").arg(namePP)); }