aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/libparser/node/stringnode.cpp
blob: 6f41956d7a928a07e384657ecf3b33d7bc13986d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "stringnode.h"

StringNode::StringNode() : m_stringResult(new StringResult())
{
    m_result= m_stringResult;
}

void StringNode::run(ExecutionNode* previous)
{
    m_previousNode= previous;
    if(previous)
        m_result->setPrevious(previous->getResult());
}

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;
}