Replace Q_ASSERT by SCASSERT.

--HG--
branch : feature
This commit is contained in:
dismine 2014-06-19 12:31:56 +03:00
parent 1884e302b4
commit 9fdedf85fc
5 changed files with 26 additions and 26 deletions

View file

@ -188,7 +188,7 @@ val VContainer::GetVariable(const QHash<key, val> &obj, key id) const
*/ */
const VMeasurement VContainer::GetMeasurement(const QString &name) const const VMeasurement VContainer::GetMeasurement(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); SCASSERT(name.isEmpty()==false);
return GetVariable(measurements, name); return GetVariable(measurements, name);
} }
@ -200,7 +200,7 @@ const VMeasurement VContainer::GetMeasurement(const QString &name) const
*/ */
const VIncrement VContainer::GetIncrement(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); return GetVariable(increments, name);
} }
@ -212,7 +212,7 @@ const VIncrement VContainer::GetIncrement(const QString& name) const
*/ */
qreal VContainer::GetLine(const QString &name) const qreal VContainer::GetLine(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); SCASSERT(name.isEmpty()==false);
return GetVariable(lengthLines, name); return GetVariable(lengthLines, name);
} }
@ -224,7 +224,7 @@ qreal VContainer::GetLine(const QString &name) const
*/ */
qreal VContainer::GetLengthArc(const QString &name) const qreal VContainer::GetLengthArc(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); SCASSERT(name.isEmpty()==false);
return GetVariable(lengthArcs, name); return GetVariable(lengthArcs, name);
} }
@ -236,7 +236,7 @@ qreal VContainer::GetLengthArc(const QString &name) const
*/ */
qreal VContainer::GetLengthSpline(const QString &name) const qreal VContainer::GetLengthSpline(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); SCASSERT(name.isEmpty()==false);
return GetVariable(lengthSplines, name); return GetVariable(lengthSplines, name);
} }
@ -248,7 +248,7 @@ qreal VContainer::GetLengthSpline(const QString &name) const
*/ */
qreal VContainer::GetLineAngle(const QString &name) const qreal VContainer::GetLineAngle(const QString &name) const
{ {
Q_ASSERT(name.isEmpty()==false); SCASSERT(name.isEmpty()==false);
return GetVariable(lineAngles, name); return GetVariable(lineAngles, name);
} }
@ -352,7 +352,7 @@ void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val p
*/ */
void VContainer::AddLengthSpline(const QString &name, const qreal &value) void VContainer::AddLengthSpline(const QString &name, const qreal &value)
{ {
Q_ASSERT(name.isEmpty() == false); SCASSERT(name.isEmpty() == false);
lengthSplines[name] = value; lengthSplines[name] = value;
} }
@ -375,7 +375,7 @@ void VContainer::AddLengthArc(const quint32 &id)
*/ */
void VContainer::AddLineAngle(const QString &name, const qreal &value) void VContainer::AddLineAngle(const QString &name, const qreal &value)
{ {
Q_ASSERT(name.isEmpty() == false); SCASSERT(name.isEmpty() == false);
lineAngles[name] = value; lineAngles[name] = value;
} }
@ -560,6 +560,6 @@ void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
*/ */
void VContainer::AddLengthLine(const QString &name, const qreal &value) void VContainer::AddLengthLine(const QString &name, const qreal &value)
{ {
Q_ASSERT(name.isEmpty() == false); SCASSERT(name.isEmpty() == false);
lengthLines[name] = value; lengthLines[name] = value;
} }

View file

