From f2051fb35b1ad49c4d940e6fbba2acc98b216e13 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Tue, 12 Feb 2019 23:59:24 +0100 Subject: clang format --- node/paintnode.cpp | 92 ++++++++++++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 51 deletions(-) (limited to 'node/paintnode.cpp') diff --git a/node/paintnode.cpp b/node/paintnode.cpp index 8fea3f4..02c7230 100644 --- a/node/paintnode.cpp +++ b/node/paintnode.cpp @@ -1,29 +1,25 @@ /*************************************************************************** - * Copyright (C) 2015 by Renaud Guezennec * - * http:://www.rolisteam.org/contact * - * * - * rolisteam 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. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ + * Copyright (C) 2015 by Renaud Guezennec * + * http:://www.rolisteam.org/contact * + * * + * rolisteam 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. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ #include "paintnode.h" -ColorItem::ColorItem(QString str, int val) - : m_colorNumber(val),m_color(str) -{ - -} +ColorItem::ColorItem(QString str, int val) : m_colorNumber(val), m_color(str) {} int ColorItem::colorNumber() const { @@ -32,7 +28,7 @@ int ColorItem::colorNumber() const void ColorItem::setColorNumber(int colorNumber) { - m_colorNumber = colorNumber; + m_colorNumber= colorNumber; } QString ColorItem::color() const @@ -40,50 +36,46 @@ QString ColorItem::color() const return m_color; } -void ColorItem::setColor(const QString &color) +void ColorItem::setColor(const QString& color) { - m_color = color; + m_color= color; } - /////////////////////////////////// /// @brief PainterNode::PainterNode /////////////////////////////////// -PainterNode::PainterNode() - : ExecutionNode() +PainterNode::PainterNode() : ExecutionNode() { - m_result = nullptr; - m_nextNode = nullptr; + m_result= nullptr; + m_nextNode= nullptr; } - PainterNode::~PainterNode() { - m_result = nullptr; + m_result= nullptr; } - void PainterNode::run(ExecutionNode* previous) { - m_previousNode = previous; - if(nullptr==previous) + m_previousNode= previous; + if(nullptr == previous) { m_errors.insert(ExecutionNode::NO_PREVIOUS_ERROR, QObject::tr("No previous node before Paint operator")); return; } - Result* previousResult = previous->getResult(); - //m_result = previousResult; - DiceResult* previousDiceResult = dynamic_cast(previousResult); - if(nullptr!=previousDiceResult) + Result* previousResult= previous->getResult(); + // m_result = previousResult; + DiceResult* previousDiceResult= dynamic_cast(previousResult); + if(nullptr != previousDiceResult) { - QList diceList=previousDiceResult->getResultList(); - int pastDice=0; + QList diceList= previousDiceResult->getResultList(); + int pastDice= 0; for(ColorItem& item : m_colors) { - int current=item.colorNumber(); + int current= item.colorNumber(); QList::iterator it; - for(it = diceList.begin()+pastDice; it != diceList.end() && current>0 ; ++it) + for(it= diceList.begin() + pastDice; it != diceList.end() && current > 0; ++it) { (*it)->setColor(item.color()); --current; @@ -91,14 +83,14 @@ void PainterNode::run(ExecutionNode* previous) } } } - if(nullptr!=m_nextNode) + if(nullptr != m_nextNode) { m_nextNode->run(previous); } } Result* PainterNode::getResult() { - return (nullptr != m_previousNode) ? m_previousNode->getResult() : nullptr ; + return (nullptr != m_previousNode) ? m_previousNode->getResult() : nullptr; } QString PainterNode::toString(bool wl) const @@ -113,22 +105,20 @@ QString PainterNode::toString(bool wl) const } } - qint64 PainterNode::getPriority() const { return 4; } - void PainterNode::insertColorItem(QString color, int value) { - ColorItem item(color,value); + ColorItem item(color, value); m_colors.append(item); } ExecutionNode* PainterNode::getCopy() const { - PainterNode* node = new PainterNode(); - if(nullptr!=m_nextNode) + PainterNode* node= new PainterNode(); + if(nullptr != m_nextNode) { node->setNextNode(m_nextNode->getCopy()); } -- cgit v1.2.3-70-g09d2