File indexing completed on 2024-04-28 11:20:32

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2009-2012 Alexander Rieder <alexanderrieder@gmail.com>
0004     SPDX-FileCopyrightText: 2018-2021 by Alexander Semke (alexander.semke@web.de)
0005 */
0006 
0007 #ifndef _MAXIMAEXPRESSION_H
0008 #define _MAXIMAEXPRESSION_H
0009 
0010 #include "expression.h"
0011 #include <QStringList>
0012 #include <QFileSystemWatcher>
0013 
0014 class QTemporaryFile;
0015 
0016 class MaximaExpression : public Cantor::Expression
0017 {
0018   Q_OBJECT
0019 
0020 public:
0021     explicit MaximaExpression(Cantor::Session*, bool internal = false);
0022     ~MaximaExpression() override;
0023 
0024     void evaluate() override;
0025     QString internalCommand() override;
0026 
0027     //Forces the status of this Expression to done
0028     void forceDone();
0029 
0030     //reads from @param out until a prompt indicates that a new expression has started
0031     void parseOutput(const QString&) override;
0032     void parseError(const QString&) override;
0033 
0034     void addInformation(const QString&) override;
0035 
0036 private Q_SLOTS:
0037     void imageChanged();
0038 
0039 private:
0040     void parseResult(const QString&);
0041 
0042     QTemporaryFile* m_tempFile = nullptr;
0043     QFileSystemWatcher m_fileWatch;
0044     bool m_isHelpRequest = false;
0045     bool m_isHelpRequestAdditional = false;
0046     bool m_isPlot = false;
0047     bool m_isDraw = false;
0048     Cantor::Result* m_plotResult = nullptr;
0049     int m_plotResultIndex = -1;
0050     QString m_errorBuffer;
0051     bool m_gotErrorContent = false;
0052 };
0053 
0054 #endif /* _MAXIMAEXPRESSION_H */