1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
// SPDX-FileCopyrightText: 2003 Dominique Devriese <devriese@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "../objects/common.h"
#include <string>
class KigDocument;
class ObjectImp;
class CompiledPythonScript
{
friend class PythonScripter;
class Private;
Private *const d;
CompiledPythonScript(Private *);
public:
CompiledPythonScript(const CompiledPythonScript &s);
~CompiledPythonScript();
ObjectImp *calc(const Args &a, const KigDocument &doc);
bool valid();
};
class PythonScripter
{
friend class CompiledPythonScript;
class Private;
Private *d;
PythonScripter();
~PythonScripter();
void clearErrors();
void saveErrors();
bool erroroccurred;
std::string lastexceptiontype;
std::string lastexceptionvalue;
std::string lastexceptiontraceback;
public:
static PythonScripter *instance();
bool errorOccurred() const;
std::string lastErrorExceptionType() const;
std::string lastErrorExceptionValue() const;
std::string lastErrorExceptionTraceback() const;
CompiledPythonScript compile(const char *code);
ObjectImp *calc(CompiledPythonScript &script, const Args &args);
};
|