aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/node.pri6
-rw-r--r--node/parenthesesnode.cpp29
-rw-r--r--node/parenthesesnode.h17
3 files changed, 50 insertions, 2 deletions
diff --git a/node/node.pri b/node/node.pri
index 090483e..4a7d55d 100644
--- a/node/node.pri
+++ b/node/node.pri
@@ -8,7 +8,8 @@ HEADERS += \
node/sortresult.h \
node/keepdiceexecnode.h \
node/countexecutenode.h \
- node/explosedicenode.h
+ node/explosedicenode.h \
+ node/parenthesesnode.h
SOURCES += \
node/dicerollernode.cpp \
@@ -20,4 +21,5 @@ SOURCES += \
node/sortresult.cpp \
node/keepdiceexecnode.cpp \
node/countexecutenode.cpp \
- node/explosedicenode.cpp
+ node/explosedicenode.cpp \
+ node/parenthesesnode.cpp
diff --git a/node/parenthesesnode.cpp b/node/parenthesesnode.cpp
new file mode 100644
index 0000000..7bd5a6a
--- /dev/null
+++ b/node/parenthesesnode.cpp
@@ -0,0 +1,29 @@
+#include "parenthesesnode.h"
+
+ParenthesesNode::ParenthesesNode()
+{
+
+}
+void ParenthesesNode::setInternelNode(ExecutionNode* node)
+{
+ m_internalNode = node;
+}
+void ParenthesesNode::run(ExecutionNode* /*previous*/)
+{
+ if(NULL!=m_internalNode)
+ {
+ m_internalNode->run(this);
+ ExecutionNode* temp=m_internalNode;
+ while(NULL!=temp->getNextNode())
+ {
+ temp=temp->getNextNode();
+ }
+ m_result = m_internalNode->getResult();
+ }
+
+
+ if(NULL!=m_nextNode)
+ {
+ m_nextNode->run(this);
+ }
+}
diff --git a/node/parenthesesnode.h b/node/parenthesesnode.h
new file mode 100644
index 0000000..3347ba4
--- /dev/null
+++ b/node/parenthesesnode.h
@@ -0,0 +1,17 @@
+#ifndef PARENTHESESNODE_H
+#define PARENTHESESNODE_H
+
+#include "executionnode.h"
+
+class ParenthesesNode : public ExecutionNode
+{
+public:
+ ParenthesesNode();
+ virtual void run(ExecutionNode* previous = NULL)=0;
+
+ void setInternelNode(ExecutionNode* node);
+private:
+ ExecutionNode* m_internalNode;
+};
+
+#endif // PARENTHESESNODE_H