File indexing completed on 2024-05-26 11:22:03

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2016 Ivan Lakhtanov <ivan.lakhtanov@gmail.com>
0004 */
0005 #pragma once
0006 
0007 #include "expression.h"
0008 
0009 /**
0010  * Expression of Julia language
0011  */
0012 class JuliaExpression: public Cantor::Expression
0013 {
0014     Q_OBJECT
0015 public:
0016     /**
0017      * Creates new JuliaExpression
0018      *
0019      * @param session session to bound expression to
0020      * @param internal @see Cantor::Expression::Expression(Session*, bool)
0021      */
0022     explicit JuliaExpression(Cantor::Session *session, bool internal = false);
0023     ~JuliaExpression() override = default;
0024 
0025     /**
0026      * @see Cantor::Expression::evaluate
0027      */
0028     void evaluate() override;
0029 
0030     QString internalCommand() override;
0031 
0032     void parseOutput(const QString&) override {};
0033     void parseError(const QString&) override {};
0034 
0035     /**
0036      * Call this function from session when JuliaServer ends evaluation of
0037      * this expression.
0038      *
0039      * This checks inline plots, exceptions and set appropriate result
0040      */
0041     void finalize(const QString& output, const QString& error, bool wasException);
0042 
0043 public:
0044     static const QStringList plotExtensions;
0045 
0046 private:
0047     /// If not empty, it's a filename of plot image file expression is awaiting to get
0048     QString m_plot_filename;
0049 };