File indexing completed on 2024-05-12 05:39:29

0001 /***************************************************************************
0002  * Copyright (C) 2014 by Renaud Guezennec                                   *
0003  * https://rolisteam.org/contact                      *
0004  *                                                                          *
0005  *  This file is part of DiceParser                                         *
0006  *                                                                          *
0007  * DiceParser is free software; you can redistribute it and/or modify       *
0008  * it under the terms of the GNU General Public License as published by     *
0009  * the Free Software Foundation; either version 2 of the License, or        *
0010  * (at your option) any later version.                                      *
0011  *                                                                          *
0012  * This program is distributed in the hope that it will be useful,          *
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of           *
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
0015  * GNU General Public License for more details.                             *
0016  *                                                                          *
0017  * You should have received a copy of the GNU General Public License        *
0018  * along with this program; if not, write to the                            *
0019  * Free Software Foundation, Inc.,                                          *
0020  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.                 *
0021  ***************************************************************************/
0022 #ifndef RESULT_H
0023 #define RESULT_H
0024 
0025 #include <QString>
0026 #include <QVariant>
0027 #include <diceparser/diceparserhelper.h>
0028 /**
0029  * @brief The Result class
0030  */
0031 class Result
0032 {
0033 public:
0034     /**
0035      * @brief Result
0036      */
0037     Result();
0038     /**
0039      * @brief ~Result
0040      */
0041     virtual ~Result();
0042 
0043     /**
0044      * @brief isScalar
0045      * @return
0046      */
0047     virtual bool hasResultOfType(Dice::RESULT_TYPE) const;
0048     /**
0049      * @brief getScalar
0050      * @return
0051      */
0052     virtual QVariant getResult(Dice::RESULT_TYPE)= 0;
0053     /**
0054      * @brief getPrevious
0055      * @return
0056      */
0057     virtual Result* getPrevious() const;
0058     /**
0059      * @brief setPrevious
0060      */
0061     virtual void setPrevious(Result*);
0062     /**
0063      * @brief isStringResult
0064      * @return
0065      */
0066     virtual bool isStringResult() const;
0067 
0068     virtual void clear();
0069 
0070     /**
0071      * @brief getStringResult
0072      * @return
0073      */
0074     virtual QString getStringResult() const;
0075     /**
0076      * @brief generateDotTree
0077      */
0078     void generateDotTree(QString&);
0079     /**
0080      * @brief toString
0081      * @return
0082      */
0083     virtual QString toString(bool wl)= 0;
0084     virtual Result* getCopy() const= 0;
0085 
0086     QString getId() const;
0087 
0088 protected:
0089     int m_resultTypes; /// @brief
0090     QString m_id;
0091 
0092 private:
0093     Result* m_previous= nullptr; /// @brief
0094 };
0095 
0096 #endif // RESULT_H