diff options
| author | 2015-03-31 23:53:25 +0200 | |
|---|---|---|
| committer | 2015-03-31 23:53:25 +0200 | |
| commit | 5bd5a8a07a900c013c120b4e228c766a84a05b09 (patch) | |
| tree | ba9b3fa5ce6e81ab8ecd2c66073fa1911e9b8568 /node/listaliasnode.cpp | |
| parent | 4c9a68db5423c5d798d178d4dafb5bf8e3228ed1 (diff) | |
| parent | a03f73495bc6ce71630129a92408a26f81ae301f (diff) | |
| download | OneRoll-5bd5a8a07a900c013c120b4e228c766a84a05b09.tar.gz OneRoll-5bd5a8a07a900c013c120b4e228c766a84a05b09.zip | |
Merge branch 'master' of github.com:obiwankennedy/DiceParser
Conflicts:
node/node.pri
Diffstat (limited to 'node/listaliasnode.cpp')
| -rw-r--r-- | node/listaliasnode.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/node/listaliasnode.cpp b/node/listaliasnode.cpp new file mode 100644 index 0000000..1d50c80 --- /dev/null +++ b/node/listaliasnode.cpp @@ -0,0 +1,46 @@ +#include "listaliasnode.h" + +ListAliasNode::ListAliasNode(QMap<QString,QString>* apAlias) + : m_mapAlias(apAlias) +{ + m_result = new StringResult(); +} +void ListAliasNode::run(ExecutionNode* previous ) +{ + m_previousNode = previous; + StringResult* txtResult = dynamic_cast<StringResult*>(m_result); + + if(NULL != previous) + { + if(previous->getResult() == NULL) + { + txtResult->setText(toString()); + + } + else + { + txtResult->setText(previous->getHelp()); + } + m_result->setPrevious(previous->getResult()); + } + + if(NULL!=m_nextNode) + { + m_nextNode->run(this); + } +} +QString ListAliasNode::toString()const +{ + QString result(QObject::tr("List of Alias:\n")); + foreach(QString key, m_mapAlias->keys()) + { + result+=QString("%1 : %2\n").arg(key).arg(m_mapAlias->value(key)); + } + + return result; +} + +qint64 ListAliasNode::getPriority() const +{ + return 0; +} |