aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libparser/node/stringnode.cpp
diff options
context:
space:
mode:
authorRenaud G <renaud@rolisteam.org>2022-04-29 10:48:09 +0200
committerRenaud G <renaud@rolisteam.org>2022-04-29 10:48:09 +0200
commit07c5f6ec23fcf9237a24e71adcfacabce677f818 (patch)
tree588e8c5f82b9163181fad3581f610e6f1d88cba4 /src/libparser/node/stringnode.cpp
parenta9153f1615a842cfb9e9bcda4d9071e202618569 (diff)
downloadOneRoll-07c5f6ec23fcf9237a24e71adcfacabce677f818.tar.gz
OneRoll-07c5f6ec23fcf9237a24e71adcfacabce677f818.zip
Change file organization.
Diffstat (limited to 'src/libparser/node/stringnode.cpp')
-rw-r--r--src/libparser/node/stringnode.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/libparser/node/stringnode.cpp b/src/libparser/node/stringnode.cpp
new file mode 100644
index 0000000..e908463
--- /dev/null
+++ b/src/libparser/node/stringnode.cpp
@@ -0,0 +1,58 @@
+#include "stringnode.h"
+
+StringNode::StringNode() : m_stringResult(new StringResult())
+{
+ m_result= m_stringResult;
+}
+
+void StringNode::run(ExecutionNode* previous)
+{
+ m_previousNode= previous;
+ if(nullptr != previous)
+ {
+ m_result->setPrevious(previous->getResult());
+ }
+ if(nullptr != m_nextNode)
+ {
+ m_nextNode->run(this);
+ }
+}
+
+void StringNode::setString(QString str)
+{
+ m_data= str;
+ m_stringResult->addText(m_data);
+ m_stringResult->finished();
+}
+QString StringNode::toString(bool withLabel) const
+{
+ if(withLabel)
+ {
+ QString dataCopy= m_data;
+
+ return QString("%1 [label=\"StringNode %2\"]").arg(m_id, dataCopy.replace('%', '\\'));
+ }
+ else
+ {
+ return m_id;
+ }
+}
+qint64 StringNode::getPriority() const
+{
+ qint64 priority= 0;
+ if(nullptr != m_nextNode)
+ {
+ priority= m_nextNode->getPriority();
+ }
+ return priority;
+}
+ExecutionNode* StringNode::getCopy() const
+{
+ StringNode* node= new StringNode();
+ node->setString(m_data);
+ if(nullptr != m_nextNode)
+ {
+ node->setNextNode(m_nextNode->getCopy());
+ }
+ return node;
+}