File indexing completed on 2022-12-06 18:50:19

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
0004 */
0005 
0006 #ifndef _LOADEDEXPRESSION_H
0007 #define _LOADEDEXPRESSION_H
0008 
0009 #include "lib/expression.h"
0010 
0011 #include <QIODevice>
0012 #include <KZip>
0013 #include <QDomElement>
0014 
0015 class QJsonObject;
0016 
0017 /** This class is used to hold expressions
0018     loaded from a file. they can't be evaluated
0019     and only show the result, they loaded from xml.
0020     this is used to avoid most exceptions when
0021     dealing with loaded Worksheets instead of newly
0022     created ones.
0023 **/
0024 class LoadedExpression : public Cantor::Expression
0025 {
0026   public:
0027     explicit LoadedExpression( Cantor::Session* session );
0028     ~LoadedExpression() override = default;
0029 
0030     void evaluate() override;
0031     void interrupt() override;
0032 
0033     void parseOutput(const QString&) override {};
0034     void parseError(const QString&) override {};
0035 
0036     void loadFromXml(const QDomElement& xml, const KZip& file);
0037     void loadFromJupyter(const QJsonObject& cell);
0038 };
0039 
0040 #endif /* _LOADEDEXPRESSION_H */