diff options
Diffstat (limited to 'node')
| -rw-r--r-- | node/executionnode.cpp | 4 | ||||
| -rw-r--r-- | node/executionnode.h | 3 | ||||
| -rw-r--r-- | node/sortresult.cpp | 13 |
3 files changed, 13 insertions, 7 deletions
diff --git a/node/executionnode.cpp b/node/executionnode.cpp index 0f42afa..6d6fe8b 100644 --- a/node/executionnode.cpp +++ b/node/executionnode.cpp @@ -22,3 +22,7 @@ ExecutionNode* ExecutionNode::getNextNode() { return m_nextNode; } +QList<ExecutionNode::ERROR_CODE> ExecutionNode::getErrorList() +{ + return m_errors; +} diff --git a/node/executionnode.h b/node/executionnode.h index 59308ff..b83a6f1 100644 --- a/node/executionnode.h +++ b/node/executionnode.h @@ -6,6 +6,7 @@ class ExecutionNode { public: + enum ERROR_CODE {NO_ERROR,DIE_RESULT_EXPECTED,BAD_SYNTAXE}; ExecutionNode(); virtual ~ExecutionNode(); virtual void run(ExecutionNode* previous = NULL)=0; @@ -14,9 +15,11 @@ public: ExecutionNode* getNextNode(); virtual QString toString()const=0; virtual qint64 getPriority() const=0; + virtual QList<ExecutionNode::ERROR_CODE> getErrorList(); protected: Result* m_result; ExecutionNode* m_nextNode; + QList<ExecutionNode::ERROR_CODE> m_errors; }; #endif // EXECUTIONNODE_H diff --git a/node/sortresult.cpp b/node/sortresult.cpp index 8a0e58d..c80ebec 100644 --- a/node/sortresult.cpp +++ b/node/sortresult.cpp @@ -17,7 +17,7 @@ void SortResultNode::run(ExecutionNode* node) { return; } - DiceResult* previousDiceResult = static_cast<DiceResult*>(node->getResult()); + DiceResult* previousDiceResult = dynamic_cast<DiceResult*>(node->getResult()); m_diceResult->setPrevious(previousDiceResult); if(NULL!=previousDiceResult) { @@ -61,12 +61,7 @@ void SortResultNode::run(ExecutionNode* node) } } - //qDebug() << tmp1->getValue() << j << found; - //if(found) - diceList2.insert(j,tmp1); - /*else - diceList2.append(tmp1);*/ - + diceList2.insert(j,tmp1); } if(!m_ascending) @@ -86,6 +81,10 @@ void SortResultNode::run(ExecutionNode* node) m_nextNode->run(this); } } + else + { + m_errors.append(DIE_RESULT_EXPECTED); + } } void SortResultNode::setSortAscending(bool asc) |