From 26e813ad2e4fa13f4b2873df99cb8e3be380c875 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 27 Aug 2015 01:29:13 +0200 Subject: add method to get all string results --- diceparser.cpp | 23 +++++++++++++++++++++++ diceparser.h | 5 +++++ 2 files changed, 28 insertions(+) diff --git a/diceparser.cpp b/diceparser.cpp index 3831400..8c910a2 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -393,6 +393,29 @@ QString DiceParser::getStringResult() } return str; } +QStringList DiceParser::getAllStringResult(bool& hasAlias) +{ + ExecutionNode* next = getLeafNode(); + Result* result=next->getResult(); + QStringList stringListResult; + + while(NULL!=result) + { + if(result->hasResultOfType(Result::STRING)) + { + StringResult* stringResult = dynamic_cast(result); + if(NULL!=stringResult) + { + stringListResult << stringResult->getText(); + hasAlias = stringResult->hasHighLight(); + } + } + result = result->getPrevious(); + } + + return stringListResult; +} + void DiceParser::getLastDiceResult(ExportedDiceResult& diceValues) { ExecutionNode* next = getLeafNode(); diff --git a/diceparser.h b/diceparser.h index 3eb55f1..6cc6d47 100644 --- a/diceparser.h +++ b/diceparser.h @@ -191,6 +191,11 @@ public: * @param l the path. */ void setPathToHelp(QString l); + /** + * @brief getAllStringResult + * @return + */ + QStringList getAllStringResult(bool& hasAlias); private: /** -- cgit v1.2.3-70-g09d2 From 2d3a37b290b9fbd9be7a7fc4e722b30bb160ffd5 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 27 Aug 2015 01:29:45 +0200 Subject: disable the highlight --- node/helpnode.cpp | 1 + node/listaliasnode.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/node/helpnode.cpp b/node/helpnode.cpp index 6108e4d..62dc86e 100644 --- a/node/helpnode.cpp +++ b/node/helpnode.cpp @@ -9,6 +9,7 @@ void HelpNode::run(ExecutionNode* previous) { m_previousNode = previous; StringResult* txtResult = dynamic_cast(m_result); + txtResult->setHighLight(false); if(NULL != previous) { diff --git a/node/listaliasnode.cpp b/node/listaliasnode.cpp index ddb8ac9..1809eac 100644 --- a/node/listaliasnode.cpp +++ b/node/listaliasnode.cpp @@ -29,6 +29,7 @@ void ListAliasNode::run(ExecutionNode* previous ) { m_previousNode = previous; StringResult* txtResult = dynamic_cast(m_result); + txtResult->setHighLight(false); if(NULL != previous) { -- cgit v1.2.3-70-g09d2 From 0e4d08bf25a81ac68635f526f17ae5e82152cb10 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 27 Aug 2015 01:30:14 +0200 Subject: add highlight management --- result/stringresult.cpp | 10 ++++++++++ result/stringresult.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/result/stringresult.cpp b/result/stringresult.cpp index 4dbd577..474ae23 100644 --- a/result/stringresult.cpp +++ b/result/stringresult.cpp @@ -2,6 +2,7 @@ StringResult::StringResult() { + m_highlight = true; m_resultTypes = Result::STRING; } void StringResult::setText(QString text) @@ -35,3 +36,12 @@ QString StringResult::toString() { return QString("StringResult_value_%1").arg(getText().replace(" ","_")); } +void StringResult::setHighLight(bool b) +{ + m_highlight = b; +} + +bool StringResult::hasHighLight() const +{ + return m_highlight; +} diff --git a/result/stringresult.h b/result/stringresult.h index 5a6b26c..6819aaa 100644 --- a/result/stringresult.h +++ b/result/stringresult.h @@ -37,8 +37,12 @@ public: * @return */ virtual QString toString(); + + virtual void setHighLight(bool ); + virtual bool hasHighLight() const; private: QString m_value; + bool m_highlight; }; #endif // STRINGRESULT_H -- cgit v1.2.3-70-g09d2