@ -127,7 +127,7 @@ bool DialogPatternXmlEdit::ApplyNodeChange(QDomNode domElement, QString name, QS
bool DialogPatternXmlEdit::ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value) bool DialogPatternXmlEdit::ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value)
{ {
QDomElement newnode = domElement.ownerDocument().createElement(name); QDomElement newnode = domElement.ownerDocument().createElement(name);
//Q_ASSERT(newnode != nullptr); //SCASSERT(newnode != nullptr);
newnode.setNodeValue(value); newnode.setNodeValue(value);
domElement.appendChild(newnode); domElement.appendChild(newnode);
treeElement->SetDocNode(newnode); treeElement->SetDocNode(newnode);
@ -282,7 +282,7 @@ bool DialogPatternXmlEdit::DeleteNodeAndSons(VXMLTreeElement * currentNode, bool
} }
if (index < 0) if (index < 0)
{ {
Q_ASSERT(index==0); SCASSERT(index==0);
return false; return false;
} }
parent->removeRow(index); parent->removeRow(index);
@ -318,7 +318,7 @@ DialogPatternXmlEdit::ChangesStackElement* DialogPatternXmlEdit::CreateStackElem
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* current) bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* current)
{ {
Q_ASSERT(current != nullptr); SCASSERT(current != nullptr);
VXMLTreeElement * currentNode = current->element; VXMLTreeElement * currentNode = current->element;
@ -371,7 +371,7 @@ bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement*
} }
if (index < 0) if (index < 0)
{ {
Q_ASSERT(index==0); SCASSERT(index==0);
return false; return false;
} }
parent->removeRow(index); parent->removeRow(index);
@ -621,7 +621,7 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
} }
if (index->next == nullptr) if (index->next == nullptr)
{ {
Q_ASSERT(index->next != nullptr); SCASSERT(index->next != nullptr);
return; return;
} }
if (index->next->newText != nullptr) if (index->next->newText != nullptr)
@ -834,7 +834,7 @@ void DialogPatternXmlEdit::ButtonSetClicked()
{ // If node was created or edited previously, rewrite { // If node was created or edited previously, rewrite
if (this->currentNodeEditedStatus == DialogPatternXmlEdit::ChangeTypeDelete) if (this->currentNodeEditedStatus == DialogPatternXmlEdit::ChangeTypeDelete)
{ // You shouldn't be able to edit a deleted node... { // You shouldn't be able to edit a deleted node...
Q_ASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete); SCASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete);
ClearEditData(); ClearEditData();
return; return;
} }
@ -958,7 +958,7 @@ void DialogPatternXmlEdit::BaseSelectionChanged(int value)
ui->pushButton_Apply_Changes->setEnabled(false); ui->pushButton_Apply_Changes->setEnabled(false);
index = ui->comboBox_Base_Selection->itemData(value).toInt(); //.convert(QVariant::Int); 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)); // QMessageBox::information(this, "test", QString("%1:%2").arg(value).arg(index));
// Clear all tree info and nodes // Clear all tree info and nodes
@ -1169,7 +1169,7 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt)
current = new TreeElementchain; current = new TreeElementchain;
if (current == nullptr) if (current == nullptr)
{ {
Q_ASSERT(current != nullptr); SCASSERT(current != nullptr);
// TODO : throw exception // TODO : throw exception
} }
current->elmt=elmt; current->elmt=elmt;
@ -1180,7 +1180,7 @@ void VXMLTreeView::appendchain(VXMLTreeElement* elmt)
TreeElementchain* temp= new TreeElementchain; TreeElementchain* temp= new TreeElementchain;
if (temp == nullptr) if (temp == nullptr)
{ {
Q_ASSERT(temp != nullptr); SCASSERT(temp != nullptr);
// TODO : throw exception // TODO : throw exception
} }
temp->elmt=elmt; temp->elmt=elmt;

View file

@ -569,7 +569,7 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr);
qint32 index = box->currentIndex(); qint32 index = box->currentIndex();
Q_ASSERT(index != -1); SCASSERT(index != -1);
if (index != -1) if (index != -1)
{ {
return qvariant_cast<quint32>(box->itemData(index)); return qvariant_cast<quint32>(box->itemData(index));

View file

@ -374,7 +374,7 @@ QVector<QPointF> VEquidistant::CheckLoops(const QVector<QPointF> &points)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points) QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points)
{ {
Q_ASSERT(points.size() > 0); SCASSERT(points.size() > 0);
QVector<QPointF> reversePoints; QVector<QPointF> reversePoints;
for (qint32 i = points.size() - 1; i >= 0; --i) for (qint32 i = points.size() - 1; i >= 0; --i)
{ {
@ -386,7 +386,7 @@ QVector<QPointF> VEquidistant::GetReversePoint(const QVector<QPointF> &points)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width)
{ {
Q_ASSERT(width > 0); SCASSERT(width > 0);
QVector<QPointF> points; QVector<QPointF> points;
if (line1.p2() != line2.p2()) if (line1.p2() != line2.p2())
{ {
@ -436,7 +436,7 @@ QVector<QPointF> VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) 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()), QLineF paralel = QLineF (SingleParallelPoint(line, 90, width), SingleParallelPoint(QLineF(line.p2(), line.p1()),
-90, width)); -90, width));
return paralel; 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) QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width)
{ {
Q_ASSERT(width > 0); SCASSERT(width > 0);
QLineF pLine = line; QLineF pLine = line;
pLine.setAngle( pLine.angle() + angle ); pLine.setAngle( pLine.angle() + angle );
pLine.setLength( width ); pLine.setLength( width );

View file

@ -34,9 +34,9 @@ AddPatternPiece::AddPatternPiece(const QDomElement &xml, VPattern *doc, const QS
QUndoCommand *parent) QUndoCommand *parent)
: QObject(), QUndoCommand(parent), xml(xml), doc(doc), namePP(namePP), redoFlag(false), mPath(mPath) : QObject(), QUndoCommand(parent), xml(xml), doc(doc), namePP(namePP), redoFlag(false), mPath(mPath)
{ {
Q_ASSERT(xml.isNull() == false); SCASSERT(xml.isNull() == false);
Q_ASSERT(namePP.isEmpty() == false); SCASSERT(namePP.isEmpty() == false);
Q_ASSERT(mPath.isEmpty() == false); SCASSERT(mPath.isEmpty() == false);
setText(tr("Add pattern piece %1").arg(namePP)); setText(tr("Add pattern piece %1").arg(namePP));
} }