From f30020384f816b498fe1f6013758a8de37811821 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Sun, 29 Dec 2013 02:04:19 +0100 Subject: Firt commit of the new dice system for rolisteam. --- diceparser.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 diceparser.h (limited to 'diceparser.h') diff --git a/diceparser.h b/diceparser.h new file mode 100644 index 0000000..022f95e --- /dev/null +++ b/diceparser.h @@ -0,0 +1,41 @@ +#ifndef DICEPARSER_H +#define DICEPARSER_H + +#include +#include +#include "node/executionnode.h" + +class Dice; + +class DiceParser +{ + +public: + enum DiceOperator {D}; + enum MathOperator {K,k,r,e}; + DiceParser(); + void parseLine(QString str); + +private: + bool readNumber(QString& str, int& myNumber); + bool readDice(QString& str,Dice&); + bool readDiceOperator(QString&,DiceOperator&); + bool readDiceExpression(QString&,ExecutionNode* & node); + bool readOperator(QString&); + + void setCurrentNode(ExecutionNode* node); + +private: + QMap* m_mapDiceOp; + ExecutionNode* m_start; + ExecutionNode* m_current; +}; + +class Dice +{ +public: + DiceParser::DiceOperator m_diceOp; + int m_faces; +}; + +#endif // DICEPARSER_H -- cgit v1.2.3-70-g09d2