File indexing completed on 2024-05-19 05:51:35

0001 /*
0002  * SPDX-FileCopyrightText: 2023 Michael Lang <criticaltemp@protonmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 
0011 constexpr QStringView FRACTION_SLASH = u"\u2044";
0012 constexpr QStringView HAIR_SPACE = u"\u200A";
0013 
0014 class QalculateEngine : public QObject
0015 {
0016     Q_OBJECT
0017 public:
0018     static QalculateEngine *inst();
0019 
0020     QString lastResult() const
0021     {
0022         return m_result;
0023     }
0024 
0025     QString
0026     evaluate(QString &expression, bool *isApproximate = nullptr, const int baseEval = 10, const int basePrint = 10, bool exact = false, const int minExp = -1);
0027 
0028 private:
0029     QalculateEngine();
0030     QString m_result;
0031 };