From cedc70618afa6826d409a64078ea1a8ede4af06c Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sat, 11 Nov 2017 18:51:13 +0100 Subject: -replace NULL to nullptr. --- diceparser.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index 42f46ac..e57a93c 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -50,7 +50,7 @@ #define DEFAULT_FACES_NUMBER 10 DiceParser::DiceParser() - : m_current(nullptr)//m_start(NULL), + : m_current(nullptr)//m_start(nullptr), { m_currentTreeHasSeparator =false; m_parsingToolbox = new ParsingToolBox(); @@ -199,12 +199,12 @@ bool DiceParser::parseLine(QString str) bool DiceParser::readExpression(QString& str,ExecutionNode* & node) { - ExecutionNode* operandNode=NULL; + ExecutionNode* operandNode=nullptr; QString result; QString comment; if(m_parsingToolbox->readOpenParentheses(str)) { - ExecutionNode* internalNode=NULL; + ExecutionNode* internalNode=nullptr; if(readExpression(str,internalNode)) { ParenthesesNode* parentheseNode = new ParenthesesNode(); @@ -213,7 +213,7 @@ bool DiceParser::readExpression(QString& str,ExecutionNode* & node) if(m_parsingToolbox->readCloseParentheses(str)) { - ExecutionNode* diceNode=NULL; + ExecutionNode* diceNode=nullptr; if(readDice(str,diceNode)) { parentheseNode->setNextNode(diceNode); @@ -224,7 +224,7 @@ bool DiceParser::readExpression(QString& str,ExecutionNode* & node) } else if(readOperand(str,operandNode)) { - ExecutionNode* diceNode=NULL; + ExecutionNode* diceNode=nullptr; if(readDice(str,diceNode)) { operandNode->setNextNode(diceNode); @@ -249,7 +249,7 @@ bool DiceParser::readExpression(QString& str,ExecutionNode* & node) } else { - ExecutionNode* diceNode=NULL; + ExecutionNode* diceNode=nullptr; if(readDice(str,diceNode)) { NumberNode* numberNode=new NumberNode(); @@ -330,7 +330,7 @@ QString DiceParser::displayResult() { DiceResult* myDiceResult = dynamic_cast(result); - if(NULL!=myDiceResult) + if(nullptr!=myDiceResult) { QString resulStr; @@ -392,7 +392,7 @@ QList DiceParser::getLastIntegerResults() ExecutionNode* next = getLeafNode(node); Result* result=next->getResult(); bool scalarDone = false; - while((result!=NULL)&&(!scalarDone)) + while((result!=nullptr)&&(!scalarDone)) { if(result->hasResultOfType(Result::SCALAR)) { @@ -465,7 +465,7 @@ QStringList DiceParser::getAllDiceResult(bool& hasAlias) if(result->hasResultOfType(Result::DICE_LIST)) { DiceResult* stringResult = dynamic_cast(result); - if(NULL!=stringResult) + if(nullptr!=stringResult) { for(auto die : stringResult->getResultList()) { @@ -503,12 +503,12 @@ void DiceParser::getLastDiceResult(QList& diceValuesList,boo ExecutionNode* next = getLeafNode(start); Result* result=next->getResult(); - while(NULL!=result) + while(nullptr!=result) { if(result->hasResultOfType(Result::DICE_LIST)) { DiceResult* diceResult = dynamic_cast(result); - if(NULL!=diceResult) + if(nullptr!=diceResult) { if(homogeneous) { @@ -770,13 +770,13 @@ bool DiceParser::readDiceExpression(QString& str,ExecutionNode* & node) { bool returnVal=false; - ExecutionNode* next = NULL; + ExecutionNode* next = nullptr; if(readDice(str,next)) { ExecutionNode* latest = next; while(readOption(str,latest)) { - while(NULL!=latest->getNextNode()) + while(nullptr!=latest->getNextNode()) { latest = latest->getNextNode(); } @@ -949,7 +949,7 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//, previous = addRollDiceNode(DEFAULT_FACES_NUMBER,previous); }*/ DiceRollerNode* nodeTmp = dynamic_cast(previous); - if(NULL!=nodeTmp) + if(nullptr!=nodeTmp) { previous = addExploseDiceNode(nodeTmp->getFaces(),previous); @@ -969,7 +969,7 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//, case Filter: { Validator* validator = m_parsingToolbox->readCompositeValidator(str); - if(NULL!=validator) + if(nullptr!=validator) { m_parsingToolbox->isValidValidator(previous,validator); @@ -996,7 +996,7 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//, case Count: { Validator* validator = m_parsingToolbox->readCompositeValidator(str); - if(NULL!=validator) + if(nullptr!=validator) { m_parsingToolbox->isValidValidator(previous,validator); @@ -1017,7 +1017,7 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//, case RerollAndAdd: { Validator* validator = m_parsingToolbox->readCompositeValidator(str); - if(NULL!=validator) + if(nullptr!=validator) { m_parsingToolbox->isValidValidator(previous,validator); RerollDiceNode* rerollNode = new RerollDiceNode(); @@ -1040,7 +1040,7 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//, case Explosing: { Validator* validator = m_parsingToolbox->readCompositeValidator(str); - if(NULL!=validator) + if(nullptr!=validator) { if(!m_parsingToolbox->isValidValidator(previous,validator)) { @@ -1083,10 +1083,10 @@ bool DiceParser::readOption(QString& str,ExecutionNode* previous)//, IfNode* nodeif = new IfNode(); nodeif->setConditionType(m_parsingToolbox->readConditionType(str)); Validator* validator = m_parsingToolbox->readCompositeValidator(str); - if(NULL!=validator) + if(nullptr!=validator) { - ExecutionNode* trueNode = NULL; - ExecutionNode* falseNode = NULL; + ExecutionNode* trueNode = nullptr; + ExecutionNode* falseNode = nullptr; if(readIfInstruction(str,trueNode,falseNode)) { nodeif->setInstructionTrue(trueNode); @@ -1153,7 +1153,7 @@ bool DiceParser::readBlocInstruction(QString& str,ExecutionNode*& resultnode) str=str.remove(0,1); ExecutionNode* node; Die::ArithmeticOperator op; - ScalarOperatorNode* scalarNode = NULL; + ScalarOperatorNode* scalarNode = nullptr; if(m_parsingToolbox->readArithmeticOperator(str,op)) { scalarNode = new ScalarOperatorNode(); @@ -1163,7 +1163,7 @@ bool DiceParser::readBlocInstruction(QString& str,ExecutionNode*& resultnode) { if(str.startsWith('}')) { - if(NULL==scalarNode) + if(nullptr==scalarNode) { resultnode = node; } -- cgit v1.2.3-70-g09d2 From 49b03bf175dc05e565773058d41e3f071b15c040 Mon Sep 17 00:00:00 2001 From: Gissu Date: Sat, 18 Nov 2017 23:42:04 +0100 Subject: diceparser on window display fix bug on display when you use windows --- diceparser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'diceparser.cpp') diff --git a/diceparser.cpp b/diceparser.cpp index e57a93c..0d661bd 100644 --- a/diceparser.cpp +++ b/diceparser.cpp @@ -565,7 +565,7 @@ QString DiceParser::getDiceCommand() const bool DiceParser::hasIntegerResultNotInFirst() { - bool result; + bool result=false; for(auto node : m_startNodes) { result |= hasResultOfType(Result::SCALAR,node); @@ -575,7 +575,7 @@ bool DiceParser::hasIntegerResultNotInFirst() bool DiceParser::hasDiceResult() { - bool result; + bool result=false; for(auto node : m_startNodes) { result |= hasResultOfType(Result::DICE_LIST,node); @@ -584,7 +584,7 @@ bool DiceParser::hasDiceResult() } bool DiceParser::hasStringResult() { - bool result; + bool result=false; for(auto node : m_startNodes) { result |= hasResultOfType(Result::STRING,node); -- cgit v1.2.3-70-g09d2