File indexing completed on 2024-05-12 05:39:29
0001 #include "stringnode.h" 0002 0003 StringNode::StringNode() : m_stringResult(new StringResult()) 0004 { 0005 m_result= m_stringResult; 0006 } 0007 0008 void StringNode::run(ExecutionNode* previous) 0009 { 0010 m_previousNode= previous; 0011 if(nullptr != previous) 0012 { 0013 m_result->setPrevious(previous->getResult()); 0014 } 0015 if(nullptr != m_nextNode) 0016 { 0017 m_nextNode->run(this); 0018 } 0019 } 0020 0021 void StringNode::setString(QString str) 0022 { 0023 m_data= str; 0024 m_stringResult->addText(m_data); 0025 m_stringResult->finished(); 0026 } 0027 QString StringNode::toString(bool withLabel) const 0028 { 0029 if(withLabel) 0030 { 0031 QString dataCopy= m_data; 0032 0033 return QString("%1 [label=\"StringNode %2\"]").arg(m_id, dataCopy.replace('%', '\\')); 0034 } 0035 else 0036 { 0037 return m_id; 0038 } 0039 } 0040 qint64 StringNode::getPriority() const 0041 { 0042 qint64 priority= 0; 0043 if(nullptr != m_nextNode) 0044 { 0045 priority= m_nextNode->getPriority(); 0046 } 0047 return priority; 0048 } 0049 ExecutionNode* StringNode::getCopy() const 0050 { 0051 StringNode* node= new StringNode(); 0052 node->setString(m_data); 0053 if(nullptr != m_nextNode) 0054 { 0055 node->setNextNode(m_nextNode->getCopy()); 0056 } 0057 return node; 0058 }