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

0001 /*
0002     SPDX-License-Identifier: GPL-2.0-or-later
0003     SPDX-FileCopyrightText: 2015 Minh Ngo <minh@fedoraproject.org>
0004 */
0005 
0006 #ifndef _PYTHONSERVER_H
0007 #define _PYTHONSERVER_H
0008 #include <string>
0009 
0010 struct _object;
0011 using PyObject = _object;
0012 
0013 class PythonServer
0014 {
0015   public:
0016     explicit PythonServer() = default;
0017 
0018   public:
0019     void login();
0020     void interrupt();
0021     void setFilePath(const std::string& path, const std::string& dir);
0022     void runPythonCommand(const std::string& command);
0023     std::string getOutput() const;
0024     std::string getError() const;
0025     bool isError() const;
0026     std::string variables(bool parseValue);
0027 
0028   private:
0029     PyObject* m_pModule{nullptr};
0030     bool m_error{false};
0031     std::string filePath;
0032 };
0033 
0034 #endif