From ac6d69f33e686275a2a8df89431030197d43378e Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 28 Jul 2019 01:04:05 +0200 Subject: Add cleanAll function --- diceparser.cpp | 15 ++++++++++----- include/diceparser.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/diceparser.cpp b/diceparser.cpp index da838f1..7623718 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -165,11 +165,7 @@ bool DiceParser::parseLine(QString str, bool allowAlias) { m_errorMap.clear(); m_comment= QString(""); - if(!m_startNodes.empty()) - { - qDeleteAll(m_startNodes); - m_startNodes.clear(); - } + cleanAll(); m_currentTreeHasSeparator= false; if(allowAlias) { @@ -374,6 +370,15 @@ bool DiceParser::readNode(QString& str, ExecutionNode*& node) return false; } +void DiceParser::cleanAll() +{ + if(!m_startNodes.empty()) + { + qDeleteAll(m_startNodes); + m_startNodes.clear(); + } +} + void DiceParser::start() { for(auto start : m_startNodes) diff --git a/include/diceparser.h b/include/diceparser.h index 230d571..32694a3 100644 --- a/include/diceparser.h +++ b/include/diceparser.h @@ -230,7 +230,7 @@ public: QString humanReadableWarning(); bool readValuesList(QString& str, ExecutionNode*& node); - + void cleanAll(); private: /** * @brief readIfInstruction reads the current command to build if node with proper parameters. -- cgit v1.2.3-70-g09d2