diff options
| author | 2019-07-28 01:04:05 +0200 | |
|---|---|---|
| committer | 2019-07-28 01:04:05 +0200 | |
| commit | ac6d69f33e686275a2a8df89431030197d43378e (patch) | |
| tree | 17f4c5e2fd935c5f759cea1836677e9029c16f39 | |
| parent | bab31ef2e6d946d5269dad25bcdca793bbd1f3e7 (diff) | |
| download | OneRoll-ac6d69f33e686275a2a8df89431030197d43378e.tar.gz OneRoll-ac6d69f33e686275a2a8df89431030197d43378e.zip | |
Add cleanAll function
| -rw-r--r-- | diceparser.cpp | 15 | ||||
| -rw-r--r-- | 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. |