File indexing completed on 2024-05-19 11:21:31

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2009 Alexander Rieder <alexanderrieder@gmail.com>
0004 */
0005 
0006 #ifndef _RSESSION_H
0007 #define _RSESSION_H
0008 
0009 #include <QRegExp>
0010 #include <QStringList>
0011 
0012 #include "session.h"
0013 #include "rserver_interface.h"
0014 
0015 class RExpression;
0016 class RVariableModel;
0017 class QProcess;
0018 
0019 namespace Cantor {
0020 class DefaultVariableModel;
0021 }
0022 
0023 class RSession : public Cantor::Session
0024 {
0025   Q_OBJECT
0026   public:
0027     explicit RSession( Cantor::Backend* backend);
0028     ~RSession() override;
0029 
0030     void login() override;
0031     void logout() override;
0032 
0033     void interrupt() override;
0034 
0035     Cantor::Expression* evaluateExpression(const QString& command, Cantor::Expression::FinishingBehavior behave = Cantor::Expression::FinishingBehavior::DoNotDelete, bool internal = false) override;
0036     Cantor::CompletionObject* completionFor(const QString& command, int index=-1) override;
0037     QSyntaxHighlighter* syntaxHighlighter(QObject* parent) override;
0038     void runFirstExpression() override;
0039 
0040     void sendInputToServer(const QString& input);
0041   protected Q_SLOTS:
0042     void serverChangedStatus(int status);
0043     void expressionFinished(int returnCode, const QString& text, const QStringList& files);
0044     void inputRequested(QString info);
0045 
0046   private:
0047     QProcess* m_process;
0048     org::kde::Cantor::R* m_rServer;
0049 };
0050 
0051 #endif /* _RSESSION_H */