File indexing completed on 2024-05-12 16:02:27

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Laurent Valentin Jospin <laurent.valentin@famillejospin.ch>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_NUMPARSER_H
0008 #define KIS_NUMPARSER_H
0009 
0010 #include <QString>
0011 
0012 #include "kritawidgetutils_export.h"
0013 
0014 /*!
0015  * \brief the namespace contains functions to transform math expression written as QString in numbers.
0016  *
0017  * Computation is done in a recursive way, maybe not the most efficient way compared to infix to postfix conversion before parsing.
0018  * (TODO: look if it need to be changed).
0019  */
0020 namespace KisNumericParser {
0021 
0022     //! \brief parse an expression to a double.
0023     KRITAWIDGETUTILS_EXPORT double parseSimpleMathExpr(QString const& expr, bool* noProblem = 0);
0024 
0025     //! \brief parse an expression to an int.
0026     KRITAWIDGETUTILS_EXPORT int parseIntegerMathExpr(QString const& expr, bool* noProblem = 0);
0027 }
0028 
0029 #endif // KIS_NUMPARSER_H
0030